30 #ifndef SPARSELU_COLUMN_DFS_H
31 #define SPARSELU_COLUMN_DFS_H
33 template <
typename Scalar,
typename StorageIndex>
class SparseLUImpl;
40 template<
typename IndexVector,
typename ScalarVector>
41 struct column_dfs_traits : no_assignment_operator
43 typedef typename ScalarVector::Scalar Scalar;
44 typedef typename IndexVector::Scalar StorageIndex;
46 : m_jcol(jcol), m_jsuper_ref(jsuper), m_glu(glu), m_luImpl(luImpl)
52 void mem_expand(IndexVector& lsub,
Index& nextl,
Index chmark)
54 if (nextl >= m_glu.nzlmax)
55 m_luImpl.memXpand(lsub, m_glu.nzlmax, nextl,
LSUB, m_glu.num_expansions);
56 if (chmark != (m_jcol-1)) m_jsuper_ref =
emptyIdxLU;
58 enum { ExpandMem =
true };
94 template <
typename Scalar,
typename StorageIndex>
96 BlockIndexVector lsub_col, IndexVector& segrep, BlockIndexVector repfnz, IndexVector& xprune,
97 IndexVector& marker, IndexVector& parent, IndexVector& xplore, GlobalLU_t& glu)
100 Index jsuper = glu.supno(jcol);
101 Index nextl = glu.xlsub(jcol);
102 VectorBlock<IndexVector> marker2(marker, 2*
m,
m);
105 column_dfs_traits<IndexVector, ScalarVector> traits(jcol, jsuper, glu, *
this);
110 Index krow = lsub_col(k);
112 Index kmark = marker2(krow);
115 if (kmark == jcol)
continue;
117 dfs_kernel(StorageIndex(jcol), perm_r, nseg, glu.lsub, segrep, repfnz, xprune, marker2, parent,
118 xplore, glu, nextl, krow, traits);
122 StorageIndex nsuper = glu.supno(jcol);
123 StorageIndex jcolp1 = StorageIndex(jcol) + 1;
124 Index jcolm1 = jcol - 1;
129 nsuper = glu.supno(0) = 0 ;
133 fsupc = glu.xsup(nsuper);
134 StorageIndex jptr = glu.xlsub(jcol);
135 StorageIndex jm1ptr = glu.xlsub(jcolm1);
138 if ( (nextl-jptr != jptr-jm1ptr-1) ) jsuper =
emptyIdxLU;
142 if ( (jcol - fsupc) >= maxsuper) jsuper =
emptyIdxLU;
151 if ( (fsupc < jcolm1-1) )
153 StorageIndex ito = glu.xlsub(fsupc+1);
154 glu.xlsub(jcolm1) = ito;
155 StorageIndex istop = ito + jptr - jm1ptr;
156 xprune(jcolm1) = istop;
157 glu.xlsub(jcol) = istop;
159 for (StorageIndex ifrom = jm1ptr; ifrom < nextl; ++ifrom, ++ito)
160 glu.lsub(ito) = glu.lsub(ifrom);
164 glu.supno(jcol) = nsuper;
169 glu.xsup(nsuper+1) = jcolp1;
170 glu.supno(jcolp1) = nsuper;
171 xprune(jcol) = StorageIndex(nextl);
172 glu.xlsub(jcolp1) = StorageIndex(nextl);
EIGEN_DEFAULT_DENSE_INDEX_TYPE Index
The Index type as used for the API.