Matrix.h

Note

The documentation on this page was automatically extracted from the DOLFIN C++ code and may need to be edited or expanded.

class Matrix

Parent class(es)

This class provides the default DOLFIN matrix class, based on the default DOLFIN linear algebra backend.

Matrix()

Create empty matrix

Matrix(const Matrix &A)

Copy constructor

Matrix(const GenericMatrix &A)

Create a Vector from a GenericVetor

void init(const TensorLayout &tensor_layout)

Initialize zero tensor using tensor layout

bool empty() const

Return true if matrix is 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

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 init_vector(GenericVector &y, std::size_t dim) const

Resize vector y such that is it compatible with matrix for multuplication Ax = b (dim = 0 -> b, dim = 1 -> x) In parallel case, size and layout are important.

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

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

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, 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 to zero

void ident(std::size_t m, const dolfin::la_index *rows)

Set given rows to identity matrix

void set_diagonal(const GenericVector &x)

Set diagonal of a matrix

const Matrix &operator*=(double a)

Multiply matrix by given number

const Matrix &operator/=(double a)

Divide matrix by given number

const GenericMatrix &operator=(const GenericMatrix &A)

Assignment operator

bool is_symmetric(double tol) const

Test if matrix is symmetric

boost::tuples::tuple<const std::size_t *, const std::size_t *, const double *, int> data() const

Return pointers to underlying compressed storage data. See GenericMatrix for documentation.

GenericLinearAlgebraFactory &factory() const

Return linear algebra backend factory

const GenericMatrix *instance() const

Return concrete instance / unwrap (const version)

GenericMatrix *instance()

Return concrete instance / unwrap (non-const version)

const Matrix &operator=(const Matrix &A)

Assignment operator