11 #ifndef EIGEN_INCOMPLETE_LUT_H    12 #define EIGEN_INCOMPLETE_LUT_H    28 template <
typename VectorV, 
typename VectorI>
    31   typedef typename VectorV::RealScalar RealScalar;
    41   if (ncut < first || ncut > last ) 
return 0;
    45     RealScalar abskey = 
abs(
row(mid)); 
    46     for (
Index j = first + 1; j <= last; j++) {
    47       if ( 
abs(
row(j)) > abskey) {
    50         swap(ind(mid), ind(j));
    55     swap(ind(mid), ind(first));
    57     if (mid > ncut) last = mid - 1;
    58     else if (mid < ncut ) first = mid + 1; 
    59   } 
while (mid != ncut );
    98 template <
typename _Scalar, 
typename _StorageIndex = 
int>
   103     using Base::m_isInitialized;
   120       : m_droptol(
NumTraits<Scalar>::dummy_precision()), m_fillfactor(10),
   121         m_analysisIsOk(false), m_factorizationIsOk(false)
   124     template<
typename MatrixType>
   126       : m_droptol(droptol),m_fillfactor(fillfactor),
   127         m_analysisIsOk(false),m_factorizationIsOk(false)
   144       eigen_assert(m_isInitialized && 
"IncompleteLUT is not initialized.");
   148     template<
typename MatrixType>
   149     void analyzePattern(
const MatrixType& amat);
   151     template<
typename MatrixType>
   152     void factorize(
const MatrixType& amat);
   159     template<
typename MatrixType>
   162       analyzePattern(amat); 
   167     void setDroptol(
const RealScalar& droptol); 
   168     void setFillfactor(
int fillfactor); 
   170     template<
typename Rhs, 
typename Dest>
   174       x = m_lu.template triangularView<UnitLower>().solve(x);
   175       x = m_lu.template triangularView<Upper>().solve(x);
   205 template<
typename Scalar, 
typename StorageIndex>
   208   this->m_droptol = droptol;   
   215 template<
typename Scalar, 
typename StorageIndex>
   218   this->m_fillfactor = fillfactor;   
   221 template <
typename Scalar, 
typename StorageIndex>
   222 template<
typename _MatrixType>
   228 #ifndef EIGEN_MPL2_ONLY   237   m_Pinv  = m_P.inverse(); 
   242   ordering(mat1,m_Pinv);
   243   m_P = m_Pinv.inverse();
   246   m_analysisIsOk = 
true;
   247   m_factorizationIsOk = 
false;
   248   m_isInitialized = 
true;
   251 template <
typename Scalar, 
typename StorageIndex>
   252 template<
typename _MatrixType>
   260   eigen_assert((amat.rows() == amat.cols()) && 
"The factorization should be done on a square matrix");
   261   Index n = amat.cols();  
   269   eigen_assert(m_analysisIsOk && 
"You must first call analyzePattern()");
   279   Index fill_in = (amat.nonZeros()*m_fillfactor)/n + 1;
   280   if (fill_in > n) fill_in = n;
   283   Index nnzL = fill_in/2;
   285   m_lu.reserve(n * (nnzL + nnzU + 1));
   288   for (
Index ii = 0; ii < n; ii++)
   294     ju(ii)    = convert_index<StorageIndex>(ii);
   296     jr(ii)    = convert_index<StorageIndex>(ii);
   297     RealScalar rownorm = 0;
   302       Index k = j_it.index();
   306         ju(sizel) = convert_index<StorageIndex>(k);
   307         u(sizel) = j_it.value();
   308         jr(k) = convert_index<StorageIndex>(sizel);
   313         u(ii) = j_it.value();
   318         Index jpos = ii + sizeu;
   319         ju(jpos) = convert_index<StorageIndex>(k);
   320         u(jpos) = j_it.value();
   321         jr(k) = convert_index<StorageIndex>(jpos);
   334     rownorm = 
sqrt(rownorm);
   344       Index minrow = ju.segment(jj,sizel-jj).minCoeff(&k); 
   346       if (minrow != ju(jj))
   351         jr(minrow) = convert_index<StorageIndex>(jj);
   352         jr(j) = convert_index<StorageIndex>(k);
   360       while (ki_it && ki_it.index() < minrow) ++ki_it;
   362       Scalar fact = u(jj) / ki_it.value();
   365       if(
abs(fact) <= m_droptol)
   373       for (; ki_it; ++ki_it)
   375         Scalar prod = fact * ki_it.value();
   376         Index j     = ki_it.index();
   393           ju(newpos) = convert_index<StorageIndex>(j);
   395           jr(j) = convert_index<StorageIndex>(newpos);
   402       ju(len) = convert_index<StorageIndex>(minrow);
   409     for(
Index k = 0; k <sizeu; k++) jr(ju(ii+k)) = -1;
   422     for(
Index k = 0; k < len; k++)
   423       m_lu.insertBackByOuterInnerUnordered(ii,ju(k)) = u(k);
   427     if (u(ii) == Scalar(0))
   428       u(ii) = 
sqrt(m_droptol) * rownorm;
   429     m_lu.insertBackByOuterInnerUnordered(ii, ii) = u(ii);
   434     for(
Index k = 1; k < sizeu; k++)
   436       if(
abs(u(ii+k)) > m_droptol * rownorm )
   439         u(ii + len)  = u(ii + k);
   440         ju(ii + len) = ju(ii + k);
   450     for(
Index k = ii + 1; k < ii + len; k++)
   451       m_lu.insertBackByOuterInnerUnordered(ii,ju(k)) = u(k);
   454   m_lu.makeCompressed();
   456   m_factorizationIsOk = 
true;
   462 #endif // EIGEN_INCOMPLETE_LUT_H ComputationInfo info() const
Reports whether previous computation was successful. 
void setDroptol(const RealScalar &droptol)
IncompleteLUT(const MatrixType &mat, const RealScalar &droptol=NumTraits< Scalar >::dummy_precision(), int fillfactor=10)
VectorBlock< Derived > SegmentReturnType
void factorize(const MatrixType &amat)
EIGEN_DEVICE_FUNC ColXpr col(Index i)
This is the const version of col(). */. 
SparseSolverBase< IncompleteLUT > Base
A base class for sparse solvers. 
EIGEN_DEVICE_FUNC const SqrtReturnType sqrt() const
Holds information about the various numeric (i.e. scalar) types allowed by Eigen. ...
EIGEN_DEVICE_FUNC IndexDest convert_index(const IndexSrc &idx)
PermutationMatrix< Dynamic, Dynamic, StorageIndex > m_Pinv
Matrix< StorageIndex, Dynamic, 1 > VectorI
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const AbsReturnType abs() const
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const Abs2ReturnType abs2() const
PermutationMatrix< Dynamic, Dynamic, StorageIndex > m_P
Index QuickSplit(VectorV &row, VectorI &ind, Index ncut)
TransposeReturnType transpose()
EIGEN_DEFAULT_DENSE_INDEX_TYPE Index
The Index type as used for the API. 
Incomplete LU factorization with dual-threshold strategy. 
Matrix< Scalar, Dynamic, 1 > Vector
Base::InnerIterator InnerIterator
void _solve_impl(const Rhs &b, Dest &x) const
_StorageIndex StorageIndex
SparseMatrix< Scalar, RowMajor, StorageIndex > FactorType
void analyzePattern(const MatrixType &amat)
NumTraits< Scalar >::Real RealScalar
EIGEN_DEVICE_FUNC RowXpr row(Index i)
This is the const version of row(). */. 
SparseSymmetricPermutationProduct< Derived, Upper|Lower > twistedBy(const PermutationMatrix< Dynamic, Dynamic, StorageIndex > &perm) const
IncompleteLUT & compute(const MatrixType &amat)
#define eigen_internal_assert(x)
void swap(scoped_array< T > &a, scoped_array< T > &b)
void setFillfactor(int fillfactor)