GenericMatrix.h¶
Note
The documentation on this page was automatically extracted from the DOLFIN C++ code and may need to be edited or expanded.
-
class
GenericMatrix
¶ Parent class(es)
This class defines a common interface for matrices.
-
std::size_t
rank
() const¶ Return tensor rank (number of dimensions)
-
std::size_t
size
(std::size_t dim) const = 0¶ Return size of given dimension
-
std::pair<std::size_t, std::size_t>
local_range
(std::size_t dim) const = 0¶ Return local ownership range
-
void
get
(double *block, const dolfin::la_index *num_rows, const dolfin::la_index *const *rows) const¶ Get block of values
-
void
set
(const double *block, const dolfin::la_index *num_rows, const dolfin::la_index *const *rows)¶ Set block of values
-
void
add
(const double *block, const dolfin::la_index *num_rows, const dolfin::la_index *const *rows)¶ Add block of values
-
void
add
(const double *block, const std::vector<const std::vector<dolfin::la_index> *> &rows)¶ Add block of values
-
void
add
(const double *block, const std::vector<std::vector<dolfin::la_index>> &rows)¶ Add block of values
-
void
zero
() = 0¶ Set all entries to zero and keep any sparse structure
-
void
apply
(std::string mode) = 0¶ Finalize assembly of tensor
-
std::string
str
(bool verbose) const = 0¶ Return informal string representation (pretty-print)
-
boost::shared_ptr<GenericMatrix>
copy
() const = 0¶ Return copy of matrix
-
void
resize
(GenericVector &z, std::size_t dim) const = 0¶ Resize vector z to be compatible with the matrix-vector product y = Ax. In the parallel case, both size and layout are important.
- Arguments
- dim (std::size_t)
- The dimension (axis): dim = 0 –> z = y, dim = 1 –> z = x
-
void
get
(double *block, std::size_t m, const dolfin::la_index *rows, std::size_t n, const dolfin::la_index *cols) const = 0¶ Get block of values
-
void
set
(const double *block, std::size_t m, const dolfin::la_index *rows, std::size_t n, const dolfin::la_index *cols) = 0¶ Set block of values
-
void
add
(const double *block, std::size_t m, const dolfin::la_index *rows, std::size_t n, const dolfin::la_index *cols) = 0¶ Add block of values
-
void
axpy
(double a, const GenericMatrix &A, bool same_nonzero_pattern) = 0¶ Add multiple of given matrix (AXPY operation)
-
double
norm
(std::string norm_type) const = 0¶ Return norm of matrix
-
void
getrow
(std::size_t row, std::vector<std::size_t> &columns, std::vector<double> &values) const = 0¶ Get non-zero values of given row on local process
-
void
setrow
(std::size_t row, const std::vector<std::size_t> &columns, const std::vector<double> &values) = 0¶ Set values for given row on local process
-
void
zero
(std::size_t m, const dolfin::la_index *rows) = 0¶ Set given rows to zero
-
void
ident
(std::size_t m, const dolfin::la_index *rows) = 0¶ Set given rows to identity matrix
-
void
transpmult
(const GenericVector &x, GenericVector &y) const = 0¶ Matrix-vector product, y = A^T x. The y vector must either be zero-sized or have correct size and parallel layout.
-
const GenericMatrix &
operator*=
(double a) = 0¶ Multiply matrix by given number
-
const GenericMatrix &
operator/=
(double a) = 0¶ Divide matrix by given number
-
const GenericMatrix &
operator+=
(const GenericMatrix &A)¶ Add given matrix
-
const GenericMatrix &
operator-=
(const GenericMatrix &A)¶ Subtract given matrix
-
bool
is_symmetric
(double tol) const¶ Test if matrix is symmetric
-
const GenericMatrix &
operator=
(const GenericMatrix &x) = 0¶ Assignment operator
-
boost::tuples::tuple<const std::size_t *, const std::size_t *, const double *, int>
data
() const¶ Return pointers to underlying compresssed row/column storage data For compressed row storage, data = (row_pointer[#rows +1], column_index[#nz], matrix_values[#nz], nz)
-
double
operator()
(dolfin::la_index i, dolfin::la_index j) const¶ Get value of given entry
-
double
getitem
(std::pair<dolfin::la_index, dolfin::la_index> ij) const¶ Get value of given entry
-
void
setitem
(std::pair<dolfin::la_index, dolfin::la_index> ij, double value)¶ Set given entry to value. apply(“insert”) should be called before using using the object.
-
void
ident_zeros
()¶ Insert one on the diagonal for all zero rows
-
void
compress
()¶ Compress matrix
-
std::size_t