 |
SPI
SLEPc PETSc Interface is used for rapid development and intuitive matrix operations similar to MatLab or NumPy style of operations
|
Go to the documentation of this file.
8 #include <petscviewerhdf5.h>
17 SPIVec( std::string _name=
"SPIVec" );
19 SPIVec(
const PetscInt _rows,
const std::string _name=
"SPIVec" );
28 PetscInt
Init(
const PetscInt _rows,
const std::string
name=
"SPIVec");
29 PetscInt
set(
const PetscInt _row,
const PetscScalar v);
30 PetscInt
set(
const PetscScalar v);
31 PetscInt
add(PetscInt _row,
const PetscScalar v);
35 PetscScalar
operator()(PetscInt _row, PetscBool global=PETSC_FALSE);
36 PetscScalar
operator()(PetscInt _row, PetscBool global=PETSC_FALSE)
const;
37 PetscInt
operator()(PetscInt _row,
const PetscScalar v);
38 PetscInt
operator()(PetscInt _row,
const double v);
39 PetscInt
operator()(PetscInt _row,
const int v);
92 PetscInt
save(
const SPIVec &A, std::string filename);
93 PetscInt
save(std::vector<PetscScalar> A, std::string variablename, std::string filename);
94 PetscInt
save(std::vector<SPIVec> A, std::string variablename, std::string filename);
95 PetscInt
load(
SPIVec &A,
const std::string filename);
101 SPIVec linspace(
const PetscScalar begin,
const PetscScalar end,
const PetscInt rows);
102 SPIVec arange(
const PetscScalar begin,
const PetscScalar end,
const PetscScalar stepsize=1);
135 PetscReal
L2(
const SPIVec x1, NormType type=NORM_2);
SPIVec(std::string _name="SPIVec")
constructor with no arguments (no initialization)
SPIMat sin(const SPIMat &A)
take the sin of each element in a matrix
SPIVec real(const SPIVec &A)
return the real part of the vector
SPIVec atanh(const SPIVec &A)
take the atanh of each element in a vector
SPIVec & real()
take the real part of the vector
SPIVec operator-(const PetscScalar a, const SPIVec &A)
SPIVec erf(const SPIVec &A)
take the erf of each element in a vector
PetscBool operator==(const SPIVec &x2)
== VecEqual test if this==x2
SPIVec acosh(const SPIVec &A)
take the acosh of each element in a vector
SPIVec arange(const PetscScalar begin, const PetscScalar end, const PetscScalar stepsize=1)
return a range of number of equally spaced points between begin and end by step size step
SPIVec & operator=(const SPIVec &X)
PetscBool flag_init
flag if it has been initialized
PetscScalar sum(SPIVec x)
take the sum of a vector
SPIVec operator*(const PetscScalar a)
SPIVec conj(const SPIVec &A)
SPIVec & operator*=(const PetscScalar a)
SPIVec ones(const PetscInt rows)
PetscInt save(const SPIMat &A, const std::string filename)
save matrix to filename in binary format (see Petsc documentation for format ) Format is (from Petsc ...
SPIVec cosh(const SPIVec &A)
take the cosh of each element in a vector
PetscReal L2(SPIVec x1, const SPIVec x2, NormType type=NORM_2)
calculate the norm of the difference between and vectors.
SPIVec diff(SPIVec x1)
diff of the vector (see numpy.diff)
SPIVec operator^(const PetscScalar p)
pow operation pow(this,p)
SPIVec & operator/=(const PetscScalar a)
SPIVec log(const SPIVec &A)
take the log (natural log) of each element in a vector
SPIVec asinh(const SPIVec &A)
take the asinh of each element in a vector
SPIVec linspace(const PetscScalar begin, const PetscScalar end, const PetscInt rows)
return linspace of number of rows equally spaced points between begin and end
SPIMat _Function_on_each_element(T(*f)(T const &), const SPIMat &A)
take the function of each element in a matrix, e.g. (*f)(A(i,j)) for each i,j
std::string name
Vec name (important for hdf5 i/o)
SPIVec log10(const SPIVec &A)
take the log10 of each element in a vector
PetscInt draw(const SPIMat &A)
draw nonzero structure of matrix
SPIVec imag(const SPIVec &A)
return the imaginary part of the vector
PetscScalar dot(SPIVec x, SPIVec y)
take the inner product of the two vectors (i.e. y^H x) where ^H is the complex conjugate transpose
SPIVec exp(const SPIVec &A)
take the exp of each element in a vector
SPIMat tan(const SPIMat &A)
take the tan of each element in a matrix
PetscInt set(const PetscInt _row, const PetscScalar v)
PetscScalar trapz(const SPIVec y)
trapezoidal integration of y with unity coordinate spacing,
SPIVec operator+(const SPIVec &X)
SPIMat abs(const SPIMat &A)
take the abs of each element in a matrix
SPIVec & operator-=(const SPIVec &X)
PetscScalar integrate_coeffs(const SPIVec &a)
integrate a vector of chebyshev Coefficients on a grid
PetscErrorCode ierr
ierr for various routines and operators
SPIVec operator/(const PetscScalar a)
SPIVec & axpy(const PetscScalar a, const SPIVec &X)
SPIVec atan(const SPIVec &A)
take the atan of each element in a vector
SPIVec sqrt(const SPIVec &A)
take the atanh of each element in a vector
SPIVec erfc(const SPIVec &A)
take the erfc(z) = 1-erf(z) of each element in a vector
PetscInt load(SPIMat &A, const std::string filename)
load matrix from filename from binary format (works with save(SPIMat,std::string) function
SPIVec asin(const SPIVec &A)
take the asin of each element in a vector
SPIVec pow(const SPIVec &A, SPIVec &B)
take the pow of each element in the vectors
SPIVec & operator+=(const SPIVec &X)
SPIVec tanh(const SPIVec &A)
take the tanh of each element in a vector
SPIVec sinh(const SPIVec &A)
take the sinh of each element in a vector
SPIMat acos(const SPIMat &A)
take the arccos of each element in a matrix
PetscInt Init(const PetscInt _rows, const std::string name="SPIVec")
initialize the vector of size _rows
PetscInt rows
number of rows in vec
PetscScalar dot(SPIVec y)
take the inner product of two vectors
SPIMat operator*(const PetscScalar a, const SPIMat A)
a*A operation to be equivalent to A*a
SPIVec & imag()
take the imaginary part of the vector
SPIVec operator+(const PetscScalar a, const SPIVec &A)
SPIMat cos(const SPIMat &A)
take the cos of each element in a matrix
PetscInt add(PetscInt _row, const PetscScalar v)
SPIVec operator/(const SPIVec &b, const SPIMat &A)
Solve linear system, Ax=b using b/A notation.
SPIMat zeros(const PetscInt m, const PetscInt n)
create, form, and return zeros matrix of size mxn