10 #ifndef EIGEN_SOLVETRIANGULAR_H 11 #define EIGEN_SOLVETRIANGULAR_H 19 template<
typename LhsScalar,
typename RhsScalar,
typename Index,
int S
ide,
int Mode,
bool Conjugate,
int StorageOrder>
22 template <
typename Scalar,
typename Index,
int S
ide,
int Mode,
bool Conjugate,
int TriStorageOrder,
int OtherStorageOrder>
26 template<
typename Lhs,
typename Rhs,
int S
ide>
31 RhsIsVectorAtCompileTime = (Side==
OnTheLeft ? Rhs::ColsAtCompileTime : Rhs::RowsAtCompileTime)==1
35 Unrolling = (RhsIsVectorAtCompileTime && Rhs::SizeAtCompileTime !=
Dynamic && Rhs::SizeAtCompileTime <= 8)
36 ? CompleteUnrolling : NoUnrolling,
37 RhsVectors = RhsIsVectorAtCompileTime ? 1 :
Dynamic 41 template<
typename Lhs,
typename Rhs,
49 template<
typename Lhs,
typename Rhs,
int S
ide,
int Mode>
55 typedef typename LhsProductTraits::ExtractType ActualLhsType;
57 static void run(
const Lhs& lhs, Rhs& rhs)
59 ActualLhsType actualLhs = LhsProductTraits::extract(lhs);
63 bool useRhsDirectly = Rhs::InnerStrideAtCompileTime==1 || rhs.innerStride()==1;
65 ei_declare_aligned_stack_constructed_variable(RhsScalar,actualRhs,rhs.size(),
66 (useRhsDirectly ? rhs.data() : 0));
69 MappedRhs(actualRhs,rhs.size()) = rhs;
71 triangular_solve_vector<LhsScalar, RhsScalar,
typename Lhs::Index, Side, Mode, LhsProductTraits::NeedToConjugate,
73 ::run(actualLhs.cols(), actualLhs.data(), actualLhs.outerStride(), actualRhs);
76 rhs = MappedRhs(actualRhs, rhs.size());
81 template<
typename Lhs,
typename Rhs,
int S
ide,
int Mode>
85 typedef typename Rhs::Index Index;
89 static void run(
const Lhs& lhs, Rhs& rhs)
93 const Index
size = lhs.rows();
94 const Index othersize = Side==
OnTheLeft? rhs.cols() : rhs.rows();
97 Rhs::MaxRowsAtCompileTime, Rhs::MaxColsAtCompileTime, Lhs::MaxRowsAtCompileTime,4> BlockingType;
99 BlockingType blocking(rhs.rows(), rhs.cols(),
size);
103 ::run(size, othersize, &actualLhs.coeffRef(0,0), actualLhs.outerStride(), &rhs.coeffRef(0,0), rhs.outerStride(), blocking);
111 template<
typename Lhs,
typename Rhs,
int Mode,
int Index,
int Size,
112 bool Stop = Index==Size>
115 template<
typename Lhs,
typename Rhs,
int Mode,
int Index,
int Size>
119 RowIndex = IsLower ? Index : Size - Index - 1,
120 S = IsLower ? 0 : RowIndex+1
122 static void run(
const Lhs& lhs, Rhs& rhs)
125 rhs.coeffRef(RowIndex) -= lhs.row(RowIndex).template segment<Index>(S).transpose()
126 .cwiseProduct(rhs.template segment<Index>(S)).sum();
129 rhs.coeffRef(RowIndex) /= lhs.coeff(RowIndex,RowIndex);
135 template<
typename Lhs,
typename Rhs,
int Mode,
int Index,
int Size>
137 static void run(
const Lhs&, Rhs&) {}
140 template<
typename Lhs,
typename Rhs,
int Mode>
142 static void run(
const Lhs& lhs, Rhs& rhs)
146 template<
typename Lhs,
typename Rhs,
int Mode>
148 static void run(
const Lhs& lhs, Rhs& rhs)
155 0,Rhs::SizeAtCompileTime>::run(trLhs,trRhs);
172 template<
typename MatrixType,
unsigned int Mode>
173 template<
int S
ide,
typename OtherDerived>
176 OtherDerived& other = _other.const_cast_derived();
177 eigen_assert( cols() == rows() && ((Side==
OnTheLeft && cols() == other.rows()) || (Side==
OnTheRight && cols() == other.cols())) );
183 OtherCopy otherCopy(other);
186 Side, Mode>::run(nestedExpression(), otherCopy);
213 template<
typename Derived,
unsigned int Mode>
214 template<
int S
ide,
typename Other>
224 template<
int S
ide,
typename TriangularType,
typename Rhs>
231 :
public ReturnByValue<triangular_solve_retval<Side, TriangularType, Rhs> >
235 typedef typename Base::Index Index;
238 : m_triangularMatrix(tri), m_rhs(rhs)
241 inline Index rows()
const {
return m_rhs.rows(); }
242 inline Index cols()
const {
return m_rhs.cols(); }
244 template<
typename Dest>
inline void evalTo(Dest& dst)
const 248 m_triangularMatrix.template solveInPlace<Side>(dst);
252 const TriangularType& m_triangularMatrix;
253 typename Rhs::Nested m_rhs;
260 #endif // EIGEN_SOLVETRIANGULAR_H Definition: BlasUtil.h:151
Apply transformation on the right.
Definition: Constants.h:279
Definition: SolveTriangular.h:230
Definition: SolveTriangular.h:27
A matrix or vector expression mapping an existing array of data.
Definition: Map.h:104
Expression of the transpose of a matrix.
Definition: Transpose.h:57
iterative scaling algorithm to equilibrate rows and column norms in matrices
Definition: TestIMU_Common.h:87
Matrix has ones on the diagonal; to be used in combination with Lower or Upper.
Definition: Constants.h:171
void solveInPlace(const MatrixBase< OtherDerived > &other) const
"in-place" version of TriangularView::solve() where the result is written in other ...
Definition: SolveTriangular.h:174
Matrix has zeros on the diagonal; to be used in combination with Lower or Upper.
Definition: Constants.h:173
const unsigned int RowMajorBit
for a matrix, this means that the storage order is row-major.
Definition: Constants.h:53
Object is aligned for vectorization.
Definition: Constants.h:194
Definition: ReturnByValue.h:50
detail::size< coerce_list< Ts... >> size
Get the size of a list (number of elements.)
Definition: Size.h:56
View matrix as an upper triangular matrix.
Definition: Constants.h:169
Definition: SolveTriangular.h:23
Storage order is column major (see TopicStorageOrders).
Definition: Constants.h:264
Definition: SolveTriangular.h:20
Definition: BandTriangularSolver.h:13
Storage order is row major (see TopicStorageOrders).
Definition: Constants.h:266
Base class for triangular part in a matrix.
Definition: TriangularMatrix.h:158
View matrix as a lower triangular matrix.
Definition: Constants.h:167
const int Dynamic
This value means that a positive quantity (e.g., a size) is not known at compile-time, and that instead the value is stored in some runtime variable.
Definition: Constants.h:21
The matrix class, also used for vectors and row-vectors.
Definition: Matrix.h:127
Definition: SolveTriangular.h:47
Definition: GeneralMatrixMatrix.h:239
Base class for all dense matrices, vectors, and expressions.
Definition: MatrixBase.h:48
Definition: ForwardDeclarations.h:17
Apply transformation on the left.
Definition: Constants.h:277
double Scalar
Common scalar type.
Definition: FlexibleKalmanBase.h:48
Definition: SolveTriangular.h:113