11 #ifndef SPARSELU_KERNEL_BMOD_H
12 #define SPARSELU_KERNEL_BMOD_H
19 template <
int SegSizeAtCompileTime>
struct LU_kernel_bmod
34 template <
typename BlockScalarVector,
typename ScalarVector,
typename IndexVector>
36 const Index nrow, IndexVector& lsub,
const Index lptr,
const Index no_zeros);
39 template <
int SegSizeAtCompileTime>
40 template <
typename BlockScalarVector,
typename ScalarVector,
typename IndexVector>
41 EIGEN_DONT_INLINE void LU_kernel_bmod<SegSizeAtCompileTime>::run(
const Index segsize, BlockScalarVector& dense, ScalarVector& tempv, ScalarVector& lusup,
Index& luptr,
const Index lda,
42 const Index nrow, IndexVector& lsub,
const Index lptr,
const Index no_zeros)
44 typedef typename ScalarVector::Scalar Scalar;
48 Index isub = lptr + no_zeros;
51 for (
i = 0;
i < ((SegSizeAtCompileTime==
Dynamic)?segsize:SegSizeAtCompileTime);
i++)
54 tempv(
i) = dense(irow);
58 luptr += lda * no_zeros + no_zeros;
60 Map<Matrix<Scalar,SegSizeAtCompileTime,SegSizeAtCompileTime, ColMajor>, 0, OuterStride<> >
A( &(lusup.data()[luptr]), segsize, segsize, OuterStride<>(lda) );
61 Map<Matrix<Scalar,SegSizeAtCompileTime,1> > u(tempv.data(), segsize);
63 u =
A.template triangularView<UnitLower>().solve(u);
69 Map<Matrix<Scalar,Dynamic,SegSizeAtCompileTime, ColMajor>, 0, OuterStride<> >
B( &(lusup.data()[luptr]), nrow, segsize, OuterStride<>(lda) );
72 Map<Matrix<Scalar,Dynamic,1>, 0, OuterStride<> > l(tempv.data()+segsize+aligned_offset+aligned_with_B_offset, nrow, OuterStride<>(ldl) );
77 isub = lptr + no_zeros;
78 for (
i = 0;
i < ((SegSizeAtCompileTime==
Dynamic)?segsize:SegSizeAtCompileTime);
i++)
81 dense(irow) = tempv(
i);
85 for (
i = 0;
i < nrow;
i++)
92 template <>
struct LU_kernel_bmod<1>
94 template <
typename BlockScalarVector,
typename ScalarVector,
typename IndexVector>
100 template <
typename BlockScalarVector,
typename ScalarVector,
typename IndexVector>
101 EIGEN_DONT_INLINE void LU_kernel_bmod<1>::run(
const Index , BlockScalarVector& dense, ScalarVector& , ScalarVector& lusup,
Index& luptr,
104 typedef typename ScalarVector::Scalar Scalar;
105 typedef typename IndexVector::Scalar StorageIndex;
106 Scalar f = dense(lsub(lptr + no_zeros));
107 luptr += lda * no_zeros + no_zeros + 1;
108 const Scalar*
a(lusup.data() + luptr);
109 const StorageIndex* irow(lsub.data()+lptr + no_zeros + 1);
111 for (;
i+1 < nrow;
i+=2)
113 Index i0 = *(irow++);
114 Index i1 = *(irow++);
117 Scalar d0 = dense.coeff(i0);
118 Scalar d1 = dense.coeff(i1);
121 dense.coeffRef(i0) = d0;
122 dense.coeffRef(i1) = d1;
125 dense.coeffRef(*(irow++)) -= f * *(
a++);
#define EIGEN_DONT_INLINE
Index first_multiple(Index size, Index base)
static Index first_default_aligned(const DenseBase< Derived > &m)
EIGEN_DEFAULT_DENSE_INDEX_TYPE Index
The Index type as used for the API.