![]()  | 
  
    SPI
    
   SLEPc PETSc Interface is used for rapid development and intuitive matrix operations similar to MatLab or NumPy style of operations 
   | 
 
#include <SPIMat.hpp>
Public Member Functions | |
| SPIMat (std::string _name="SPIMat") | |
| constructor with no arguments (no initialization)  More... | |
| SPIMat (const std::vector< SPIVec > &A, std::string _name="SPIMat") | |
| SPIMat (const SPIMat &A, std::string _name="SPIMat") | |
| SPIMat (PetscInt rowscols, std::string _name="SPIMat") | |
| SPIMat (PetscInt rowsm, PetscInt colsn, std::string _name="SPIMat") | |
| constructor of rectangular matrix  More... | |
| PetscInt | Init (PetscInt m, PetscInt n, std::string name="SPIMat") | 
| SPIMat & | set (PetscInt m, PetscInt n, const PetscScalar v) | 
| SPIMat & | set_col (const PetscInt col, const SPIVec &v) | 
| SPIMat & | add (PetscInt m, PetscInt n, const PetscScalar v) | 
| add a scalar value at position row m and column n  More... | |
| PetscScalar | operator() (PetscInt m, PetscInt n, PetscBool global=PETSC_FALSE) | 
| get local value at row m, column n  More... | |
| PetscScalar | operator() (PetscInt m, PetscInt n, PetscBool global=PETSC_FALSE) const | 
| get local value at row m, column n  More... | |
| SPIMat & | operator() (PetscInt m, PetscInt n, const PetscScalar v) | 
| set operator the same as set function  More... | |
| SPIMat & | operator() (PetscInt m, PetscInt n, const double v) | 
| set operator the same as set function  More... | |
| SPIMat & | operator() (PetscInt m, PetscInt n, const int v) | 
| set operator the same as set function  More... | |
| SPIMat & | operator() (PetscInt m, PetscInt n, const SPIMat &Asub, InsertMode addv=INSERT_VALUES) | 
| set submatrix into matrix at row m, col n  More... | |
| SPIMat & | operator() () | 
| assmelbe the matrix  More... | |
| SPIMat & | operator+= (const SPIMat &X) | 
| MatAXPY, Y = 1.*X + Y operation.  More... | |
| SPIMat & | axpy (const PetscScalar a, const SPIMat &X) | 
| MatAXPY function call to add a*X to the current mat.  More... | |
| SPIMat | operator+ (const SPIMat &X) | 
| Y + X operation.  More... | |
| SPIMat & | operator-= (const SPIMat &X) | 
| Y = -1.*X + Y operation.  More... | |
| SPIMat | operator- (const SPIMat &X) | 
| Y - X operation.  More... | |
| SPIMat | operator- () const | 
| -X operation  More... | |
| SPIMat | operator* (const PetscScalar a) | 
| Y*a operation.  More... | |
| SPIMat | operator* (const double a) | 
| Y*a operation.  More... | |
| SPIVec | operator* (const SPIVec &x) | 
| A*x operation to return a vector.  More... | |
| SPIMat & | operator*= (const PetscScalar a) | 
| Y = Y*a operation.  More... | |
| SPIMat & | operator*= (const double a) | 
| Y = Y*a operation.  More... | |
| SPIMat & | operator/= (const PetscScalar a) | 
| Y = Y/a operation.  More... | |
| SPIMat | operator/ (const PetscScalar a) | 
| Z = Y/a operation.  More... | |
| SPIMat | operator/ (const SPIMat &A) | 
| Z = Y/A operation.  More... | |
| SPIMat | operator* (const SPIMat &A) | 
| Y*A operation.  More... | |
| SPIMat & | operator= (const SPIMat &A) | 
| Y=X with initialization of Y using MatConvert.  More... | |
| PetscInt | T (SPIMat &A) | 
| A = Transpose(*this.mat) operation with initialization of A.  More... | |
| SPIMat & | T () | 
| Transpose the current mat.  More... | |
| PetscInt | H (SPIMat &A) | 
| A = Hermitian Transpose(*this.mat) operation with initialization of A (tranpose and complex conjugate)  More... | |
| SPIMat & | H () | 
| Hermitian Transpose the current mat.  More... | |
| SPIVec | H (const SPIVec &q) | 
| Hermitian Transpose multiplication with the current mat.  More... | |
| SPIMat & | conj () | 
| elemenwise conjugate current matrix  More... | |
| SPIMat & | real () | 
| take the real part of the vector  More... | |
| SPIVec | diag () | 
| get diagonal of matrix  More... | |
| SPIMat & | zero_row (const PetscInt row) | 
| set a row to zero  More... | |
| SPIMat & | eye_row (const PetscInt row) | 
| set a row to zero and set 1 in diagonal entry  More... | |
| SPIMat & | zero_row_full (const PetscInt row) | 
| set a row to zero using dense format  More... | |
| SPIMat & | zero_rows (std::vector< PetscInt > rows) | 
| set rows to zero  More... | |
| SPIMat & | eye_rows (std::vector< PetscInt > rows) | 
| set rows to zero and set main diagonal to 1  More... | |
| SPIVec | col (const PetscInt i) | 
| get column vector  More... | |
| PetscInt | print () | 
| print mat to screen using PETSC_VIEWER_STDOUT_WORLD  More... | |
| ~SPIMat () | |
| destructor to delete memory  More... | |
Data Fields | |
| PetscInt | rows | 
| number of rows in mat  More... | |
| PetscInt | cols | 
| number of columns in mat  More... | |
| Mat | mat | 
| petsc Mat 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 | 
| Matrix name.  More... | |
Definition at line 17 of file SPIMat.hpp.
| SPI::SPIMat::SPIMat | ( | std::string | _name = "SPIMat" | ) | 
constructor with no arguments (no initialization)
| [in] | _name | [in] name of SPIMat | 
Definition at line 13 of file SPIMat.cpp.
| SPI::SPIMat::SPIMat | ( | const std::vector< SPIVec > & | A, | 
| std::string | _name = "SPIMat"  | 
        ||
| ) | 
constructor using a vector of column vectors
Definition at line 25 of file SPIMat.cpp.
| SPI::SPIMat::SPIMat | ( | const SPIMat & | A, | 
| std::string | _name = "SPIMat"  | 
        ||
| ) | 
| SPI::SPIMat::SPIMat | ( | PetscInt | rowscols, | 
| std::string | _name = "SPIMat"  | 
        ||
| ) | 
constructor with one arguement to make square matrix
| [in] | rowscols | [in] number of rows and columns to make the square matrix | 
| [in] | _name | [in] name of SPIMat | 
Definition at line 38 of file SPIMat.cpp.
| SPI::SPIMat::SPIMat | ( | PetscInt | rowsm, | 
| PetscInt | colsn, | ||
| std::string | _name = "SPIMat"  | 
        ||
| ) | 
constructor of rectangular matrix
| [in] | rowsm | [in] number of rows in matrix | 
| [in] | colsn | [in] number of columns in matrix | 
| [in] | _name | [in] name of SPIMat | 
Definition at line 45 of file SPIMat.cpp.
| SPI::SPIMat::~SPIMat | ( | ) | 
destructor to delete memory
Definition at line 508 of file SPIMat.cpp.
| SPIMat & SPI::SPIMat::add | ( | PetscInt | m, | 
| PetscInt | n, | ||
| const PetscScalar | v | ||
| ) | 
add a scalar value at position row m and column n
| [in] | m | [in] row to add scalar | 
| [in] | n | [in] column to add scalar | 
| [in] | v | [in] scalar to add in matrix | 
Definition at line 97 of file SPIMat.cpp.
MatAXPY function call to add a*X to the current mat.
| [in] | a | [in] scalar a in Y = a*X + Y operation | 
| [in] | X | [in] matrix X in Y = a*X + Y operation | 
Definition at line 232 of file SPIMat.cpp.
| SPIVec SPI::SPIMat::col | ( | const PetscInt | i | ) | 
| SPIMat & SPI::SPIMat::conj | ( | ) | 
elemenwise conjugate current matrix
Definition at line 435 of file SPIMat.cpp.
| SPIVec SPI::SPIMat::diag | ( | ) | 
| SPIMat & SPI::SPIMat::eye_row | ( | const PetscInt | row | ) | 
set a row to zero and set 1 in diagonal entry
| [in] | row | [in] which row to zero out of the matrix | 
Definition at line 458 of file SPIMat.cpp.
| SPIMat & SPI::SPIMat::eye_rows | ( | std::vector< PetscInt > | rows | ) | 
set rows to zero and set main diagonal to 1
| [in] | rows | [in] which rows to zero out of the matrix | 
Definition at line 482 of file SPIMat.cpp.
| SPIMat & SPI::SPIMat::H | ( | ) | 
Hermitian Transpose the current mat.
Definition at line 422 of file SPIMat.cpp.
Hermitian Transpose multiplication with the current mat.
| [in] | x | [in] x vector to multiply by the Hermitian Transpose. y = A^H*x | 
Definition at line 427 of file SPIMat.cpp.
| PetscInt SPI::SPIMat::H | ( | SPIMat & | A | ) | 
A = Hermitian Transpose(*this.mat) operation with initialization of A (tranpose and complex conjugate)
| [out] | A | [out] hermitian transpose of current matrix saved in new initialized matrix | 
Definition at line 415 of file SPIMat.cpp.
| PetscInt SPI::SPIMat::Init | ( | PetscInt | m, | 
| PetscInt | n, | ||
| std::string | _name = "SPIMat"  | 
        ||
| ) | 
initialize the matrix of size m by n
| [in] | m | [in] number of rows | 
| [in] | n | [in] number of columns | 
| [in] | _name | [in] name of SPIMat | 
Definition at line 55 of file SPIMat.cpp.
| SPIMat & SPI::SPIMat::operator() | ( | ) | 
| SPIMat & SPI::SPIMat::operator() | ( | PetscInt | m, | 
| PetscInt | n, | ||
| const double | v | ||
| ) | 
set operator the same as set function
| [in] | m | [in] row to set scalar | 
| [in] | n | [in] column to set scalar | 
| [in] | v | [in] scalar to set in matrix | 
Definition at line 160 of file SPIMat.cpp.
| SPIMat & SPI::SPIMat::operator() | ( | PetscInt | m, | 
| PetscInt | n, | ||
| const int | v | ||
| ) | 
set operator the same as set function
| [in] | m | [in] row to set scalar | 
| [in] | n | [in] column to set scalar | 
| [in] | v | [in] scalar to set in matrix | 
Definition at line 169 of file SPIMat.cpp.
| SPIMat & SPI::SPIMat::operator() | ( | PetscInt | m, | 
| PetscInt | n, | ||
| const PetscScalar | v | ||
| ) | 
set operator the same as set function
| [in] | m | [in] row to set scalar | 
| [in] | n | [in] column to set scalar | 
| [in] | v | [in] scalar to set in matrix | 
Definition at line 150 of file SPIMat.cpp.
| SPIMat & SPI::SPIMat::operator() | ( | PetscInt | m, | 
| PetscInt | n, | ||
| const SPIMat & | Asub, | ||
| InsertMode | addv = INSERT_VALUES  | 
        ||
| ) | 
set submatrix into matrix at row m, col n
| [in] | m | [in] row to set submatrix | 
| [in] | n | [in] column to set submatrix | 
| [in] | Asub | [in] submatrix to set in matrix | 
| [in] | addv | [in] default to ADD_VALUES in submatrix, can do INSERT_VALUES instead | 
Definition at line 180 of file SPIMat.cpp.
| PetscScalar SPI::SPIMat::operator() | ( | PetscInt | m, | 
| PetscInt | n, | ||
| PetscBool | global = PETSC_FALSE  | 
        ||
| ) | 
get local value at row m, column n
| [in] | m | [in] row to get scalar | 
| [in] | n | [in] column to get scalar | 
| [in] | global | [in] whether to broadcast value to all processors or not (default is false) | 
Definition at line 129 of file SPIMat.cpp.
| PetscScalar SPI::SPIMat::operator() | ( | PetscInt | m, | 
| PetscInt | n, | ||
| PetscBool | global = PETSC_FALSE  | 
        ||
| ) | const | 
get local value at row m, column n
| [in] | m | [in] row to get scalar | 
| [in] | n | [in] column to get scalar | 
| [in] | global | [in] whether to broadcast value to all processors or not (default is false) | 
Definition at line 106 of file SPIMat.cpp.
| SPIMat SPI::SPIMat::operator* | ( | const double | a | ) | 
Y*a operation.
| [in] | a | [in] scalar | 
Definition at line 294 of file SPIMat.cpp.
| SPIMat SPI::SPIMat::operator* | ( | const PetscScalar | a | ) | 
Y*a operation.
| [in] | a | [in] scalar | 
Definition at line 285 of file SPIMat.cpp.
Y*A operation.
| [in] | A | [in] A matrix in Y*A operation | 
Definition at line 354 of file SPIMat.cpp.
A*x operation to return a vector.
| [in] | x | [in] x in A*x matrix vector multiplication | 
Definition at line 303 of file SPIMat.cpp.
| SPIMat & SPI::SPIMat::operator*= | ( | const double | a | ) | 
Y = Y*a operation.
| [in] | a | [in] scalar in Y*a operation | 
Definition at line 313 of file SPIMat.cpp.
| SPIMat & SPI::SPIMat::operator*= | ( | const PetscScalar | a | ) | 
Y = Y*a operation.
| [in] | a | [in] scalar in Y*a operation | 
Definition at line 320 of file SPIMat.cpp.
Y + X operation.
| [in] | X | [in] X in Y+X operation | 
Definition at line 241 of file SPIMat.cpp.
MatAXPY, Y = 1.*X + Y operation.
| [in] | X | [in] X in Y+=X operation | 
Definition at line 225 of file SPIMat.cpp.
| SPIMat SPI::SPIMat::operator- | ( | ) | const | 
Y - X operation.
| [in] | X | [in] X in Y-X operation | 
Definition at line 264 of file SPIMat.cpp.
Y = -1.*X + Y operation.
| [in] | X | [in] X in Y = -1.*X + Y operation | 
Definition at line 256 of file SPIMat.cpp.
| SPIMat SPI::SPIMat::operator/ | ( | const PetscScalar | a | ) | 
Z = Y/a operation.
| [in] | a | [in] scalar in Y*a operation | 
Definition at line 334 of file SPIMat.cpp.
Z = Y/A operation.
| [in] | A | [in] A in Y/A operation | 
Definition at line 340 of file SPIMat.cpp.
| SPIMat & SPI::SPIMat::operator/= | ( | const PetscScalar | a | ) | 
Y = Y/a operation.
| [in] | a | [in] scalar in Y*a operation | 
Definition at line 327 of file SPIMat.cpp.
Y=X with initialization of Y using MatConvert.
| [in] | A | [in] A in Y=A operation | 
Definition at line 367 of file SPIMat.cpp.
| PetscInt SPI::SPIMat::print | ( | ) | 
print mat to screen using PETSC_VIEWER_STDOUT_WORLD
Definition at line 498 of file SPIMat.cpp.
| SPIMat & SPI::SPIMat::real | ( | ) | 
take the real part of the vector
Definition at line 440 of file SPIMat.cpp.
| SPIMat & SPI::SPIMat::set | ( | PetscInt | m, | 
| PetscInt | n, | ||
| const PetscScalar | v | ||
| ) | 
set a scalar value at position row m and column n
| [in] | m | [in] row to insert scalar | 
| [in] | n | [in] column to insert scalar | 
| [in] | v | [in] scalar to insert in matrix | 
Definition at line 77 of file SPIMat.cpp.
set a column vector into a matrix
| [in] | col | [in] | 
| [in] | v | [in] | 
Definition at line 86 of file SPIMat.cpp.
| SPIMat & SPI::SPIMat::T | ( | ) | 
Transpose the current mat.
Definition at line 405 of file SPIMat.cpp.
| PetscInt SPI::SPIMat::T | ( | SPIMat & | A | ) | 
A = Transpose(*this.mat) operation with initialization of A.
| [out] | A | [out] transpose of current matrix | 
Definition at line 392 of file SPIMat.cpp.
| SPIMat & SPI::SPIMat::zero_row | ( | const PetscInt | row | ) | 
set a row to zero
| [in] | row | [in] which row to zero out of the matrix | 
Definition at line 451 of file SPIMat.cpp.
| SPIMat & SPI::SPIMat::zero_row_full | ( | const PetscInt | row | ) | 
set a row to zero using dense format
| [in] | row | [in] which row to zero out of the matrix | 
Definition at line 465 of file SPIMat.cpp.
| SPIMat & SPI::SPIMat::zero_rows | ( | std::vector< PetscInt > | rows | ) | 
set rows to zero
| [in] | rows | [in] which rows to zero out of the matrix | 
Definition at line 475 of file SPIMat.cpp.
| PetscInt SPI::SPIMat::cols | 
number of columns in mat
Definition at line 19 of file SPIMat.hpp.
| PetscBool SPI::SPIMat::flag_init =PETSC_FALSE | 
flag if it has been initialized
Definition at line 32 of file SPIMat.hpp.
| PetscErrorCode SPI::SPIMat::ierr | 
ierr for various routines and operators
Definition at line 29 of file SPIMat.hpp.
| Mat SPI::SPIMat::mat | 
petsc Mat data
Definition at line 28 of file SPIMat.hpp.
| std::string SPI::SPIMat::name | 
Matrix name.
Definition at line 33 of file SPIMat.hpp.
| PetscInt SPI::SPIMat::rows | 
number of rows in mat
Definition at line 18 of file SPIMat.hpp.
 1.8.17