31 #ifndef SPARSELU_COLUMN_BMOD_H
32 #define SPARSELU_COLUMN_BMOD_H
54 template <
typename Scalar,
typename StorageIndex>
56 BlockIndexVector segrep, BlockIndexVector repfnz,
Index fpanelc, GlobalLU_t& glu)
58 Index jsupno, k, ksub, krep, ksupno;
59 Index lptr, nrow, isub, irow, nextlu, new_next, ufirst;
60 Index fsupc, nsupc, nsupr, luptr, kfnz, no_zeros;
70 jsupno = glu.supno(jcol);
77 for (ksub = 0; ksub < nseg; ksub++)
79 krep = segrep(k); k--;
80 ksupno = glu.supno(krep);
81 if (jsupno != ksupno )
84 fsupc = glu.xsup(ksupno);
85 fst_col = (
std::max)(fsupc, fpanelc);
89 d_fsupc = fst_col - fsupc;
91 luptr = glu.xlusup(fst_col) + d_fsupc;
92 lptr = glu.xlsub(fsupc) + d_fsupc;
97 segsize = krep - kfnz + 1;
98 nsupc = krep - fst_col + 1;
99 nsupr = glu.xlsub(fsupc+1) - glu.xlsub(fsupc);
100 nrow = nsupr - d_fsupc - nsupc;
101 Index lda = glu.xlusup(fst_col+1) - glu.xlusup(fst_col);
106 no_zeros = kfnz - fst_col;
108 LU_kernel_bmod<1>::run(segsize, dense, tempv, glu.lusup, luptr, lda, nrow, glu.lsub, lptr, no_zeros);
110 LU_kernel_bmod<Dynamic>::run(segsize, dense, tempv, glu.lusup, luptr, lda, nrow, glu.lsub, lptr, no_zeros);
115 nextlu = glu.xlusup(jcol);
116 fsupc = glu.xsup(jsupno);
120 new_next = nextlu + glu.xlsub(fsupc + 1) - glu.xlsub(fsupc);
124 while (new_next > glu.nzlumax )
126 mem = memXpand<ScalarVector>(glu.lusup, glu.nzlumax, nextlu,
LUSUP, glu.num_expansions);
130 for (isub = glu.xlsub(fsupc); isub < glu.xlsub(fsupc+1); isub++)
132 irow = glu.lsub(isub);
133 glu.lusup(nextlu) = dense(irow);
134 dense(irow) = Scalar(0.0);
140 glu.lusup.segment(nextlu,offset).setZero();
143 glu.xlusup(jcol + 1) = StorageIndex(nextlu);
151 fst_col = (
std::max)(fsupc, fpanelc);
157 d_fsupc = fst_col - fsupc;
159 lptr = glu.xlsub(fsupc) + d_fsupc;
160 luptr = glu.xlusup(fst_col) + d_fsupc;
161 nsupr = glu.xlsub(fsupc+1) - glu.xlsub(fsupc);
162 nsupc = jcol - fst_col;
163 nrow = nsupr - d_fsupc - nsupc;
166 ufirst = glu.xlusup(jcol) + d_fsupc;
167 Index lda = glu.xlusup(jcol+1) - glu.xlusup(jcol);
168 MappedMatrixBlock
A( &(glu.lusup.data()[luptr]), nsupc, nsupc, OuterStride<>(lda) );
169 VectorBlock<ScalarVector> u(glu.lusup, ufirst, nsupc);
170 u =
A.template triangularView<UnitLower>().solve(u);
172 new (&
A) MappedMatrixBlock ( &(glu.lusup.data()[luptr+nsupc]), nrow, nsupc, OuterStride<>(lda) );
173 VectorBlock<ScalarVector> l(glu.lusup, ufirst+nsupc, nrow);
174 l.noalias() -=
A * u;
bfloat16() max(const bfloat16 &a, const bfloat16 &b)
EIGEN_DEFAULT_DENSE_INDEX_TYPE Index
The Index type as used for the API.