![]() |
Prev | Next |
# include <cppad/utility/sparse_rc.hpp>
sparse_rc<SizeVector> empty
sparse_rc<SizeVector> pattern(nr, nc, nnz)
target = pattern
resize(nr, nc, nnz)
pattern.set(k, r, c)
pattern.nr()
pattern.nc()
pattern.nnz()
const SizeVector& row( pattern.row() )
const SizeVector& col( pattern.col() )
row_major = pattern.row_major()
col_major = pattern.col_major()
SizeVector
to denote SimpleVector
class
with elements of type
size_t
.
nr
,
number of columns
nc
,
and number of possibly non-zero values
nnz
,
are all zero.
pattern
is const
except during its constructor, resize
, and set
.
sparse_rc<SizeVector> target
After this assignment statement,
target
is an independent copy
of
pattern
; i.e. it has all the same values as
pattern
and changes to
target
do not affect
pattern
.
size_t nr
It specifies the number of rows in the sparsity pattern.
The function call nr()
returns the value of
nr
.
size_t nc
It specifies the number of columns in the sparsity pattern.
The function call nc()
returns the value of
nc
.
size_t nnz
It specifies the number of possibly non-zero
index pairs in the sparsity pattern.
The function call nnz()
returns the value of
nnz
.
row
and
col
vectors should be assigned using set
.
row[k] = r
col[k] = c
size_t k
and must be less than
nnz
.
size_t r
It specifies the value assigned to
row[k]
and must
be less than
nr
.
size_t c
It specifies the value assigned to
col[k]
and must
be less than
nc
.
nnz
and
row[k]
is the row index of the k
-th possibly non-zero
index pair in the sparsity pattern.
nnz
and
col[k]
is the column index of the k
-th possibly non-zero
index pair in the sparsity pattern.
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).