EigenMatrix.h¶
Note
The documentation on this page was automatically extracted from the DOLFIN C++ code and may need to be edited or expanded.
-
class
EigenMatrix
¶ Parent class(es)
This class provides a sparse matrix class based on Eigen. It is a simple wrapper for Eigen::SparseMatrix implementing the GenericMatrix interface.
The interface is intentionally simple. For advanced usage, access the underlying Eigen matrix and use the standard Eigen interface which is documented at http://eigen.tuxfamily.org
-
EigenMatrix
()¶ Create empty matrix
-
EigenMatrix
(std::size_t M, std::size_t N)¶ Create M x N matrix
-
EigenMatrix
(const EigenMatrix &A)¶ Copy constructor
-
void
init
(const TensorLayout &tensor_layout)¶ Initialize zero tensor using tenor layout
-
bool
empty
() const¶ Return true if empty
-
std::size_t
size
(std::size_t dim) const¶ Return size of given dimension
-
std::pair<std::size_t, std::size_t>
local_range
(std::size_t dim) const¶ Return local ownership range
-
std::size_t
nnz
() const¶ Return number of non-zero entries in matrix
-
void
zero
()¶ Set all entries to zero and keep any sparse structure
-
void
apply
(std::string mode)¶ Finalize assembly of tensor
-
MPI_Comm
mpi_comm
() const¶ Return MPI communicator
-
std::string
str
(bool verbose) const¶ Return informal string representation (pretty-print)
-
std::shared_ptr<GenericMatrix>
copy
() const¶ Return copy of matrix
-
void
resize
(std::size_t M, std::size_t N)¶ Resize matrix to M x N
-
void
init_vector
(GenericVector &z, std::size_t dim) const¶ Initialise vector z to be compatible with the matrix-vector product y = Ax.
- 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¶ 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)¶ Set block of values using global indices
-
void
set_local
(const double *block, std::size_t m, const dolfin::la_index *rows, std::size_t n, const dolfin::la_index *cols)¶ Set block of values using local indices
-
void
add
(const double *block, std::size_t m, const dolfin::la_index *rows, std::size_t n, const dolfin::la_index *cols)¶ Add block of values using global indices
-
void
add_local
(const double *block, std::size_t m, const dolfin::la_index *rows, std::size_t n, const dolfin::la_index *cols)¶ Add block of values using local indices
-
void
axpy
(double a, const GenericMatrix &A, bool same_nonzero_pattern)¶ Add multiple of given matrix (AXPY operation)
-
double
norm
(std::string norm_type) const¶ Return norm of matrix
-
void
getrow
(std::size_t row, std::vector<std::size_t> &columns, std::vector<double> &values) const¶ Get non-zero values of given row
-
void
setrow
(std::size_t row_idx, const std::vector<std::size_t> &columns, const std::vector<double> &values)¶ Set values for given row
-
void
zero
(std::size_t m, const dolfin::la_index *rows)¶ Set given rows (global row indices) to zero
-
void
zero_local
(std::size_t m, const dolfin::la_index *rows)¶ Set given rows (local row indices) to zero
-
void
ident
(std::size_t m, const dolfin::la_index *rows)¶ Set given rows to identity matrix
-
void
ident_local
(std::size_t m, const dolfin::la_index *rows)¶ Set given rows to identity matrix
-
void
mult
(const GenericVector &x, GenericVector &y) const¶ Matrix-vector product, y = Ax
-
void
transpmult
(const GenericVector &x, GenericVector &y) const¶ Matrix-vector product, y = A^T x
-
void
get_diagonal
(GenericVector &x) const¶ Get diagonal of a matrix
-
void
set_diagonal
(const GenericVector &x)¶ Set diagonal of a matrix
-
const EigenMatrix &
operator*=
(double a)¶ Multiply matrix by given number
-
const EigenMatrix &
operator/=
(double a)¶ Divide matrix by given number
-
const GenericMatrix &
operator=
(const GenericMatrix &A)¶ Assignment operator
-
std::tuple<const int *, const int *, const double *, std::size_t>
data
() const¶ Return pointers to underlying compressed storage data See GenericMatrix for documentation.
-
GenericLinearAlgebraFactory &
factory
() const¶ Return linear algebra backend factory
-
const eigen_matrix_type &
mat
() const¶ Return reference to Eigen matrix (const version)
-
eigen_matrix_type &
mat
()¶ Return reference to Eigen matrix (non-const version)
-
void
compress
()¶ Compress matrix (eliminate all zeros from a sparse matrix)
-
double
operator()
(dolfin::la_index i, dolfin::la_index j) const¶ Access value of given entry
-
const EigenMatrix &
operator=
(const EigenMatrix &A)¶ Assignment operator
-