Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-04-19 09:06:43

0001 // This file is part of Eigen, a lightweight C++ template library
0002 // for linear algebra.
0003 //
0004 // Copyright (C) 2012 Désiré Nuentsa-Wakam <desire.nuentsa_wakam@inria.fr>
0005 //
0006 // This Source Code Form is subject to the terms of the Mozilla
0007 // Public License v. 2.0. If a copy of the MPL was not distributed
0008 // with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
0009 #ifndef SPARSELU_IMPL_H
0010 #define SPARSELU_IMPL_H
0011 
0012 namespace RivetEigen {
0013 namespace internal {
0014   
0015 /** \ingroup SparseLU_Module
0016   * \class SparseLUImpl
0017   * Base class for sparseLU
0018   */
0019 template <typename Scalar, typename StorageIndex>
0020 class SparseLUImpl
0021 {
0022   public:
0023     typedef Matrix<Scalar,Dynamic,1> ScalarVector;
0024     typedef Matrix<StorageIndex,Dynamic,1> IndexVector; 
0025     typedef Matrix<Scalar,Dynamic,Dynamic,ColMajor> ScalarMatrix;
0026     typedef Map<ScalarMatrix, 0,  OuterStride<> > MappedMatrixBlock;
0027     typedef typename ScalarVector::RealScalar RealScalar; 
0028     typedef Ref<Matrix<Scalar,Dynamic,1> > BlockScalarVector;
0029     typedef Ref<Matrix<StorageIndex,Dynamic,1> > BlockIndexVector;
0030     typedef LU_GlobalLU_t<IndexVector, ScalarVector> GlobalLU_t; 
0031     typedef SparseMatrix<Scalar,ColMajor,StorageIndex> MatrixType; 
0032     
0033   protected:
0034      template <typename VectorType>
0035      Index expand(VectorType& vec, Index& length, Index nbElts, Index keep_prev, Index& num_expansions);
0036      Index memInit(Index m, Index n, Index annz, Index lwork, Index fillratio, Index panel_size,  GlobalLU_t& glu); 
0037      template <typename VectorType>
0038      Index memXpand(VectorType& vec, Index& maxlen, Index nbElts, MemType memtype, Index& num_expansions);
0039      void heap_relax_snode (const Index n, IndexVector& et, const Index relax_columns, IndexVector& descendants, IndexVector& relax_end); 
0040      void relax_snode (const Index n, IndexVector& et, const Index relax_columns, IndexVector& descendants, IndexVector& relax_end); 
0041      Index snode_dfs(const Index jcol, const Index kcol,const MatrixType& mat,  IndexVector& xprune, IndexVector& marker, GlobalLU_t& glu); 
0042      Index snode_bmod (const Index jcol, const Index fsupc, ScalarVector& dense, GlobalLU_t& glu);
0043      Index pivotL(const Index jcol, const RealScalar& diagpivotthresh, IndexVector& perm_r, IndexVector& iperm_c, Index& pivrow, GlobalLU_t& glu);
0044      template <typename Traits>
0045      void dfs_kernel(const StorageIndex jj, IndexVector& perm_r,
0046                     Index& nseg, IndexVector& panel_lsub, IndexVector& segrep,
0047                     Ref<IndexVector> repfnz_col, IndexVector& xprune, Ref<IndexVector> marker, IndexVector& parent,
0048                     IndexVector& xplore, GlobalLU_t& glu, Index& nextl_col, Index krow, Traits& traits);
0049      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);
0050     
0051      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);
0052      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);
0053      Index column_bmod(const Index jcol, const Index nseg, BlockScalarVector dense, ScalarVector& tempv, BlockIndexVector segrep, BlockIndexVector repfnz, Index fpanelc, GlobalLU_t& glu); 
0054      Index copy_to_ucol(const Index jcol, const Index nseg, IndexVector& segrep, BlockIndexVector repfnz ,IndexVector& perm_r, BlockScalarVector dense, GlobalLU_t& glu); 
0055      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);
0056      void countnz(const Index n, Index& nnzL, Index& nnzU, GlobalLU_t& glu); 
0057      void fixupL(const Index n, const IndexVector& perm_r, GlobalLU_t& glu); 
0058      
0059      template<typename , typename >
0060      friend struct column_dfs_traits;
0061 }; 
0062 
0063 } // end namespace internal
0064 } // namespace RivetEigen
0065 
0066 #endif