SPI
SLEPc PETSc Interface is used for rapid development and intuitive matrix operations similar to MatLab or NumPy style of operations
|
#include <SPIVec.hpp>
Public Member Functions | |
SPIVec (std::string _name="SPIVec") | |
constructor with no arguments (no initialization) More... | |
SPIVec (const SPIVec &A, std::string _name="SPIVec") | |
constructor using another SPIVec More... | |
SPIVec (const PetscInt _rows, const std::string _name="SPIVec") | |
constructor with one arguement to make vector of length rows More... | |
PetscInt | Init (const PetscInt _rows, const std::string name="SPIVec") |
initialize the vector of size _rows More... | |
PetscInt | set (const PetscInt _row, const PetscScalar v) |
PetscInt | set (const PetscScalar v) |
PetscInt | add (PetscInt _row, const PetscScalar v) |
PetscInt | size () |
PetscScalar | operator() (PetscInt _row, PetscBool global=PETSC_FALSE) |
PetscScalar | operator() (PetscInt _row, PetscBool global=PETSC_FALSE) const |
PetscInt | operator() (PetscInt _row, const PetscScalar v) |
PetscInt | operator() (PetscInt _row, const double v) |
PetscInt | operator() (PetscInt _row, const int v) |
SPIVec & | operator() () |
SPIVec & | operator+= (const SPIVec &X) |
SPIVec & | axpy (const PetscScalar a, const SPIVec &X) |
SPIVec | operator+ (const SPIVec &X) |
SPIVec | operator+ (const PetscScalar a) |
SPIVec | operator+ (const double a) |
SPIVec | operator- (const PetscScalar a) |
SPIVec | operator- (const PetscInt a) |
SPIVec & | operator-= (const SPIVec &X) |
SPIVec | operator- (const SPIVec &X) |
SPIVec | operator- () const |
SPIVec | operator* (const PetscScalar a) |
SPIVec | operator* (const double a) |
SPIVec & | operator*= (const PetscScalar a) |
SPIVec & | operator*= (const double a) |
SPIVec & | operator*= (const SPIVec &a) |
SPIVec | operator* (const SPIVec &X) |
SPIVec | operator/ (const PetscScalar a) |
SPIVec | operator/ (const double a) |
SPIVec | operator/ (const SPIVec X) |
SPIVec & | operator/= (const PetscScalar a) |
SPIVec | operator^ (const PetscScalar p) |
pow operation pow(this,p) More... | |
SPIVec | operator^ (const double p) |
pow operation pow(this,p) More... | |
SPIVec | operator^ (const int p) |
pow operation pow(this,p) More... | |
SPIVec | operator^ (SPIVec p) |
pow operation pow(this,p) More... | |
SPIVec & | operator= (const SPIVec &X) |
PetscBool | operator== (const SPIVec &x2) |
== VecEqual test if this==x2 More... | |
SPIVec & | conj () |
PetscScalar | max () |
PetscInt | argmax () |
SPIVec & | real () |
take the real part of the vector More... | |
SPIVec & | imag () |
take the imaginary part of the vector More... | |
PetscScalar | dot (SPIVec y) |
take the inner product of two vectors More... | |
PetscInt | print () |
~SPIVec () | |
Data Fields | |
PetscInt | rows =0 |
number of rows in vec More... | |
Vec | vec |
petsc Vec data More... | |
PetscErrorCode | ierr |
ierr for various routines and operators More... | |
PetscBool | flag_init =PETSC_FALSE |
flag if it has been initialized More... | |
std::string | name |
Vec name (important for hdf5 i/o) More... | |
Definition at line 13 of file SPIVec.hpp.
SPI::SPIVec::SPIVec | ( | std::string | _name = "SPIVec" | ) |
constructor with no arguments (no initialization)
[in] | _name | [in] name of SPIVec (important with hdf5 i/o) |
Definition at line 9 of file SPIVec.cpp.
SPI::SPIVec::SPIVec | ( | const SPIVec & | A, |
std::string | _name = "SPIVec" |
||
) |
constructor using another SPIVec
[in] | A | [in] SPIVec to copy and initialize from |
[in] | _name | [in] name of SPIVec (important with hdf5 i/o) |
Definition at line 13 of file SPIVec.cpp.
SPI::SPIVec::SPIVec | ( | const PetscInt | _rows, |
const std::string | _name = "SPIVec" |
||
) |
constructor with one arguement to make vector of length rows
[in] | _rows | [in] number of rows to initialize vector |
[in] | _name | [in] name of SPIVec (important with hdf5 i/o) |
Definition at line 21 of file SPIVec.cpp.
SPI::SPIVec::~SPIVec | ( | ) |
destructor to delete memory
Definition at line 483 of file SPIVec.cpp.
PetscInt SPI::SPIVec::add | ( | PetscInt | _row, |
const PetscScalar | v | ||
) |
add a scalar value at position row if owned by processor
[in] | _row | [in] position to add value |
[in] | v | [in] value to add at position _row |
Definition at line 83 of file SPIVec.cpp.
PetscInt SPI::SPIVec::argmax | ( | ) |
maximum index value of vector
Definition at line 437 of file SPIVec.cpp.
VecAXPY Y=a*X+Y operation to add a*X to the current vec
[in] | a | [in] scalar a in Y=a*X+Y operation |
[in] | X | [in] vec X in Y=a*X+Y operation |
Definition at line 184 of file SPIVec.cpp.
SPIVec & SPI::SPIVec::conj | ( | ) |
elementwise conjugate current vector
Definition at line 419 of file SPIVec.cpp.
PetscScalar SPI::SPIVec::dot | ( | SPIVec | y | ) |
take the inner product of two vectors
[in] | y | [in] second vector in inner product (x,y) or y^H x |
Definition at line 459 of file SPIVec.cpp.
SPIVec & SPI::SPIVec::imag | ( | ) |
take the imaginary part of the vector
Definition at line 454 of file SPIVec.cpp.
PetscInt SPI::SPIVec::Init | ( | const PetscInt | _rows, |
const std::string | _name = "SPIVec" |
||
) |
initialize the vector of size _rows
[in] | _rows | [in] number of rows to initialize vector |
[in] | _name | [in] name of SPIVec (important with hdf5 i/o) |
Definition at line 44 of file SPIVec.cpp.
PetscScalar SPI::SPIVec::max | ( | ) |
maximum value of vector
Definition at line 425 of file SPIVec.cpp.
SPIVec & SPI::SPIVec::operator() | ( | ) |
PetscInt SPI::SPIVec::operator() | ( | PetscInt | _row, |
const double | v | ||
) |
same as above
Definition at line 158 of file SPIVec.cpp.
PetscInt SPI::SPIVec::operator() | ( | PetscInt | _row, |
const int | v | ||
) |
same as above
Definition at line 163 of file SPIVec.cpp.
PetscInt SPI::SPIVec::operator() | ( | PetscInt | _row, |
const PetscScalar | v | ||
) |
set operator the same as set function
[in] | _row | [in] row to set the value |
[in] | v | [in] value to set in the row |
Definition at line 145 of file SPIVec.cpp.
PetscScalar SPI::SPIVec::operator() | ( | PetscInt | _row, |
PetscBool | global = PETSC_FALSE |
||
) |
get value at row (on all processors)
_row | what row to get value | |
[in] | global | [in] whether to broadcast value to all processors or not (default is false) |
Definition at line 125 of file SPIVec.cpp.
PetscScalar SPI::SPIVec::operator() | ( | PetscInt | _row, |
PetscBool | global = PETSC_FALSE |
||
) | const |
get value at row (on all processors)
_row | what row to get value | |
[in] | global | [in] whether to broadcast value to all processors or not (default is false) |
Definition at line 105 of file SPIVec.cpp.
SPIVec SPI::SPIVec::operator* | ( | const double | a | ) |
same as above
Definition at line 280 of file SPIVec.cpp.
SPIVec SPI::SPIVec::operator* | ( | const PetscScalar | a | ) |
Y*a operation
[in] | a | [in] a in Z=Y*a operation |
Definition at line 271 of file SPIVec.cpp.
Y*X pointwise multiply operation
[in] | X | [in] X in Z=Y*X operation |
Definition at line 311 of file SPIVec.cpp.
SPIVec & SPI::SPIVec::operator*= | ( | const double | a | ) |
Y = Y*a operation
[in] | a | [in] scalar a in Y*=a operation |
Definition at line 296 of file SPIVec.cpp.
SPIVec & SPI::SPIVec::operator*= | ( | const PetscScalar | a | ) |
Y = Y*a operation
[in] | a | [in] scalar a in Y*=a operation |
Definition at line 289 of file SPIVec.cpp.
Y = Y*a operation
[in] | a | [in] SPIVec a in Y*=a operation |
Definition at line 303 of file SPIVec.cpp.
SPIVec SPI::SPIVec::operator+ | ( | const double | a | ) |
Y+a operation
[in] | a | [in] scalar a in Y+a operation |
Definition at line 216 of file SPIVec.cpp.
SPIVec SPI::SPIVec::operator+ | ( | const PetscScalar | a | ) |
Y+a operation
[in] | a | [in] scalar a in Y+a operation |
Definition at line 207 of file SPIVec.cpp.
Y+X operation
[in] | X | [in] X in Z=Y+X operation |
Definition at line 193 of file SPIVec.cpp.
VecAXPY Y = 1.*X + Y operation
[in] | X | [in] X in Y += X operation |
Definition at line 177 of file SPIVec.cpp.
SPIVec SPI::SPIVec::operator- | ( | ) | const |
SPIVec SPI::SPIVec::operator- | ( | const PetscInt | a | ) |
Y-a operation
[in] | a | [in] scalar a in Y-a operation |
Definition at line 234 of file SPIVec.cpp.
SPIVec SPI::SPIVec::operator- | ( | const PetscScalar | a | ) |
Y-a operation
[in] | a | [in] scalar a in Y-a operation |
Definition at line 225 of file SPIVec.cpp.
Y - X operation
[in] | X | [in] X in Y-X operation |
Definition at line 252 of file SPIVec.cpp.
Y = -1.*X + Y operation
[in] | X | [in] X in Y=-1*X + Y operation |
Definition at line 244 of file SPIVec.cpp.
SPIVec SPI::SPIVec::operator/ | ( | const double | a | ) |
same as above
Definition at line 332 of file SPIVec.cpp.
SPIVec SPI::SPIVec::operator/ | ( | const PetscScalar | a | ) |
pointwise divide by scalar a
[in] | a | [in] scalar a in Z=Y/a operation |
Definition at line 323 of file SPIVec.cpp.
pointwise divide by X
[in] | X | [in] X in Z=Y/X operation |
Definition at line 340 of file SPIVec.cpp.
SPIVec & SPI::SPIVec::operator/= | ( | const PetscScalar | a | ) |
Y = Y*a pointwise divide operation
[in] | a | [in] scalar a in Y/=a operation |
Definition at line 349 of file SPIVec.cpp.
Y=X with initialization of Y using VecCopy and VecDuplicate
Definition at line 382 of file SPIVec.cpp.
PetscBool SPI::SPIVec::operator== | ( | const SPIVec & | x2 | ) |
== VecEqual test if this==x2
[in] | x2 | [in] x2 in test |
Definition at line 404 of file SPIVec.cpp.
SPIVec SPI::SPIVec::operator^ | ( | const double | p | ) |
pow operation pow(this,p)
[in] | p | [in] exponent of this^p operation |
Definition at line 363 of file SPIVec.cpp.
SPIVec SPI::SPIVec::operator^ | ( | const int | p | ) |
pow operation pow(this,p)
[in] | p | [in] exponent of this^p operation |
Definition at line 369 of file SPIVec.cpp.
SPIVec SPI::SPIVec::operator^ | ( | const PetscScalar | p | ) |
pow operation pow(this,p)
[in] | p | [in] exponent of this^p operation |
Definition at line 357 of file SPIVec.cpp.
pow operation pow(this,p)
[in] | p | [in] exponent of this^p operation |
Definition at line 375 of file SPIVec.cpp.
PetscInt SPI::SPIVec::print | ( | ) |
print vec to screen using PETSC_VIEWER_STDOUT_WORLD
Definition at line 470 of file SPIVec.cpp.
SPIVec & SPI::SPIVec::real | ( | ) |
take the real part of the vector
Definition at line 449 of file SPIVec.cpp.
PetscInt SPI::SPIVec::set | ( | const PetscInt | _row, |
const PetscScalar | v | ||
) |
set a scalar value at a position row if owned by processor
[in] | _row | [in] position to set value |
[in] | v | [in] value to set in vec |
Definition at line 64 of file SPIVec.cpp.
PetscInt SPI::SPIVec::set | ( | const PetscScalar | v | ) |
set a scalar value at all positions
[in] | v | [in] value to set in vec |
Definition at line 76 of file SPIVec.cpp.
PetscInt SPI::SPIVec::size | ( | ) |
get the global size of the vector
Definition at line 96 of file SPIVec.cpp.
PetscBool SPI::SPIVec::flag_init =PETSC_FALSE |
flag if it has been initialized
Definition at line 25 of file SPIVec.hpp.
PetscErrorCode SPI::SPIVec::ierr |
ierr for various routines and operators
Definition at line 22 of file SPIVec.hpp.
std::string SPI::SPIVec::name |
Vec name (important for hdf5 i/o)
Definition at line 26 of file SPIVec.hpp.
PetscInt SPI::SPIVec::rows =0 |
number of rows in vec
Definition at line 14 of file SPIVec.hpp.
Vec SPI::SPIVec::vec |
petsc Vec data
Definition at line 21 of file SPIVec.hpp.