diff options
Diffstat (limited to 'eigen/Eigen/src/SparseLU/SparseLU_column_dfs.h')
-rw-r--r-- | eigen/Eigen/src/SparseLU/SparseLU_column_dfs.h | 38 |
1 files changed, 20 insertions, 18 deletions
diff --git a/eigen/Eigen/src/SparseLU/SparseLU_column_dfs.h b/eigen/Eigen/src/SparseLU/SparseLU_column_dfs.h index 4c04b0e..c98b30e 100644 --- a/eigen/Eigen/src/SparseLU/SparseLU_column_dfs.h +++ b/eigen/Eigen/src/SparseLU/SparseLU_column_dfs.h @@ -30,7 +30,7 @@ #ifndef SPARSELU_COLUMN_DFS_H #define SPARSELU_COLUMN_DFS_H -template <typename Scalar, typename Index> class SparseLUImpl; +template <typename Scalar, typename StorageIndex> class SparseLUImpl; namespace Eigen { namespace internal { @@ -39,8 +39,8 @@ template<typename IndexVector, typename ScalarVector> struct column_dfs_traits : no_assignment_operator { typedef typename ScalarVector::Scalar Scalar; - typedef typename IndexVector::Scalar Index; - column_dfs_traits(Index jcol, Index& jsuper, typename SparseLUImpl<Scalar, Index>::GlobalLU_t& glu, SparseLUImpl<Scalar, Index>& luImpl) + typedef typename IndexVector::Scalar StorageIndex; + column_dfs_traits(Index jcol, Index& jsuper, typename SparseLUImpl<Scalar, StorageIndex>::GlobalLU_t& glu, SparseLUImpl<Scalar, StorageIndex>& luImpl) : m_jcol(jcol), m_jsuper_ref(jsuper), m_glu(glu), m_luImpl(luImpl) {} bool update_segrep(Index /*krep*/, Index /*jj*/) @@ -57,8 +57,8 @@ struct column_dfs_traits : no_assignment_operator Index m_jcol; Index& m_jsuper_ref; - typename SparseLUImpl<Scalar, Index>::GlobalLU_t& m_glu; - SparseLUImpl<Scalar, Index>& m_luImpl; + typename SparseLUImpl<Scalar, StorageIndex>::GlobalLU_t& m_glu; + SparseLUImpl<Scalar, StorageIndex>& m_luImpl; }; @@ -89,8 +89,10 @@ struct column_dfs_traits : no_assignment_operator * > 0 number of bytes allocated when run out of space * */ -template <typename Scalar, typename Index> -Index SparseLUImpl<Scalar,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) +template <typename Scalar, typename StorageIndex> +Index SparseLUImpl<Scalar,StorageIndex>::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) { Index jsuper = glu.supno(jcol); @@ -110,13 +112,13 @@ Index SparseLUImpl<Scalar,Index>::column_dfs(const Index m, const Index jcol, In // krow was visited before, go to the next nonz; if (kmark == jcol) continue; - dfs_kernel(jcol, perm_r, nseg, glu.lsub, segrep, repfnz, xprune, marker2, parent, + dfs_kernel(StorageIndex(jcol), perm_r, nseg, glu.lsub, segrep, repfnz, xprune, marker2, parent, xplore, glu, nextl, krow, traits); } // for each nonzero ... - Index fsupc, jptr, jm1ptr, ito, ifrom, istop; - Index nsuper = glu.supno(jcol); - Index jcolp1 = jcol + 1; + Index fsupc; + StorageIndex nsuper = glu.supno(jcol); + StorageIndex jcolp1 = StorageIndex(jcol) + 1; Index jcolm1 = jcol - 1; // check to see if j belongs in the same supernode as j-1 @@ -127,8 +129,8 @@ Index SparseLUImpl<Scalar,Index>::column_dfs(const Index m, const Index jcol, In else { fsupc = glu.xsup(nsuper); - jptr = glu.xlsub(jcol); // Not yet compressed - jm1ptr = glu.xlsub(jcolm1); + StorageIndex jptr = glu.xlsub(jcol); // Not yet compressed + StorageIndex jm1ptr = glu.xlsub(jcolm1); // Use supernodes of type T2 : see SuperLU paper if ( (nextl-jptr != jptr-jm1ptr-1) ) jsuper = emptyIdxLU; @@ -146,13 +148,13 @@ Index SparseLUImpl<Scalar,Index>::column_dfs(const Index m, const Index jcol, In { // starts a new supernode if ( (fsupc < jcolm1-1) ) { // >= 3 columns in nsuper - ito = glu.xlsub(fsupc+1); + StorageIndex ito = glu.xlsub(fsupc+1); glu.xlsub(jcolm1) = ito; - istop = ito + jptr - jm1ptr; + StorageIndex istop = ito + jptr - jm1ptr; xprune(jcolm1) = istop; // intialize xprune(jcol-1) glu.xlsub(jcol) = istop; - for (ifrom = jm1ptr; ifrom < nextl; ++ifrom, ++ito) + for (StorageIndex ifrom = jm1ptr; ifrom < nextl; ++ifrom, ++ito) glu.lsub(ito) = glu.lsub(ifrom); nextl = ito; // = istop + length(jcol) } @@ -164,8 +166,8 @@ Index SparseLUImpl<Scalar,Index>::column_dfs(const Index m, const Index jcol, In // Tidy up the pointers before exit glu.xsup(nsuper+1) = jcolp1; glu.supno(jcolp1) = nsuper; - xprune(jcol) = nextl; // Intialize upper bound for pruning - glu.xlsub(jcolp1) = nextl; + xprune(jcol) = StorageIndex(nextl); // Intialize upper bound for pruning + glu.xlsub(jcolp1) = StorageIndex(nextl); return 0; } |