Public Types | |
typedef MappedSparseMatrix < Scalar, Flags > | Map |
Public Member Functions | |
const std::vector < CompressedStorage< Scalar > > & | _data () const |
std::vector< CompressedStorage < Scalar > > & | _data () |
Scalar | coeff (int row, int col) const |
Scalar & | coeffRef (int row, int col) |
int | cols () const |
DynamicSparseMatrix (const DynamicSparseMatrix &other) | |
template<typename OtherDerived > | |
DynamicSparseMatrix (const SparseMatrixBase< OtherDerived > &other) | |
DynamicSparseMatrix (int rows, int cols) | |
void | endFill () |
Scalar & | fill (int row, int col) |
Scalar & | fillrand (int row, int col) |
int | innerNonZeros (int j) const |
int | innerSize () const |
int | nonZeros () const |
template<typename OtherDerived > | |
DynamicSparseMatrix & | operator= (const SparseMatrixBase< OtherDerived > &other) |
DynamicSparseMatrix & | operator= (const DynamicSparseMatrix &other) |
int | outerSize () const |
void | prune (Scalar reference, RealScalar epsilon=precision< RealScalar >()) |
void | resize (int rows, int cols) |
void | resizeAndKeepData (int rows, int cols) |
int | rows () const |
void | setZero () |
void | startFill (int reserveSize=1000) |
void | swap (DynamicSparseMatrix &other) |
~DynamicSparseMatrix () | |
Protected Types | |
enum | { IsRowMajor } |
typedef DynamicSparseMatrix < Scalar,(Flags &~RowMajorBit)|(IsRowMajor?RowMajorBit:0)> | TransposedSparseMatrix |
Protected Attributes | |
std::vector< CompressedStorage < Scalar > > | m_data |
int | m_innerSize |
_Scalar | the scalar type, i.e. the type of the coefficients |
rho
is the probability that a coefficient is nonzero and outer_size is the number of columns if the matrix is column-major and the number of rows otherwise.Internally, the data are stored as a std::vector of compressed vector. The performances of random writes might decrease as the number of nonzeros per inner-vector increase. In practice, we observed very good performance till about 100 nonzeros/vector, and the performance remains relatively good till 500 nonzeros/vectors.
~DynamicSparseMatrix | ( | ) | [inline] |
Destructor
Scalar coeff | ( | int | row, | |
int | col | |||
) | const [inline] |
Scalar& coeffRef | ( | int | row, | |
int | col | |||
) | [inline] |
void endFill | ( | ) | [inline] |
Does nothing. Provided for compatibility with SparseMatrix.
Scalar& fill | ( | int | row, | |
int | col | |||
) | [inline] |
inserts a nonzero coefficient at given coordinates row, col and returns its reference assuming that: 1 - the coefficient does not exist yet 2 - this the coefficient with greater inner coordinate for the given outer coordinate. In other words, assuming *this
is column-major, then there must not exists any nonzero coefficient of coordinates i
x
col such that i
>= row. Otherwise the matrix is invalid.
Scalar& fillrand | ( | int | row, | |
int | col | |||
) | [inline] |
Like fill() but with random inner coordinates. Compared to the generic coeffRef(), the unique limitation is that we assume the coefficient does not exist yet.
int nonZeros | ( | ) | const [inline] |
void resize | ( | int | rows, | |
int | cols | |||
) | [inline] |
Resize the matrix without preserving the data (the matrix is set to zero)
void startFill | ( | int | reserveSize = 1000 |
) | [inline] |
Set the matrix to zero and reserve the memory for reserveSize nonzero coefficients.