30 #ifndef SPARSELU_COLUMN_DFS_H
31 #define SPARSELU_COLUMN_DFS_H
33 template <
typename Scalar,
typename StorageIndex>
class SparseLUImpl;
38 template<
typename IndexVector,
typename ScalarVector>
41 typedef typename ScalarVector::Scalar Scalar;
42 typedef typename IndexVector::Scalar StorageIndex;
44 : m_jcol(jcol), m_jsuper_ref(jsuper), m_glu(glu), m_luImpl(luImpl)
50 void mem_expand(IndexVector& lsub,
Index& nextl,
Index chmark)
52 if (nextl >= m_glu.nzlmax)
53 m_luImpl.memXpand(lsub, m_glu.nzlmax, nextl, LSUB, m_glu.num_expansions);
54 if (chmark != (m_jcol-1)) m_jsuper_ref = emptyIdxLU;
56 enum { ExpandMem =
true };
92 template <
typename Scalar,
typename StorageIndex>
98 Index jsuper = glu.supno(jcol);
99 Index nextl = glu.xlsub(jcol);
106 for (
Index k = 0; ((k < m) ? lsub_col[k] != emptyIdxLU :
false) ; k++)
108 Index krow = lsub_col(k);
109 lsub_col(k) = emptyIdxLU;
110 Index kmark = marker2(krow);
113 if (kmark == jcol)
continue;
115 dfs_kernel(StorageIndex(jcol), perm_r, nseg, glu.lsub, segrep, repfnz, xprune, marker2, parent,
116 xplore, glu, nextl, krow,
traits);
120 StorageIndex nsuper = glu.supno(jcol);
121 StorageIndex jcolp1 = StorageIndex(jcol) + 1;
122 Index jcolm1 = jcol - 1;
127 nsuper = glu.supno(0) = 0 ;
131 fsupc = glu.xsup(nsuper);
132 StorageIndex jptr = glu.xlsub(jcol);
133 StorageIndex jm1ptr = glu.xlsub(jcolm1);
136 if ( (nextl-jptr != jptr-jm1ptr-1) ) jsuper = emptyIdxLU;
140 if ( (jcol - fsupc) >= maxsuper) jsuper = emptyIdxLU;
147 if (jsuper == emptyIdxLU)
149 if ( (fsupc < jcolm1-1) )
151 StorageIndex ito = glu.xlsub(fsupc+1);
152 glu.xlsub(jcolm1) = ito;
153 StorageIndex istop = ito + jptr - jm1ptr;
154 xprune(jcolm1) = istop;
155 glu.xlsub(jcol) = istop;
157 for (StorageIndex ifrom = jm1ptr; ifrom < nextl; ++ifrom, ++ito)
158 glu.lsub(ito) = glu.lsub(ifrom);
162 glu.supno(jcol) = nsuper;
167 glu.xsup(nsuper+1) = jcolp1;
168 glu.supno(jcolp1) = nsuper;
169 xprune(jcol) = StorageIndex(nextl);
170 glu.xlsub(jcolp1) = StorageIndex(nextl);