STLMatrix

class dolfin.cpp.la.STLMatrix(primary_dim=0)

Bases: dolfin.cpp.la.GenericMatrix

Simple STL-based implementation of the GenericMatrix interface. The sparse matrix is stored as a pair of std::vector of std::vector, one for the columns and one for the values.

Historically, this class has undergone a number of different incarnations, based on various combinations of std::vector, std::set and std::map. The current implementation has proven to be the fastest.

Create empty matrix

block_size()

— STLMatrix interface — Return matrix block size

clear()

Clear matrix. Destroys data and sparse layout

local_nnz()

Return number of local non-zero entries

sort()
thisown

The membership flag

zero()

Overloaded versions

  • zero()

    Set all entries to zero and keep any sparse structure

  • zero(m, rows)

    Set given rows (global row indices) to zero