MCPcopy Create free account
hub / github.com/TinyMPC/TinyMPC / dfs_kernel

Method dfs_kernel

include/Eigen/Eigen/src/SparseLU/SparseLU_panel_dfs.h:64–182  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

62template <typename Scalar, typename StorageIndex>
63template <typename Traits>
64void SparseLUImpl<Scalar,StorageIndex>::dfs_kernel(const StorageIndex jj, IndexVector& perm_r,
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,
68 Index& nextl_col, Index krow, Traits& traits
69 )
70{
71
72 StorageIndex kmark = marker(krow);
73
74 // For each unmarked krow of jj
75 marker(krow) = jj;
76 StorageIndex kperm = perm_r(krow);
77 if (kperm == emptyIdxLU ) {
78 // krow is in L : place it in structure of L(*, jj)
79 panel_lsub(nextl_col++) = StorageIndex(krow); // krow is indexed into A
80
81 traits.mem_expand(panel_lsub, nextl_col, kmark);
82 }
83 else
84 {
85 // krow is in U : if its supernode-representative krep
86 // has been explored, update repfnz(*)
87 // krep = supernode representative of the current row
88 StorageIndex krep = glu.xsup(glu.supno(kperm)+1) - 1;
89 // First nonzero element in the current column:
90 StorageIndex myfnz = repfnz_col(krep);
91
92 if (myfnz != emptyIdxLU )
93 {
94 // Representative visited before
95 if (myfnz > kperm ) repfnz_col(krep) = kperm;
96
97 }
98 else
99 {
100 // Otherwise, perform dfs starting at krep
101 StorageIndex oldrep = emptyIdxLU;
102 parent(krep) = oldrep;
103 repfnz_col(krep) = kperm;
104 StorageIndex xdfs = glu.xlsub(krep);
105 Index maxdfs = xprune(krep);
106
107 StorageIndex kpar;
108 do
109 {
110 // For each unmarked kchild of krep
111 while (xdfs < maxdfs)
112 {
113 StorageIndex kchild = glu.lsub(xdfs);
114 xdfs++;
115 StorageIndex chmark = marker(kchild);
116
117 if (chmark != jj )
118 {
119 marker(kchild) = jj;
120 StorageIndex chperm = perm_r(kchild);
121

Callers

nothing calls this directly

Calls 2

mem_expandMethod · 0.45
update_segrepMethod · 0.45

Tested by

no test coverage detected