31 #ifndef SPARSELU_PANEL_BMOD_H
32 #define SPARSELU_PANEL_BMOD_H
57 template <
typename Scalar,
typename StorageIndex>
59 const Index nseg, ScalarVector& dense, ScalarVector& tempv,
60 IndexVector& segrep, IndexVector& repfnz, GlobalLU_t& glu)
63 Index ksub,jj,nextl_col;
64 Index fsupc, nsupc, nsupr, nrow;
68 Index segsize,no_zeros ;
73 for (ksub = 0; ksub < nseg; ksub++)
80 krep = segrep(k); k--;
81 fsupc = glu.xsup(glu.supno(krep));
82 nsupc = krep - fsupc + 1;
83 nsupr = glu.xlsub(fsupc+1) - glu.xlsub(fsupc);
85 lptr = glu.xlsub(fsupc);
90 for (jj = jcol; jj < jcol +
w; jj++)
92 nextl_col = (jj-jcol) *
m;
93 VectorBlock<IndexVector> repfnz_col(repfnz, nextl_col,
m);
95 kfnz = repfnz_col(krep);
99 segsize = krep - kfnz + 1;
101 u_rows = (
std::max)(segsize,u_rows);
106 Index ldu = internal::first_multiple<Index>(u_rows, PacketSize);
107 Map<ScalarMatrix, Aligned, OuterStride<> > U(tempv.data(), u_rows, u_cols, OuterStride<>(ldu));
111 for (jj = jcol; jj < jcol +
w; jj++)
113 nextl_col = (jj-jcol) *
m;
114 VectorBlock<IndexVector> repfnz_col(repfnz, nextl_col,
m);
115 VectorBlock<ScalarVector> dense_col(dense, nextl_col,
m);
117 kfnz = repfnz_col(krep);
121 segsize = krep - kfnz + 1;
122 luptr = glu.xlusup(fsupc);
123 no_zeros = kfnz - fsupc;
125 Index isub = lptr + no_zeros;
126 Index off = u_rows-segsize;
127 for (
Index i = 0;
i < off;
i++) U(
i,u_col) = 0;
130 Index irow = glu.lsub(isub);
131 U(
i+off,u_col) = dense_col(irow);
137 luptr = glu.xlusup(fsupc);
138 Index lda = glu.xlusup(fsupc+1) - glu.xlusup(fsupc);
139 no_zeros = (krep - u_rows + 1) - fsupc;
140 luptr += lda * no_zeros + no_zeros;
141 MappedMatrixBlock
A(glu.lusup.data()+luptr, u_rows, u_rows, OuterStride<>(lda) );
142 U =
A.template triangularView<UnitLower>().solve(U);
146 MappedMatrixBlock
B(glu.lusup.data()+luptr, nrow, u_rows, OuterStride<>(lda) );
149 Index ldl = internal::first_multiple<Index>(nrow, PacketSize);
151 MappedMatrixBlock
L(tempv.data()+
w*ldu+offset, nrow, u_cols, OuterStride<>(ldl));
157 for (jj = jcol; jj < jcol +
w; jj++)
159 nextl_col = (jj-jcol) *
m;
160 VectorBlock<IndexVector> repfnz_col(repfnz, nextl_col,
m);
161 VectorBlock<ScalarVector> dense_col(dense, nextl_col,
m);
163 kfnz = repfnz_col(krep);
167 segsize = krep - kfnz + 1;
168 no_zeros = kfnz - fsupc;
169 Index isub = lptr + no_zeros;
171 Index off = u_rows-segsize;
174 Index irow = glu.lsub(isub++);
175 dense_col(irow) = U.coeff(
i+off,u_col);
176 U.coeffRef(
i+off,u_col) = 0;
182 Index irow = glu.lsub(isub++);
183 dense_col(irow) -=
L.coeff(
i,u_col);
184 L.coeffRef(
i,u_col) = 0;
192 for (jj = jcol; jj < jcol +
w; jj++)
194 nextl_col = (jj-jcol) *
m;
195 VectorBlock<IndexVector> repfnz_col(repfnz, nextl_col,
m);
196 VectorBlock<ScalarVector> dense_col(dense, nextl_col,
m);
198 kfnz = repfnz_col(krep);
202 segsize = krep - kfnz + 1;
203 luptr = glu.xlusup(fsupc);
205 Index lda = glu.xlusup(fsupc+1)-glu.xlusup(fsupc);
209 no_zeros = kfnz - fsupc;
210 if(segsize==1) LU_kernel_bmod<1>::run(segsize, dense_col, tempv, glu.lusup, luptr, lda, nrow, glu.lsub, lptr, no_zeros);
211 else if(segsize==2) LU_kernel_bmod<2>::run(segsize, dense_col, tempv, glu.lusup, luptr, lda, nrow, glu.lsub, lptr, no_zeros);
212 else if(segsize==3) LU_kernel_bmod<3>::run(segsize, dense_col, tempv, glu.lusup, luptr, lda, nrow, glu.lsub, lptr, no_zeros);
213 else LU_kernel_bmod<Dynamic>::run(segsize, dense_col, tempv, glu.lusup, luptr, lda, nrow, glu.lsub, lptr, no_zeros);
bfloat16() max(const bfloat16 &a, const bfloat16 &b)
static Index first_default_aligned(const DenseBase< Derived > &m)
EIGEN_DEFAULT_DENSE_INDEX_TYPE Index
The Index type as used for the API.