11#ifndef SPARSELU_KERNEL_BMOD_H
12#define SPARSELU_KERNEL_BMOD_H
17template <
int SegSizeAtCompileTime>
struct LU_kernel_bmod
32 template <
typename BlockScalarVector,
typename ScalarVector,
typename IndexVector>
33 static EIGEN_DONT_INLINE
void run(
const Index segsize, BlockScalarVector& dense, ScalarVector& tempv, ScalarVector& lusup,
Index& luptr,
const Index lda,
34 const Index nrow, IndexVector& lsub,
const Index lptr,
const Index no_zeros);
37template <
int SegSizeAtCompileTime>
38template <
typename BlockScalarVector,
typename ScalarVector,
typename IndexVector>
39EIGEN_DONT_INLINE
void LU_kernel_bmod<SegSizeAtCompileTime>::run(
const Index segsize, BlockScalarVector& dense, ScalarVector& tempv, ScalarVector& lusup,
Index& luptr,
const Index lda,
40 const Index nrow, IndexVector& lsub,
const Index lptr,
const Index no_zeros)
42 typedef typename ScalarVector::Scalar Scalar;
46 Index isub = lptr + no_zeros;
49 for (i = 0; i < ((SegSizeAtCompileTime==
Dynamic)?segsize:SegSizeAtCompileTime); i++)
52 tempv(i) = dense(irow);
56 luptr += lda * no_zeros + no_zeros;
58 Map<Matrix<Scalar,SegSizeAtCompileTime,SegSizeAtCompileTime, ColMajor>, 0, OuterStride<> > A( &(lusup.data()[luptr]), segsize, segsize, OuterStride<>(lda) );
59 Map<Matrix<Scalar,SegSizeAtCompileTime,1> > u(tempv.data(), segsize);
61 u = A.template triangularView<UnitLower>().solve(u);
65 const Index PacketSize = internal::packet_traits<Scalar>::size;
66 Index ldl = internal::first_multiple(nrow, PacketSize);
67 Map<Matrix<Scalar,Dynamic,SegSizeAtCompileTime, ColMajor>, 0, OuterStride<> > B( &(lusup.data()[luptr]), nrow, segsize, OuterStride<>(lda) );
68 Index aligned_offset = internal::first_default_aligned(tempv.data()+segsize, PacketSize);
69 Index aligned_with_B_offset = (PacketSize-internal::first_default_aligned(B.data(), PacketSize))%PacketSize;
70 Map<Matrix<Scalar,Dynamic,1>, 0, OuterStride<> > l(tempv.data()+segsize+aligned_offset+aligned_with_B_offset, nrow, OuterStride<>(ldl) );
75 isub = lptr + no_zeros;
76 for (i = 0; i < ((SegSizeAtCompileTime==
Dynamic)?segsize:SegSizeAtCompileTime); i++)
79 dense(irow) = tempv(i);
83 for (i = 0; i < nrow; i++)
90template <>
struct LU_kernel_bmod<1>
92 template <
typename BlockScalarVector,
typename ScalarVector,
typename IndexVector>
93 static EIGEN_DONT_INLINE
void run(
const Index , BlockScalarVector& dense, ScalarVector& , ScalarVector& lusup,
Index& luptr,
98template <
typename BlockScalarVector,
typename ScalarVector,
typename IndexVector>
99EIGEN_DONT_INLINE
void LU_kernel_bmod<1>::run(
const Index , BlockScalarVector& dense, ScalarVector& , ScalarVector& lusup,
Index& luptr,
102 typedef typename ScalarVector::Scalar Scalar;
103 typedef typename IndexVector::Scalar StorageIndex;
104 Scalar f = dense(lsub(lptr + no_zeros));
105 luptr += lda * no_zeros + no_zeros + 1;
106 const Scalar* a(lusup.data() + luptr);
107 const StorageIndex* irow(lsub.data()+lptr + no_zeros + 1);
109 for (; i+1 < nrow; i+=2)
111 Index i0 = *(irow++);
112 Index i1 = *(irow++);
115 Scalar d0 = dense.coeff(i0);
116 Scalar d1 = dense.coeff(i1);
119 dense.coeffRef(i0) = d0;
120 dense.coeffRef(i1) = d1;
123 dense.coeffRef(*(irow++)) -= f * *(a++);
Namespace containing all symbols from the Eigen library.
Definition B01_Experimental.dox:1
EIGEN_DEFAULT_DENSE_INDEX_TYPE Index
The Index type as used for the API.
Definition Meta.h:74
const int Dynamic
Definition Constants.h:22