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>
41 template<
typename Lhs,
typename Rhs,
49 template<
typename Lhs,
typename Rhs,
int S
ide,
int Mode>
57 static void run(
const Lhs& lhs, Rhs& rhs)
59 ActualLhsType actualLhs = LhsProductTraits::extract(lhs);
63 bool useRhsDirectly = Rhs::InnerStrideAtCompileTime==1 || rhs.innerStride()==1;
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 I = IsLower ? Index : Size - Index - 1,
120 S = IsLower ? 0 : I+1
122 static void run(
const Lhs& lhs, Rhs& rhs)
125 rhs.coeffRef(I) -= lhs.row(I).template segment<Index>(S).transpose()
126 .cwiseProduct(rhs.template segment<Index>(S)).sum();
129 rhs.coeffRef(I) /= lhs.coeff(I,I);
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();
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> >
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);
260 #endif // EIGEN_SOLVETRIANGULAR_H
const internal::triangular_solve_retval< Side, TriangularView, Other > solve(const MatrixBase< Other > &other) const
static void run(const Lhs &, Rhs &)
void evalTo(Dest &dst) const
#define ei_declare_aligned_stack_constructed_variable(TYPE, NAME, SIZE, BUFFER)
A matrix or vector expression mapping an existing array of data.
Expression of the transpose of a matrix.
const unsigned int RowMajorBit
Map< Matrix< RhsScalar, Dynamic, 1 >, Aligned > MappedRhs
blas_traits< Lhs > LhsProductTraits
LhsProductTraits::DirectLinearAccessType ActualLhsType
static void run(const Lhs &lhs, Rhs &rhs)
ReturnByValue< triangular_solve_retval > Base
triangular_solve_retval(const TriangularType &tri, const Rhs &rhs)
blas_traits< Lhs > LhsProductTraits
const TriangularType & m_triangularMatrix
static void run(const Lhs &lhs, Rhs &rhs)
LhsProductTraits::ExtractType ActualLhsType
remove_all< typename Rhs::Nested >::type RhsNestedCleaned
static void run(const Lhs &lhs, Rhs &rhs)
static void run(const Lhs &lhs, Rhs &rhs)
void solveInPlace(const MatrixBase< OtherDerived > &other) const
const T::Scalar * extract_data(const T &m)
internal::plain_matrix_type_column_major< Rhs >::type ReturnType
The matrix class, also used for vectors and row-vectors.
void run(ClassLoader *loader)
Base class for all dense matrices, vectors, and expressions.
static void run(const Lhs &lhs, Rhs &rhs)
const XprType & ExtractType