MCPcopy Create free account
hub / github.com/PX4/eigen / run

Method run

Eigen/src/SparseLU/SparseLU_kernel_bmod.h:39–89  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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)
41{
42 typedef typename ScalarVector::Scalar Scalar;
43 // First, copy U[*,j] segment from dense(*) to tempv(*)
44 // The result of triangular solve is in tempv[*];
45 // The result of matric-vector update is in dense[*]
46 Index isub = lptr + no_zeros;
47 Index i;
48 Index irow;
49 for (i = 0; i < ((SegSizeAtCompileTime==Dynamic)?segsize:SegSizeAtCompileTime); i++)
50 {
51 irow = lsub(isub);
52 tempv(i) = dense(irow);
53 ++isub;
54 }
55 // Dense triangular solve -- start effective triangle
56 luptr += lda * no_zeros + no_zeros;
57 // Form Eigen matrix and vector
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);
60
61 u = A.template triangularView<UnitLower>().solve(u);
62
63 // Dense matrix-vector product y <-- B*x
64 luptr += segsize;
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) );
71
72 l.setZero();
73 internal::sparselu_gemm<Scalar>(l.rows(), l.cols(), B.cols(), B.data(), B.outerStride(), u.data(), u.outerStride(), l.data(), l.outerStride());
74
75 // Scatter tempv[] into SPA dense[] as a temporary storage
76 isub = lptr + no_zeros;
77 for (i = 0; i < ((SegSizeAtCompileTime==Dynamic)?segsize:SegSizeAtCompileTime); i++)
78 {
79 irow = lsub(isub++);
80 dense(irow) = tempv(i);
81 }
82
83 // Scatter l into SPA dense[]
84 for (i = 0; i < nrow; i++)
85 {
86 irow = lsub(isub++);
87 dense(irow) -= l(i);
88 }
89}
90
91template <> struct LU_kernel_bmod<1>
92{

Callers

nothing calls this directly

Calls 10

first_multipleFunction · 0.85
first_default_alignedFunction · 0.50
dataMethod · 0.45
solveMethod · 0.45
setZeroMethod · 0.45
rowsMethod · 0.45
colsMethod · 0.45
outerStrideMethod · 0.45
coeffMethod · 0.45
coeffRefMethod · 0.45

Tested by

no test coverage detected