1 # ifndef CPPAD_UTILITY_SPARSE_RC_HPP
2 # define CPPAD_UTILITY_SPARSE_RC_HPP
211 template <
class SizeVector>
266 void set(
size_t k,
size_t r,
size_t c)
269 "The index k is not less than nnz in sparse_rc::set"
273 "The index r is not less than nr in sparse_rc::set"
277 "The index c is to not less than nc in sparse_rc::set"
284 size_t nr(
void)
const
287 size_t nc(
void)
const
293 const SizeVector&
row(
void)
const
296 const SizeVector&
col(
void)
const
301 for(
size_t k = 0; k <
nnz_; k++)
307 for(
size_t ell = 0; ell + 1 <
nnz_; ell++)
308 {
size_t k = row_major[ ell ];
309 size_t kp = row_major[ ell + 1 ];
312 "sparse_rc: row_major: duplicate entry in this pattern"
324 for(
size_t k = 0; k <
nnz_; k++)
330 for(
size_t ell = 0; ell + 1 <
nnz_; ell++)
331 {
size_t k = col_major[ ell ];
332 size_t kp = col_major[ ell + 1 ];
335 "sparse_rc: col_major: duplicate entry in this pattern"
void operator=(const sparse_rc &pattern)
assignment
size_t nnz_
number of possibly non-zero index pairs
#define CPPAD_ASSERT_KNOWN(exp, msg)
Check that exp is true, if not print msg and terminate execution.
const SizeVector & col(void) const
column indices
sparse_rc(void)
default constructor Eigen vector is ambiguous for row_(0), col_(0) so use default ctor ...
sparse_rc(const sparse_rc &other)
copy constructor
Define the CppAD error checking macros (all of which begin with CPPAD_ASSERT_)
SizeVector col_major(void) const
column-major indices
size_t nc_
number of columns in the sparsity pattern
sparse_rc(size_t nr, size_t nc, size_t nnz)
sizing constructor Eigen vector is ambiguous for row_(0), col_(0) so use default ctor ...
size_t nr_
number of rows in the sparsity pattern
size_t nr(void) const
number of rows in matrix
SizeVector row_
row_[k] is the row index for the k-th possibly non-zero entry
sparsity pattern for a matrix with indices of type size_t
void index_sort(const VectorKey &keys, VectorSize &ind)
Compute the indices that sort a vector of keys.
size_t nnz(void) const
number of possibly non-zero elements in matrix
void resize(size_t nr, size_t nc, size_t nnz)
resize
#define CPPAD_ASSERT_UNKNOWN(exp)
Check that exp is true, if not terminate execution.
File used to implement the CppAD index sort utility.
SizeVector row_major(void) const
row-major order
size_t nc(void) const
number of columns in matrix
void set(size_t k, size_t r, size_t c)
set row and column for a possibly non-zero element
SizeVector col_
col_[k] is the column index for the k-th possibly non-zero entry
const SizeVector & row(void) const
row indices