MCPcopy Create free account
hub / github.com/TinyMPC/TinyMPC / run

Method run

include/Eigen/Eigen/src/Core/products/TriangularMatrixVector.h:35–90  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

33
34template<typename Index, int Mode, typename LhsScalar, bool ConjLhs, typename RhsScalar, bool ConjRhs, int Version>
35EIGEN_DONT_INLINE void triangular_matrix_vector_product<Index,Mode,LhsScalar,ConjLhs,RhsScalar,ConjRhs,ColMajor,Version>
36 ::run(Index _rows, Index _cols, const LhsScalar* _lhs, Index lhsStride,
37 const RhsScalar* _rhs, Index rhsIncr, ResScalar* _res, Index resIncr, const RhsScalar& alpha)
38 {
39 static const Index PanelWidth = EIGEN_TUNE_TRIANGULAR_PANEL_WIDTH;
40 Index size = (std::min)(_rows,_cols);
41 Index rows = IsLower ? _rows : (std::min)(_rows,_cols);
42 Index cols = IsLower ? (std::min)(_rows,_cols) : _cols;
43
44 typedef Map<const Matrix<LhsScalar,Dynamic,Dynamic,ColMajor>, 0, OuterStride<> > LhsMap;
45 const LhsMap lhs(_lhs,rows,cols,OuterStride<>(lhsStride));
46 typename conj_expr_if<ConjLhs,LhsMap>::type cjLhs(lhs);
47
48 typedef Map<const Matrix<RhsScalar,Dynamic,1>, 0, InnerStride<> > RhsMap;
49 const RhsMap rhs(_rhs,cols,InnerStride<>(rhsIncr));
50 typename conj_expr_if<ConjRhs,RhsMap>::type cjRhs(rhs);
51
52 typedef Map<Matrix<ResScalar,Dynamic,1> > ResMap;
53 ResMap res(_res,rows);
54
55 typedef const_blas_data_mapper<LhsScalar,Index,ColMajor> LhsMapper;
56 typedef const_blas_data_mapper<RhsScalar,Index,RowMajor> RhsMapper;
57
58 for (Index pi=0; pi<size; pi+=PanelWidth)
59 {
60 Index actualPanelWidth = (std::min)(PanelWidth, size-pi);
61 for (Index k=0; k<actualPanelWidth; ++k)
62 {
63 Index i = pi + k;
64 Index s = IsLower ? ((HasUnitDiag||HasZeroDiag) ? i+1 : i ) : pi;
65 Index r = IsLower ? actualPanelWidth-k : k+1;
66 if ((!(HasUnitDiag||HasZeroDiag)) || (--r)>0)
67 res.segment(s,r) += (alpha * cjRhs.coeff(i)) * cjLhs.col(i).segment(s,r);
68 if (HasUnitDiag)
69 res.coeffRef(i) += alpha * cjRhs.coeff(i);
70 }
71 Index r = IsLower ? rows - pi - actualPanelWidth : pi;
72 if (r>0)
73 {
74 Index s = IsLower ? pi+actualPanelWidth : 0;
75 general_matrix_vector_product<Index,LhsScalar,LhsMapper,ColMajor,ConjLhs,RhsScalar,RhsMapper,ConjRhs,BuiltIn>::run(
76 r, actualPanelWidth,
77 LhsMapper(&lhs.coeffRef(s,pi), lhsStride),
78 RhsMapper(&rhs.coeffRef(pi), rhsIncr),
79 &res.coeffRef(s), resIncr, alpha);
80 }
81 }
82 if((!IsLower) && cols>size)
83 {
84 general_matrix_vector_product<Index,LhsScalar,LhsMapper,ColMajor,ConjLhs,RhsScalar,RhsMapper,ConjRhs>::run(
85 rows, cols-size,
86 LhsMapper(&lhs.coeffRef(0,size), lhsStride),
87 RhsMapper(&rhs.coeffRef(size), rhsIncr),
88 _res, resIncr, alpha);
89 }
90 }
91
92template<typename Index, int Mode, typename LhsScalar, bool ConjLhs, typename RhsScalar, bool ConjRhs,int Version>

Callers

nothing calls this directly

Calls 7

runFunction · 0.85
coeffMethod · 0.45
colMethod · 0.45
sumMethod · 0.45
cwiseProductMethod · 0.45
rowMethod · 0.45
transposeMethod · 0.45

Tested by

no test coverage detected