10#ifndef EIGEN_CHOLMODSUPPORT_H
11#define EIGEN_CHOLMODSUPPORT_H
20 template<
typename CholmodType>
28 template<
typename CholmodType>
57template<
typename _Scalar,
int _Options,
typename _StorageIndex>
61 res.nzmax =
mat.nonZeros();
64 res.p =
mat.outerIndexPtr();
65 res.i =
mat.innerIndexPtr();
69 if(
mat.isCompressed())
77 res.nz =
mat.innerNonZeroPtr();
85 res.itype = CHOLMOD_INT;
89 res.itype = CHOLMOD_LONG;
104template<
typename _Scalar,
int _Options,
typename _Index>
111template<
typename _Scalar,
int _Options,
typename _Index>
120template<
typename _Scalar,
int _Options,
typename _Index,
unsigned int UpLo>
136template<
typename Derived>
140 typedef typename Derived::Scalar
Scalar;
146 res.d = Derived::IsVectorAtCompileTime ?
mat.derived().size() :
mat.derived().outerStride();
147 res.x = (
void*)(
mat.derived().data());
157template<
typename Scalar,
int Flags,
typename StorageIndex>
161 (cm.nrow, cm.ncol,
static_cast<StorageIndex*
>(cm.p)[cm.ncol],
162 static_cast<StorageIndex*
>(cm.p),
static_cast<StorageIndex*
>(cm.i),
static_cast<Scalar*
>(cm.x) );
169#define EIGEN_CHOLMOD_SPECIALIZE0(ret, name) \
170 template<typename _StorageIndex> inline ret cm_ ## name (cholmod_common &Common) { return cholmod_ ## name (&Common); } \
171 template<> inline ret cm_ ## name<SuiteSparse_long> (cholmod_common &Common) { return cholmod_l_ ## name (&Common); }
173#define EIGEN_CHOLMOD_SPECIALIZE1(ret, name, t1, a1) \
174 template<typename _StorageIndex> inline ret cm_ ## name (t1& a1, cholmod_common &Common) { return cholmod_ ## name (&a1, &Common); } \
175 template<> inline ret cm_ ## name<SuiteSparse_long> (t1& a1, cholmod_common &Common) { return cholmod_l_ ## name (&a1, &Common); }
192template<
typename _StorageIndex>
193inline int cm_factorize_p (
cholmod_sparse*
A,
double beta[2], _StorageIndex*
fset, std::size_t
fsize,
cholmod_factor*
L,
cholmod_common &
Common) {
return cholmod_factorize_p (
A, beta,
fset,
fsize,
L, &
Common); }
195inline int cm_factorize_p<SuiteSparse_long> (
cholmod_sparse*
A,
double beta[2],
SuiteSparse_long*
fset, std::size_t
fsize,
cholmod_factor*
L,
cholmod_common &
Common) {
return cholmod_l_factorize_p (
A, beta,
fset,
fsize,
L, &
Common); }
197#undef EIGEN_CHOLMOD_SPECIALIZE0
198#undef EIGEN_CHOLMOD_SPECIALIZE1
213template<
typename _MatrixType,
int _UpLo,
typename Derived>
223 typedef typename MatrixType::Scalar
Scalar;
323 #ifndef EIGEN_PARSED_BY_DOXYGEN
325 template<
typename Rhs,
typename Dest>
328 eigen_assert(
m_factorizationIsOk &&
"The decomposition is not in a valid state for solving, you must first call either compute() or symbolic()/numeric()");
350 template<
typename RhsDerived,
typename DestDerived>
353 eigen_assert(
m_factorizationIsOk &&
"The decomposition is not in a valid state for solving, you must first call either compute() or symbolic()/numeric()");
369 dest.
derived() = viewAsEigen<typename DestDerived::Scalar,ColMajor,typename DestDerived::StorageIndex>(*x_cs);
402 eigen_assert(
m_factorizationIsOk &&
"The decomposition is not in a valid state for solving, you must first call either compute() or symbolic()/numeric()");
419 for (
Index k=0; k < nb_super_nodes; ++k)
425 logDet += sk.real().log().sum();
441 template<
typename Stream>
476template<
typename _MatrixType,
int _UpLo = Lower>
498 m_cholmod.final_asis = 0;
499 m_cholmod.supernodal = CHOLMOD_SIMPLICIAL;
500 m_cholmod.final_ll = 1;
527template<
typename _MatrixType,
int _UpLo = Lower>
549 m_cholmod.final_asis = 1;
550 m_cholmod.supernodal = CHOLMOD_SIMPLICIAL;
576template<
typename _MatrixType,
int _UpLo = Lower>
598 m_cholmod.final_asis = 1;
599 m_cholmod.supernodal = CHOLMOD_SUPERNODAL;
627template<
typename _MatrixType,
int _UpLo = Lower>
652 m_cholmod.final_asis = 1;
653 m_cholmod.supernodal = CHOLMOD_AUTO;
656 m_cholmod.final_asis = 0;
657 m_cholmod.supernodal = CHOLMOD_SIMPLICIAL;
658 m_cholmod.final_ll = 1;
661 m_cholmod.final_asis = 1;
662 m_cholmod.supernodal = CHOLMOD_SUPERNODAL;
665 m_cholmod.final_asis = 1;
666 m_cholmod.supernodal = CHOLMOD_SIMPLICIAL;
675 m_cholmod.final_asis = 1;
676 m_cholmod.supernodal = CHOLMOD_AUTO;
EIGEN_DEVICE_FUNC const LogReturnType log() const
Definition ArrayCwiseUnaryOps.h:128
#define EIGEN_CHOLMOD_SPECIALIZE1(ret, name, t1, a1)
Definition CholmodSupport.h:173
#define EIGEN_CHOLMOD_SPECIALIZE0(ret, name)
Definition CholmodSupport.h:169
MatrixXd L
Definition LLT_example.cpp:6
#define EIGEN_UNUSED_VARIABLE(var)
Definition Macros.h:1076
#define eigen_assert(x)
Definition Macros.h:1037
cout<< "Here is the matrix m:"<< endl<< m<< endl;Matrix< ptrdiff_t, 3, 1 > res
Definition PartialRedux_count.cpp:3
#define EIGEN_STATIC_ASSERT(CONDITION, MSG)
Definition StaticAssert.h:127
MatrixXf mat
Definition Tutorial_AdvancedInitialization_CommaTemporary.cpp:1
float * p
Definition Tutorial_Map_using.cpp:9
Scalar * b
Definition benchVecAdd.cpp:17
Scalar Scalar int size
Definition benchVecAdd.cpp:17
SCALAR Scalar
Definition bench_gemm.cpp:46
Matrix< SCALARA, Dynamic, Dynamic, opt_A > A
Definition bench_gemm.cpp:48
Matrix< SCALARB, Dynamic, Dynamic, opt_B > B
Definition bench_gemm.cpp:49
The base class for the direct Cholesky factorization of Cholmod.
Definition CholmodSupport.h:215
cholmod_common & cholmod()
Definition CholmodSupport.h:321
Derived & compute(const MatrixType &matrix)
Definition CholmodSupport.h:273
cholmod_factor * m_cholmodFactor
Definition CholmodSupport.h:447
@ MaxColsAtCompileTime
Definition CholmodSupport.h:229
@ ColsAtCompileTime
Definition CholmodSupport.h:228
cholmod_common m_cholmod
Definition CholmodSupport.h:446
CholmodBase(const MatrixType &matrix)
Definition CholmodSupport.h:242
void dumpMemory(Stream &)
Definition CholmodSupport.h:442
ComputationInfo m_info
Definition CholmodSupport.h:449
int m_factorizationIsOk
Definition CholmodSupport.h:450
double m_shiftOffset[2]
Definition CholmodSupport.h:448
Scalar logDeterminant() const
Definition CholmodSupport.h:398
void analyzePattern(const MatrixType &matrix)
Definition CholmodSupport.h:286
void factorize(const MatrixType &matrix)
Definition CholmodSupport.h:308
MatrixType::RealScalar RealScalar
Definition CholmodSupport.h:224
MatrixType CholMatrixType
Definition CholmodSupport.h:225
StorageIndex rows() const
Definition CholmodSupport.h:259
~CholmodBase()
Definition CholmodSupport.h:251
StorageIndex cols() const
Definition CholmodSupport.h:258
Scalar determinant() const
Definition CholmodSupport.h:391
int m_analysisIsOk
Definition CholmodSupport.h:451
@ UpLo
Definition CholmodSupport.h:222
CholmodBase()
Definition CholmodSupport.h:234
bool m_isInitialized
Definition SparseSolverBase.h:119
Derived & derived()
Definition SparseSolverBase.h:79
MatrixType::StorageIndex StorageIndex
Definition CholmodSupport.h:226
MatrixType::Scalar Scalar
Definition CholmodSupport.h:223
void _solve_impl(const MatrixBase< Rhs > &b, MatrixBase< Dest > &dest) const
Definition CholmodSupport.h:326
void _solve_impl(const SparseMatrixBase< RhsDerived > &b, SparseMatrixBase< DestDerived > &dest) const
Definition CholmodSupport.h:351
ComputationInfo info() const
Reports whether previous computation was successful.
Definition CholmodSupport.h:266
SparseSolverBase< Derived > Base
Definition CholmodSupport.h:217
Derived & setShift(const RealScalar &offset)
Definition CholmodSupport.h:384
_MatrixType MatrixType
Definition CholmodSupport.h:221
A general Cholesky factorization and solver based on Cholmod.
Definition CholmodSupport.h:629
~CholmodDecomposition()
Definition CholmodSupport.h:645
CholmodDecomposition()
Definition CholmodSupport.h:637
void init()
Definition CholmodSupport.h:673
CholmodDecomposition(const MatrixType &matrix)
Definition CholmodSupport.h:639
_MatrixType MatrixType
Definition CholmodSupport.h:635
void setMode(CholmodMode mode)
Definition CholmodSupport.h:647
A simplicial direct Cholesky (LDLT) factorization and solver based on Cholmod.
Definition CholmodSupport.h:529
_MatrixType MatrixType
Definition CholmodSupport.h:535
void init()
Definition CholmodSupport.h:547
CholmodSimplicialLDLT(const MatrixType &matrix)
Definition CholmodSupport.h:539
CholmodSimplicialLDLT()
Definition CholmodSupport.h:537
~CholmodSimplicialLDLT()
Definition CholmodSupport.h:545
A simplicial direct Cholesky (LLT) factorization and solver based on Cholmod.
Definition CholmodSupport.h:478
CholmodSimplicialLLT(const MatrixType &matrix)
Definition CholmodSupport.h:488
void init()
Definition CholmodSupport.h:496
_MatrixType MatrixType
Definition CholmodSupport.h:484
~CholmodSimplicialLLT()
Definition CholmodSupport.h:494
CholmodSimplicialLLT()
Definition CholmodSupport.h:486
A supernodal Cholesky (LLT) factorization and solver based on Cholmod.
Definition CholmodSupport.h:578
void init()
Definition CholmodSupport.h:596
CholmodSupernodalLLT()
Definition CholmodSupport.h:586
_MatrixType MatrixType
Definition CholmodSupport.h:584
~CholmodSupernodalLLT()
Definition CholmodSupport.h:594
CholmodSupernodalLLT(const MatrixType &matrix)
Definition CholmodSupport.h:588
Convenience specialization of Stride to specify only an inner stride See class Map for some examples.
Definition Stride.h:96
A matrix or vector expression mapping an existing array of data.
Definition Map.h:96
Sparse matrix.
Definition MappedSparseMatrix.h:34
Base class for all dense matrices, vectors, and expressions.
Definition MatrixBase.h:50
The matrix class, also used for vectors and row-vectors.
Definition Matrix.h:180
friend class Eigen::Map
Definition PlainObjectBase.h:987
A matrix or vector expression mapping an existing expression.
Definition Ref.h:283
Base class of any sparse matrices or sparse expressions.
Definition SparseMatrixBase.h:28
const Derived & derived() const
Definition SparseMatrixBase.h:143
A versatible sparse matrix representation.
Definition SparseMatrix.h:98
Pseudo expression to manipulate a triangular sparse matrix as a selfadjoint matrix.
Definition SparseSelfAdjointView.h:45
A base class for sparse solvers.
Definition SparseSolverBase.h:68
bool m_isInitialized
Definition SparseSolverBase.h:119
Derived & derived()
Definition SparseSolverBase.h:79
a sparse vector class
Definition SparseVector.h:66
Map< Matrix< T, Dynamic, Dynamic, ColMajor >, 0, OuterStride<> > matrix(T *data, int rows, int cols, int stride)
Definition common.h:110
set noclip points set clip one set noclip two set bar set border lt lw set xdata set ydata set zdata set x2data set y2data set boxwidth set dummy x
Definition gnuplot_common_settings.hh:12
set noclip points set clip one set noclip two set bar set border lt lw set xdata set ydata set zdata set x2data set y2data set boxwidth set dummy y set format x g set format y g set format x2 g set format y2 g set format z g set angles radians set nogrid set key title set key left top Right noreverse box linetype linewidth samplen spacing width set nolabel set noarrow set nologscale set logscale x set set pointsize set encoding default set nopolar set noparametric set set set set surface set nocontour set clabel set mapping cartesian set nohidden3d set cntrparam order set cntrparam linear set cntrparam levels auto set cntrparam points set size set set xzeroaxis lt lw set x2zeroaxis lt lw set yzeroaxis lt lw set y2zeroaxis lt lw set tics in set ticslevel set tics set mxtics default set mytics default set mx2tics default set my2tics default set xtics border mirror norotate autofreq set ytics border mirror norotate autofreq set ztics border nomirror norotate autofreq set nox2tics set noy2tics set timestamp bottom norotate offset
Definition gnuplot_common_settings.hh:64
ComputationInfo
Definition Constants.h:440
@ Lower
Definition Constants.h:209
@ Upper
Definition Constants.h:211
@ NumericalIssue
Definition Constants.h:444
@ Success
Definition Constants.h:442
const unsigned int RowMajorBit
Definition Constants.h:66
#define X
Definition icosphere.cpp:20
RealScalar RealScalar * px
Definition level1_cplx_impl.h:28
cholmod_dense * cm_solve(int sys, cholmod_factor &L, cholmod_dense &B, cholmod_common &Common)
Definition CholmodSupport.h:186
cholmod_sparse * cm_spsolve< SuiteSparse_long >(int sys, cholmod_factor &L, cholmod_sparse &B, cholmod_common &Common)
Definition CholmodSupport.h:190
int cm_factorize_p(cholmod_sparse *A, double beta[2], _StorageIndex *fset, std::size_t fsize, cholmod_factor *L, cholmod_common &Common)
Definition CholmodSupport.h:193
cholmod_dense * cm_solve< SuiteSparse_long >(int sys, cholmod_factor &L, cholmod_dense &B, cholmod_common &Common)
Definition CholmodSupport.h:187
cholmod_sparse * cm_spsolve(int sys, cholmod_factor &L, cholmod_sparse &B, cholmod_common &Common)
Definition CholmodSupport.h:189
int cm_factorize_p< SuiteSparse_long >(cholmod_sparse *A, double beta[2], SuiteSparse_long *fset, std::size_t fsize, cholmod_factor *L, cholmod_common &Common)
Definition CholmodSupport.h:195
Namespace containing all symbols from the Eigen library.
Definition bench_norm.cpp:85
EIGEN_DEFAULT_DENSE_INDEX_TYPE Index
The Index type as used for the API.
Definition Meta.h:74
CholmodMode
Definition CholmodSupport.h:203
@ CholmodSimplicialLLt
Definition CholmodSupport.h:204
@ CholmodAuto
Definition CholmodSupport.h:204
@ CholmodLDLt
Definition CholmodSupport.h:204
@ CholmodSupernodalLLt
Definition CholmodSupport.h:204
cholmod_sparse viewAsCholmod(Ref< SparseMatrix< _Scalar, _Options, _StorageIndex > > mat)
Definition CholmodSupport.h:58
MappedSparseMatrix< Scalar, Flags, StorageIndex > viewAsEigen(cholmod_sparse &cm)
Definition CholmodSupport.h:158
Definition BandTriangularSolver.h:13
Holds information about the various numeric (i.e. scalar) types allowed by Eigen.
Definition NumTraits.h:233
Definition ForwardDeclarations.h:17
Definition datatypes.h:12