30 #ifndef SPARSELU_PANEL_DFS_H
31 #define SPARSELU_PANEL_DFS_H
39 template<
typename IndexVector>
40 struct panel_dfs_traits
42 typedef typename IndexVector::Scalar StorageIndex;
43 panel_dfs_traits(
Index jcol, StorageIndex* marker)
44 : m_jcol(jcol), m_marker(marker)
46 bool update_segrep(
Index krep, StorageIndex jj)
48 if(m_marker[krep]<m_jcol)
55 void mem_expand(IndexVector& ,
Index ,
Index ) {}
56 enum { ExpandMem =
false };
58 StorageIndex* m_marker;
62 template <
typename Scalar,
typename StorageIndex>
63 template <
typename Traits>
65 Index& nseg, IndexVector& panel_lsub, IndexVector& segrep,
66 Ref<IndexVector> repfnz_col, IndexVector& xprune, Ref<IndexVector> marker, IndexVector& parent,
67 IndexVector& xplore, GlobalLU_t& glu,
72 StorageIndex kmark = marker(krow);
76 StorageIndex kperm = perm_r(krow);
79 panel_lsub(nextl_col++) = StorageIndex(krow);
81 traits.mem_expand(panel_lsub, nextl_col, kmark);
88 StorageIndex krep = glu.xsup(glu.supno(kperm)+1) - 1;
90 StorageIndex myfnz = repfnz_col(krep);
95 if (myfnz > kperm ) repfnz_col(krep) = kperm;
102 parent(krep) = oldrep;
103 repfnz_col(krep) = kperm;
104 StorageIndex xdfs = glu.xlsub(krep);
105 Index maxdfs = xprune(krep);
111 while (xdfs < maxdfs)
113 StorageIndex kchild = glu.lsub(xdfs);
115 StorageIndex chmark = marker(kchild);
120 StorageIndex chperm = perm_r(kchild);
125 panel_lsub(nextl_col++) = kchild;
126 traits.mem_expand(panel_lsub, nextl_col, chmark);
133 StorageIndex chrep = glu.xsup(glu.supno(chperm)+1) - 1;
134 myfnz = repfnz_col(chrep);
139 repfnz_col(chrep) = chperm;
146 parent(krep) = oldrep;
147 repfnz_col(krep) = chperm;
148 xdfs = glu.xlsub(krep);
149 maxdfs = xprune(krep);
162 if(traits.update_segrep(krep,jj))
175 maxdfs = xprune(krep);
220 template <
typename Scalar,
typename StorageIndex>
221 void SparseLUImpl<Scalar,StorageIndex>::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)
226 VectorBlock<IndexVector> marker1(marker,
m,
m);
229 panel_dfs_traits<IndexVector> traits(jcol, marker1.data());
232 for (StorageIndex jj = StorageIndex(jcol); jj < jcol +
w; jj++)
234 nextl_col = (jj - jcol) *
m;
236 VectorBlock<IndexVector> repfnz_col(repfnz, nextl_col,
m);
237 VectorBlock<ScalarVector> dense_col(dense,nextl_col,
m);
241 for (
typename MatrixType::InnerIterator it(
A, jj); it; ++it)
243 Index krow = it.row();
244 dense_col(krow) = it.value();
246 StorageIndex kmark = marker(krow);
250 dfs_kernel(jj, perm_r, nseg, panel_lsub, segrep, repfnz_col, xprune, marker, parent,
251 xplore, glu, nextl_col, krow, traits);
Matrix< float, 1, Dynamic > MatrixType
EIGEN_DEFAULT_DENSE_INDEX_TYPE Index
The Index type as used for the API.