GenericMatrix

class dolfin.cpp.la.GenericMatrix(*args, **kwargs)

Bases: dolfin.cpp.la.GenericTensor, dolfin.cpp.la.GenericLinearOperator

This class defines a common interface for matrices.

add()

Overloaded versions

  • add(block, num_rows, rows)

    Add block of values

  • add(block, rows)

    Add block of values

  • add(block, rows)

    Add block of values

  • add(block, m, rows, n, cols)

    Add block of values

array()

Return a numpy array representation of Matrix

assign()

Assignment operator

axpy()

Add multiple of given matrix (AXPY operation)

compressed()

Build compressed version of matrix (zeros removed)

copy()

Return copy of matrix

data(deepcopy=True)

Return arrays to underlaying compresssed row/column storage data

This method is only available for the uBLAS linear algebra backend.

Arguments
deepcopy
Return a copy of the data. If set to False a reference to the Matrix need to be kept, otherwise the data will be destroyed together with the destruction of the Matrix
get()

Overloaded versions

  • get(block, num_rows, rows)

    Get block of values

  • get(block, m, rows, n, cols)

    Get block of values

getrow()

Get non-zero values of given row on local process

ident()

Set given rows to identity matrix

ident_zeros()

Insert one on the diagonal for all zero rows

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.

Arguments
dim (int)
The dimension (axis): dim = 0 –> z = y, dim = 1 –> z = x
is_symmetric()

Test if matrix is symmetric

norm()

Return norm of matrix

set()

Overloaded versions

  • set(block, num_rows, rows)

    Set block of values

  • set(block, m, rows, n, cols)

    Set block of values

set_diagonal()

Set diagonal of a matrix

setrow()

Set values for given row on local process

sparray()

Return a scipy.sparse representation of Matrix

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.

zero()

Overloaded versions

  • zero()

    Set all entries to zero and keep any sparse structure

  • zero(m, rows)

    Set given rows to zero