10#ifndef EIGEN_SOLVETRIANGULAR_H
11#define EIGEN_SOLVETRIANGULAR_H
19template<
typename LhsScalar,
typename RhsScalar,
typename Index,
int S
ide,
int Mode,
bool Conjugate,
int StorageOrder>
22template <
typename Scalar,
typename Index,
int S
ide,
int Mode,
bool Conjugate,
int TriStorageOrder,
int OtherStorageOrder,
int OtherInnerStr
ide>
26template<
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
41template<
typename Lhs,
typename Rhs,
49template<
typename Lhs,
typename Rhs,
int S
ide,
int Mode>
52 typedef typename Lhs::Scalar LhsScalar;
53 typedef typename Rhs::Scalar RhsScalar;
55 typedef typename LhsProductTraits::ExtractType ActualLhsType;
57 static EIGEN_DEVICE_FUNC
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(),
81template<
typename Lhs,
typename Rhs,
int S
ide,
int Mode>
84 typedef typename Rhs::Scalar Scalar;
86 typedef typename LhsProductTraits::DirectLinearAccessType ActualLhsType;
88 static EIGEN_DEVICE_FUNC
void run(
const Lhs& lhs, Rhs& rhs)
92 const Index size = lhs.rows();
96 Rhs::MaxRowsAtCompileTime, Rhs::MaxColsAtCompileTime, Lhs::MaxRowsAtCompileTime,4>
BlockingType;
110template<
typename Lhs,
typename Rhs,
int Mode,
int LoopIndex,
int Size,
114template<
typename Lhs,
typename Rhs,
int Mode,
int LoopIndex,
int Size>
119 StartIndex = IsLower ? 0 : DiagIndex+1
121 static EIGEN_DEVICE_FUNC
void run(
const Lhs& lhs, Rhs& rhs)
128 rhs.coeffRef(DiagIndex) /= lhs.coeff(DiagIndex,DiagIndex);
134template<
typename Lhs,
typename Rhs,
int Mode,
int LoopIndex,
int Size>
136 static EIGEN_DEVICE_FUNC
void run(
const Lhs&, Rhs&) {}
139template<
typename Lhs,
typename Rhs,
int Mode>
141 static EIGEN_DEVICE_FUNC
void run(
const Lhs& lhs, Rhs& rhs)
145template<
typename Lhs,
typename Rhs,
int Mode>
147 static EIGEN_DEVICE_FUNC
void run(
const Lhs& lhs, Rhs& rhs)
164#ifndef EIGEN_PARSED_BY_DOXYGEN
165template<
typename MatrixType,
unsigned int Mode>
166template<
int S
ide,
typename OtherDerived>
170 eigen_assert( derived().cols() == derived().rows() && ((Side==
OnTheLeft && derived().cols() == other.rows()) || (Side==
OnTheRight && derived().cols() == other.cols())) );
171 eigen_assert((!(
int(Mode) &
int(
ZeroDiag))) &&
bool(
int(Mode) & (
int(
Upper) |
int(
Lower))));
173 if (derived().cols() == 0)
177 typedef typename internal::conditional<copy,
178 typename internal::plain_matrix_type_column_major<OtherDerived>::type, OtherDerived&>::type OtherCopy;
179 OtherCopy otherCopy(other);
181 internal::triangular_solver_selector<MatrixType, typename internal::remove_reference<OtherCopy>::type,
182 Side, Mode>::run(derived().nestedExpression(), otherCopy);
188template<
typename Derived,
unsigned int Mode>
189template<
int S
ide,
typename Other>
190const internal::triangular_solve_retval<Side,TriangularView<Derived,Mode>,Other>
191TriangularViewImpl<Derived,Mode,Dense>::solve(
const MatrixBase<Other>& other)
const
193 return internal::triangular_solve_retval<Side,TriangularViewType,Other>(derived(), other.derived());
200template<
int S
ide,
typename TriangularType,
typename Rhs>
207 :
public ReturnByValue<triangular_solve_retval<Side, TriangularType, Rhs> >
209 typedef typename remove_all<typename Rhs::Nested>::type RhsNestedCleaned;
213 : m_triangularMatrix(
tri), m_rhs(rhs)
216 inline EIGEN_CONSTEXPR
Index rows()
const EIGEN_NOEXCEPT {
return m_rhs.rows(); }
217 inline EIGEN_CONSTEXPR
Index cols()
const EIGEN_NOEXCEPT {
return m_rhs.cols(); }
219 template<
typename Dest>
inline void evalTo(
Dest&
dst)
const
221 if(!is_same_dense(
dst,m_rhs))
228 typename Rhs::Nested m_rhs;
EIGEN_DEVICE_FUNC Scalar sum() const
Definition Redux.h:459
EIGEN_DEVICE_FUNC TransposeReturnType transpose()
Definition Transpose.h:182
Base class for all dense matrices, vectors, and expressions.
Definition MatrixBase.h:50
Definition ReturnByValue.h:52
Definition TriangularMatrix.h:183
Definition GeneralMatrixMatrix.h:248
Definition SolveTriangular.h:28
@ UnitDiag
Matrix has ones on the diagonal; to be used in combination with #Lower or #Upper.
Definition Constants.h:213
@ ZeroDiag
Matrix has zeros on the diagonal; to be used in combination with #Lower or #Upper.
Definition Constants.h:215
@ Lower
View matrix as a lower triangular matrix.
Definition Constants.h:209
@ Upper
View matrix as an upper triangular matrix.
Definition Constants.h:211
@ Aligned
Definition Constants.h:240
@ ColMajor
Storage order is column major (see TopicStorageOrders).
Definition Constants.h:319
@ RowMajor
Storage order is row major (see TopicStorageOrders).
Definition Constants.h:321
@ OnTheLeft
Apply transformation on the left.
Definition Constants.h:332
@ OnTheRight
Apply transformation on the right.
Definition Constants.h:334
const unsigned int RowMajorBit
for a matrix, this means that the storage order is row-major.
Definition Constants.h:66
Namespace containing all symbols from the Eigen library.
Definition LDLT.h:16
EIGEN_DEFAULT_DENSE_INDEX_TYPE Index
The Index type as used for the API.
Definition Meta.h:74
const int Dynamic
This value means that a positive quantity (e.g., a size) is not known at compile-time,...
Definition Constants.h:22
Definition ForwardDeclarations.h:17
Definition SolveTriangular.h:23
Definition SolveTriangular.h:208
Definition SolveTriangular.h:20
Definition SolveTriangular.h:47
Definition SolveTriangular.h:112