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>
52 typedef typename Lhs::Scalar LhsScalar;
53 typedef typename Rhs::Scalar RhsScalar;
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;
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>
84 typedef typename Rhs::Scalar Scalar;
88 static void run(
const Lhs& lhs, Rhs& rhs)
92 const Index size = lhs.rows();
96 Rhs::MaxRowsAtCompileTime, Rhs::MaxColsAtCompileTime, Lhs::MaxRowsAtCompileTime,4> BlockingType;
98 BlockingType blocking(rhs.rows(), rhs.cols(), size, 1,
false);
102 ::run(size, othersize, &actualLhs.coeffRef(0,0), actualLhs.outerStride(), &rhs.coeffRef(0,0), rhs.outerStride(), blocking);
110 template<
typename Lhs,
typename Rhs,
int Mode,
int LoopIndex,
int Size,
111 bool Stop = LoopIndex==Size>
114 template<
typename Lhs,
typename Rhs,
int Mode,
int LoopIndex,
int Size>
118 DiagIndex = IsLower ? LoopIndex : Size - LoopIndex - 1,
119 StartIndex = IsLower ? 0 : DiagIndex+1
121 static void run(
const Lhs& lhs, Rhs& rhs)
124 rhs.coeffRef(DiagIndex) -= lhs.row(DiagIndex).template segment<LoopIndex>(StartIndex).transpose()
125 .cwiseProduct(rhs.template segment<LoopIndex>(StartIndex)).sum();
128 rhs.coeffRef(DiagIndex) /= lhs.coeff(DiagIndex,DiagIndex);
134 template<
typename Lhs,
typename Rhs,
int Mode,
int LoopIndex,
int Size>
136 static void run(
const Lhs&, Rhs&) {}
139 template<
typename Lhs,
typename Rhs,
int Mode>
141 static void run(
const Lhs& lhs, Rhs& rhs)
145 template<
typename Lhs,
typename Rhs,
int Mode>
147 static void run(
const Lhs& lhs, Rhs& rhs)
154 0,Rhs::SizeAtCompileTime>::run(trLhs,trRhs);
164 template<
typename MatrixType,
unsigned int Mode>
165 template<
int S
ide,
typename OtherDerived>
168 OtherDerived& other = _other.const_cast_derived();
169 eigen_assert( derived().cols() == derived().rows() && ((Side==
OnTheLeft && derived().cols() == other.rows()) || (Side==
OnTheRight && derived().cols() == other.cols())) );
175 OtherCopy otherCopy(other);
178 Side, Mode>::run(derived().nestedExpression(), otherCopy);
184 template<
typename Derived,
unsigned int Mode>
185 template<
int S
ide,
typename Other>
195 template<
int S
ide,
typename TriangularType,
typename Rhs>
202 :
public ReturnByValue<triangular_solve_retval<Side, TriangularType, Rhs> >
208 : m_triangularMatrix(tri), m_rhs(rhs)
211 inline Index rows()
const {
return m_rhs.rows(); }
212 inline Index cols()
const {
return m_rhs.cols(); }
214 template<
typename Dest>
inline void evalTo(Dest& dst)
const 216 if(!is_same_dense(dst,m_rhs))
218 m_triangularMatrix.template solveInPlace<Side>(dst);
222 const TriangularType& m_triangularMatrix;
223 typename Rhs::Nested m_rhs;
230 #endif // EIGEN_SOLVETRIANGULAR_H Definition: BlasUtil.h:269
Storage order is column major (see TopicStorageOrders).
Definition: Constants.h:320
Apply transformation on the right.
Definition: Constants.h:335
Definition: SolveTriangular.h:201
Definition: SolveTriangular.h:27
A matrix or vector expression mapping an existing array of data.
Definition: Map.h:88
Expression of the transpose of a matrix.
Definition: Transpose.h:52
Namespace containing all symbols from the Eigen library.
Definition: bench_norm.cpp:85
const unsigned int RowMajorBit
for a matrix, this means that the storage order is row-major.
Definition: Constants.h:61
Definition: ReturnByValue.h:50
Definition: SolveTriangular.h:23
View matrix as a lower triangular matrix.
Definition: Constants.h:204
Matrix has ones on the diagonal; to be used in combination with Lower or Upper.
Definition: Constants.h:208
EIGEN_DEFAULT_DENSE_INDEX_TYPE Index
The Index type as used for the API.
Definition: Meta.h:33
Definition: Constants.h:235
Apply transformation on the left.
Definition: Constants.h:333
Definition: SolveTriangular.h:20
View matrix as an upper triangular matrix.
Definition: Constants.h:206
Matrix has zeros on the diagonal; to be used in combination with Lower or Upper.
Definition: Constants.h:210
Definition: BandTriangularSolver.h:13
Definition: TriangularMatrix.h:184
Storage order is row major (see TopicStorageOrders).
Definition: Constants.h:322
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
Generic expression where a coefficient-wise unary operator is applied to an expression.
Definition: CwiseUnaryOp.h:55
The matrix class, also used for vectors and row-vectors.
Definition: Matrix.h:178
Definition: SolveTriangular.h:47
Definition: GeneralMatrixMatrix.h:244
Base class for all dense matrices, vectors, and expressions.
Definition: MatrixBase.h:48
Definition: ForwardDeclarations.h:17
Definition: SolveTriangular.h:112