00001
00002
00003
00004
00005
00006
00007
00008
00009 #ifndef SPARSELU_IMPL_H
00010 #define SPARSELU_IMPL_H
00011
00012 namespace Eigen {
00013 namespace internal {
00014
00019 template <typename Scalar, typename Index>
00020 class SparseLUImpl
00021 {
00022 public:
00023 typedef Matrix<Scalar,Dynamic,1> ScalarVector;
00024 typedef Matrix<Index,Dynamic,1> IndexVector;
00025 typedef typename ScalarVector::RealScalar RealScalar;
00026 typedef Ref<Matrix<Scalar,Dynamic,1> > BlockScalarVector;
00027 typedef Ref<Matrix<Index,Dynamic,1> > BlockIndexVector;
00028 typedef LU_GlobalLU_t<IndexVector, ScalarVector> GlobalLU_t;
00029 typedef SparseMatrix<Scalar,ColMajor,Index> MatrixType;
00030
00031 protected:
00032 template <typename VectorType>
00033 Index expand(VectorType& vec, Index& length, Index nbElts, Index keep_prev, Index& num_expansions);
00034 Index memInit(Index m, Index n, Index annz, Index lwork, Index fillratio, Index panel_size, GlobalLU_t& glu);
00035 template <typename VectorType>
00036 Index memXpand(VectorType& vec, Index& maxlen, Index nbElts, MemType memtype, Index& num_expansions);
00037 void heap_relax_snode (const Index n, IndexVector& et, const Index relax_columns, IndexVector& descendants, IndexVector& relax_end);
00038 void relax_snode (const Index n, IndexVector& et, const Index relax_columns, IndexVector& descendants, IndexVector& relax_end);
00039 Index snode_dfs(const Index jcol, const Index kcol,const MatrixType& mat, IndexVector& xprune, IndexVector& marker, GlobalLU_t& glu);
00040 Index snode_bmod (const Index jcol, const Index fsupc, ScalarVector& dense, GlobalLU_t& glu);
00041 Index pivotL(const Index jcol, const RealScalar& diagpivotthresh, IndexVector& perm_r, IndexVector& iperm_c, Index& pivrow, GlobalLU_t& glu);
00042 template <typename Traits>
00043 void dfs_kernel(const Index jj, IndexVector& perm_r,
00044 Index& nseg, IndexVector& panel_lsub, IndexVector& segrep,
00045 Ref<IndexVector> repfnz_col, IndexVector& xprune, Ref<IndexVector> marker, IndexVector& parent,
00046 IndexVector& xplore, GlobalLU_t& glu, Index& nextl_col, Index krow, Traits& traits);
00047 void panel_dfs(const Index m, const Index w, const Index jcol, MatrixType& A, IndexVector& perm_r, Index& nseg, ScalarVector& dense, IndexVector& panel_lsub, IndexVector& segrep, IndexVector& repfnz, IndexVector& xprune, IndexVector& marker, IndexVector& parent, IndexVector& xplore, GlobalLU_t& glu);
00048
00049 void panel_bmod(const Index m, const Index w, const Index jcol, const Index nseg, ScalarVector& dense, ScalarVector& tempv, IndexVector& segrep, IndexVector& repfnz, GlobalLU_t& glu);
00050 Index column_dfs(const Index m, const Index jcol, IndexVector& perm_r, Index maxsuper, Index& nseg, BlockIndexVector lsub_col, IndexVector& segrep, BlockIndexVector repfnz, IndexVector& xprune, IndexVector& marker, IndexVector& parent, IndexVector& xplore, GlobalLU_t& glu);
00051 Index column_bmod(const Index jcol, const Index nseg, BlockScalarVector dense, ScalarVector& tempv, BlockIndexVector segrep, BlockIndexVector repfnz, Index fpanelc, GlobalLU_t& glu);
00052 Index copy_to_ucol(const Index jcol, const Index nseg, IndexVector& segrep, BlockIndexVector repfnz ,IndexVector& perm_r, BlockScalarVector dense, GlobalLU_t& glu);
00053 void pruneL(const Index jcol, const IndexVector& perm_r, const Index pivrow, const Index nseg, const IndexVector& segrep, BlockIndexVector repfnz, IndexVector& xprune, GlobalLU_t& glu);
00054 void countnz(const Index n, Index& nnzL, Index& nnzU, GlobalLU_t& glu);
00055 void fixupL(const Index n, const IndexVector& perm_r, GlobalLU_t& glu);
00056
00057 template<typename , typename >
00058 friend struct column_dfs_traits;
00059 };
00060
00061 }
00062 }
00063
00064 #endif