![]() |
Prev | Next |
# include <cppad/utility/sparse2eigen.hpp>
sparse2eigen(source, destination)
template <class SizeVector, class ValueVector, int Options> void sparse2eigen( const CppAD::sparse_rcv<SizeVector, ValueVector>& source , Eigen::SparseMatrix<typename ValueVector::value_type, Options>& destination )
cppad/utility/sparse2eigen.hpp
is included by cppad/cppad.hpp
.
In any case,
it can also be included separately with out the rest of
the CppAD
routines.
Including this file defines
this version of the sparse2eigen
within the CppAD
namespace.
size_t
.
ValueVector
to denote a
SimpleVector
class with elements of type
value_type
.
Options
to denote either
Eigen::RowMajor
of Eigen::ColMajor
.
source
and
destination
must be the same. We use
value_type
to denote this type.
destination
is in compressed format. For example, let
size_t nnz = source.nnz();
const s_vector& s_value = source.val();
const value_type* d_value = destination.valuePtr();
const s_vector& row_major = source.row_major();
const s_vector& col_major = source.col_major();
It follows that, for
k = 0 , ..., nnz
:
If
Options
is Eigen::RowMajor
,
d_value[k] == s_value[ row_major[k] ]
If
Options
is Eigen::ColMajor
,
d_value[k] == s_value[ col_major[k] ]
sparse2eigen.cpp
It return true if the test passes
and false otherwise.