31#ifndef SPARSELU_PANEL_BMOD_H
32#define SPARSELU_PANEL_BMOD_H
35#include "./InternalHeaderCheck.h"
58template <
typename Scalar,
typename StorageIndex>
59void SparseLUImpl<Scalar, StorageIndex>::panel_bmod(
const Index m,
const Index w,
const Index jcol,
const Index nseg,
60 ScalarVector& dense, ScalarVector& tempv, IndexVector& segrep,
61 IndexVector& repfnz, GlobalLU_t& glu) {
62 Index ksub, jj, nextl_col;
63 Index fsupc, nsupc, nsupr, nrow;
67 Index segsize, no_zeros;
70 const Index PacketSize = internal::packet_traits<Scalar>::size;
72 for (ksub = 0; ksub < nseg; ksub++) {
80 fsupc = glu.xsup(glu.supno(krep));
81 nsupc = krep - fsupc + 1;
82 nsupr = glu.xlsub(fsupc + 1) - glu.xlsub(fsupc);
84 lptr = glu.xlsub(fsupc);
89 for (jj = jcol; jj < jcol + w; jj++) {
90 nextl_col = (jj - jcol) * m;
91 VectorBlock<IndexVector> repfnz_col(repfnz, nextl_col, m);
93 kfnz = repfnz_col(krep);
94 if (kfnz == emptyIdxLU)
continue;
96 segsize = krep - kfnz + 1;
98 u_rows = (std::max)(segsize, u_rows);
102 Index ldu = internal::first_multiple<Index>(u_rows, PacketSize);
103 Map<ScalarMatrix, Aligned, OuterStride<> > U(tempv.data(), u_rows, u_cols, OuterStride<>(ldu));
107 for (jj = jcol; jj < jcol + w; jj++) {
108 nextl_col = (jj - jcol) * m;
109 VectorBlock<IndexVector> repfnz_col(repfnz, nextl_col, m);
110 VectorBlock<ScalarVector> dense_col(dense, nextl_col, m);
112 kfnz = repfnz_col(krep);
113 if (kfnz == emptyIdxLU)
continue;
115 segsize = krep - kfnz + 1;
116 luptr = glu.xlusup(fsupc);
117 no_zeros = kfnz - fsupc;
119 Index isub = lptr + no_zeros;
120 Index off = u_rows - segsize;
121 for (Index i = 0; i < off; i++) U(i, u_col) = 0;
122 for (Index i = 0; i < segsize; i++) {
123 Index irow = glu.lsub(isub);
124 U(i + off, u_col) = dense_col(irow);
130 luptr = glu.xlusup(fsupc);
131 Index lda = glu.xlusup(fsupc + 1) - glu.xlusup(fsupc);
132 no_zeros = (krep - u_rows + 1) - fsupc;
133 luptr += lda * no_zeros + no_zeros;
134 MappedMatrixBlock A(glu.lusup.data() + luptr, u_rows, u_rows, OuterStride<>(lda));
135 U = A.template triangularView<UnitLower>().solve(U);
139 MappedMatrixBlock B(glu.lusup.data() + luptr, nrow, u_rows, OuterStride<>(lda));
140 eigen_assert(tempv.size() > w * ldu + nrow * w + 1);
142 Index ldl = internal::first_multiple<Index>(nrow, PacketSize);
143 Index offset = (PacketSize - internal::first_default_aligned(B.data(), PacketSize)) % PacketSize;
144 MappedMatrixBlock L(tempv.data() + w * ldu + offset, nrow, u_cols, OuterStride<>(ldl));
150 for (jj = jcol; jj < jcol + w; jj++) {
151 nextl_col = (jj - jcol) * m;
152 VectorBlock<IndexVector> repfnz_col(repfnz, nextl_col, m);
153 VectorBlock<ScalarVector> dense_col(dense, nextl_col, m);
155 kfnz = repfnz_col(krep);
156 if (kfnz == emptyIdxLU)
continue;
158 segsize = krep - kfnz + 1;
159 no_zeros = kfnz - fsupc;
160 Index isub = lptr + no_zeros;
162 Index off = u_rows - segsize;
163 for (Index i = 0; i < segsize; i++) {
164 Index irow = glu.lsub(isub++);
165 dense_col(irow) = U.coeff(i + off, u_col);
166 U.coeffRef(i + off, u_col) = 0;
170 for (Index i = 0; i < nrow; i++) {
171 Index irow = glu.lsub(isub++);
172 dense_col(irow) -= L.coeff(i, u_col);
173 L.coeffRef(i, u_col) = 0;
180 for (jj = jcol; jj < jcol + w; jj++) {
181 nextl_col = (jj - jcol) * m;
182 VectorBlock<IndexVector> repfnz_col(repfnz, nextl_col, m);
183 VectorBlock<ScalarVector> dense_col(dense, nextl_col, m);
185 kfnz = repfnz_col(krep);
186 if (kfnz == emptyIdxLU)
continue;
188 segsize = krep - kfnz + 1;
189 luptr = glu.xlusup(fsupc);
191 Index lda = glu.xlusup(fsupc + 1) - glu.xlusup(fsupc);
195 no_zeros = kfnz - fsupc;
197 LU_kernel_bmod<1>::run(segsize, dense_col, tempv, glu.lusup, luptr, lda, nrow, glu.lsub, lptr, no_zeros);
198 else if (segsize == 2)
199 LU_kernel_bmod<2>::run(segsize, dense_col, tempv, glu.lusup, luptr, lda, nrow, glu.lsub, lptr, no_zeros);
200 else if (segsize == 3)
201 LU_kernel_bmod<3>::run(segsize, dense_col, tempv, glu.lusup, luptr, lda, nrow, glu.lsub, lptr, no_zeros);
203 LU_kernel_bmod<Dynamic>::run(segsize, dense_col, tempv, glu.lusup, luptr, lda, nrow, glu.lsub, lptr,
Namespace containing all symbols from the Eigen library.
Definition Core:137