Prev | Next |
# include <cppad/utility/sparse_rcv.hpp>
sparse_rcv<SizeVector, ValueVector> empty
sparse_rcv<SizeVector, ValueVector> matrix(pattern)
matrix = other
matrix.swap( other )
matrix.set(k, v)
nr = matrix.nr()
nc = matrix.nc()
nnz = matrix.nnz()
const SizeVector& row( matrix.row() )
const SizeVector& col( matrix.col() )
const ValueVector& val( matrix.val() )
const sparse_rc<SizeVector>& pat( matrix.pat() )
row_major = matrix.row_major()
col_major = matrix.col_major()
pattern
.
ValueVector
to denote the
SimpleVector
class corresponding to
val
.
nr
,
number of columns
nc
,
and number of possibly non-zero values
nnz
,
are all zero.
const sparse_rc<SizeVector>& pattern
It specifies the number of rows, number of columns and
the possibly non-zero entries in the
matrix
.
pattern
.
Only the
val
vector can be changed. All other values returned by
matrix
are fixed during the constructor and constant there after.
The
val
vector is only changed by the constructor
and the set
function.
There are two exceptions to this rule, where
other
appears in the
assignment and swap syntax.
other
has prototype
const sparse_rcv<SizeVector, ValueVector>& other
After this assignment and constructor,
other
is an independent copy
of
matrix
; i.e. it has all the same values as
matrix
and changes to
matrix
do not affect
other
.
other
has prototype
sparse_rcv<SizeVector, ValueVector>&& other
A move semantics version of the assignment operator is used; e.g.,
when
other
is a function return value;
other
(
matrix
) is equivalent
to
matrix
(
other
) before the operation.
size_t nr
and is the number of rows in
matrix
.
size_t nc
and is the number of columns in
matrix
.
nnz
to denote the number of
possibly non-zero entries in
matrix
.
val[k] = v
size_t k
and must be less than
nnz
.
const ValueVector::value_type& v
It specifies the value assigned to
val[k]
.
nnz
and
row[k]
is the row index of the k
-th possibly non-zero
element in
matrix
.
nnz
and
col[k]
is the column index of the k
-th possibly non-zero
element in
matrix
nnz
and
val[k]
is value of the k
-th possibly non-zero entry
in the sparse matrix (the value may be zero).
pattern
in the constructor.
SizeVector row_major
and its size
nnz
.
It sorts the sparsity pattern in row-major order.
To be specific,
col[ row_major[k] ] <= col[ row_major[k+1] ]
and if
col[ row_major[k] ] == col[ row_major[k+1] ]
,
row[ row_major[k] ] < row[ row_major[k+1] ]
This routine generates an assert if there are two entries with the same
row and column values (if NDEBUG
is not defined).
SizeVector col_major
and its size
nnz
.
It sorts the sparsity pattern in column-major order.
To be specific,
row[ col_major[k] ] <= row[ col_major[k+1] ]
and if
row[ col_major[k] ] == row[ col_major[k+1] ]
,
col[ col_major[k] ] < col[ col_major[k+1] ]
This routine generates an assert if there are two entries with the same
row and column values (if NDEBUG
is not defined).