GenericMatrix¶
-
class
dolfin.cpp.la.GenericMatrix(*args, **kwargs)¶ Bases:
dolfin.cpp.la.GenericTensor,dolfin.cpp.la.GenericLinearOperatorThis class defines a common interface for matrices.
-
add()¶ Add block of values using global indices.
Parameters: - double * block (const) –
- std::vector< ArrayView< const dolfin::la_index >> & rows (const) –
Return type: void
-
add_local()¶ Add block of values using local indices.
Parameters: - double * block (const) –
- std::vector< ArrayView< const dolfin::la_index >> & rows (const) –
Return type: void
-
array()¶ Return a numpy array representation of Matrix
-
assign()¶ Assignment operator.
Parameters: GenericMatrix & x (const) – Return type: const GenericMatrix &
-
axpy()¶ Add multiple of given matrix (AXPY operation)
Parameters: - a (double) –
- GenericMatrix & A (const) –
- same_nonzero_pattern (bool) –
Return type: void
-
copy()¶ Return copy of matrix.
Return type: std::shared_ptr< GenericMatrix >
-
get()¶ Get block of values.
Parameters: - * block (double) –
- m (std::size_t) –
- dolfin::la_index * rows (const) –
- n (std::size_t) –
- dolfin::la_index * cols (const) –
Return type: void
-
get_diagonal()¶ Get diagonal of a matrix.
Parameters: & x (GenericVector) – Return type: void
-
getrow()¶ Get non-zero values of given row (global index) on local process.
Parameters: - row (std::size_t) –
- std::size_t > & columns (std::vector<) –
- double > & values (std::vector<) –
Return type: void
-
ident()¶ Setgiven rows (global row indices) to identity matrix.Parameters: - m (std::size_t) –
- dolfin::la_index * rows (const) –
Return type: void
-
ident_local()¶ Setgiven rows (local row indices) to identity matrix.Parameters: - m (std::size_t) –
- dolfin::la_index * rows (const) –
Return type: void
-
ident_zeros()¶ Insert one on the diagonal for all zero rows.
Parameters: tol (double) – Return type: void
-
init_vector()¶ Initialize vector z to be compatible with the matrix-vector product y = Ax. In the parallel case, both size and layout are important.
Parameters: - & z (GenericVector) – (
GenericVector&)Vectorto initialise - dim (std::size_t) – (std::size_t) The dimension (axis): dim = 0 –> z = y, dim = 1 –> z = x
Return type: void
- & z (GenericVector) – (
-
nnz()¶ Return number of non-zero entries in matrix (collective)
Return type: std::size_t
-
norm()¶ Return norm of matrix.
Parameters: norm_type (std::string) – Return type: double
-
set()¶ Setblock of values using global indices.Parameters: - double * block (const) –
- m (std::size_t) –
- dolfin::la_index * rows (const) –
- n (std::size_t) –
- dolfin::la_index * cols (const) –
Return type: void
-
set_diagonal()¶ Setdiagonal of a matrix.Parameters: GenericVector & x (const) – Return type: void
-
set_local()¶ Setblock of values using local indices.Parameters: - double * block (const) –
- dolfin::la_index * num_rows (const) –
- dolfin::la_index *const * rows (const) –
Return type: void
-
setrow()¶ Setvalues for given row (global index) on local process.Parameters: - row (std::size_t) –
- std::vector< std::size_t > & columns (const) –
- std::vector< double > & values (const) –
Return type: void
-
thisown¶ The membership flag
-
transpmult()¶ Matrix-vector product, y = A^T x. The y vector must either be zero-sized or have correct size and parallel layout.
Parameters: - GenericVector & x (const) –
- & y (GenericVector) –
Return type: void
-
zero()¶ Setall entries to zero and keep any sparse structure.Return type: void
-
zero_local()¶ Setgiven rows (local row indices) to zero.Parameters: - m (std::size_t) –
- dolfin::la_index * rows (const) –
Return type: void
-