10 #ifndef EIGEN_INCOMPLETE_LU_H 11 #define EIGEN_INCOMPLETE_LU_H 15 template <
typename _Scalar>
18 typedef _Scalar Scalar;
20 typedef typename Vector::Index Index;
28 template<
typename MatrixType>
29 IncompleteLU(
const MatrixType& mat) : m_isInitialized(
false)
34 Index rows()
const {
return m_lu.
rows(); }
35 Index cols()
const {
return m_lu.
cols(); }
37 template<
typename MatrixType>
41 int size = mat.cols();
43 for(
int i=0; i<
size; ++i)
45 typename FactorType::InnerIterator k_it(m_lu,i);
46 for(; k_it && k_it.index()<i; ++k_it)
49 k_it.valueRef() /= diag(k);
51 typename FactorType::InnerIterator j_it(k_it);
52 typename FactorType::InnerIterator kj_it(m_lu, k);
53 while(kj_it && kj_it.index()<=k) ++kj_it;
56 if(kj_it.index()==j_it.index())
58 j_it.valueRef() -= k_it.value() * kj_it.value();
62 else if(kj_it.index()<j_it.index()) ++kj_it;
66 if(k_it && k_it.index()==i) diag(i) = k_it.value();
69 m_isInitialized =
true;
73 template<
typename Rhs,
typename Dest>
74 void _solve(
const Rhs& b, Dest& x)
const 76 x = m_lu.template triangularView<UnitLower>().solve(b);
77 x = m_lu.template triangularView<Upper>().solve(x);
83 eigen_assert(m_isInitialized &&
"IncompleteLU is not initialized.");
84 eigen_assert(cols()==b.rows()
85 &&
"IncompleteLU::solve(): invalid number of rows of the right hand side matrix b");
96 template<
typename _MatrixType,
typename Rhs>
101 EIGEN_MAKE_SOLVE_HELPERS(Dec,Rhs)
103 template<
typename Dest>
void evalTo(Dest& dst)
const 105 dec()._solve(rhs(),dst);
113 #endif // EIGEN_INCOMPLETE_LU_H Definition: ForwardDeclarations.h:124
Definition: IncompleteLU.h:16
iterative scaling algorithm to equilibrate rows and column norms in matrices
Definition: TestIMU_Common.h:87
Index cols() const
Definition: SparseMatrix.h:121
detail::size< coerce_list< Ts... >> size
Get the size of a list (number of elements.)
Definition: Size.h:56
Index rows() const
Definition: SparseMatrix.h:119
Definition: BandTriangularSolver.h:13
Definition: ForwardDeclarations.h:125
Base class for all dense matrices, vectors, and expressions.
Definition: MatrixBase.h:48