14#include "./InternalHeaderCheck.h"
18template <
typename Decomposition,
typename RhsType,
typename StorageKind>
36template <
typename Decomposition,
typename RhsType,
typename StorageKind>
39template <
typename Decomposition,
typename RhsType>
40struct solve_traits<Decomposition, RhsType, Dense> {
41 typedef typename make_proper_matrix_type<
typename RhsType::Scalar, Decomposition::ColsAtCompileTime,
42 RhsType::ColsAtCompileTime, RhsType::PlainObject::Options,
43 Decomposition::MaxColsAtCompileTime, RhsType::MaxColsAtCompileTime>::type
47template <
typename Decomposition,
typename RhsType>
48struct traits<Solve<Decomposition, RhsType> >
50 typename solve_traits<Decomposition, RhsType, typename internal::traits<RhsType>::StorageKind>::PlainObject> {
51 typedef typename solve_traits<Decomposition, RhsType, typename internal::traits<RhsType>::StorageKind>::PlainObject
53 typedef typename promote_index_type<typename Decomposition::StorageIndex, typename RhsType::StorageIndex>::type
55 typedef traits<PlainObject> BaseTraits;
61template <
typename Decomposition,
typename RhsType>
62class Solve :
public SolveImpl<Decomposition, RhsType, typename internal::traits<RhsType>::StorageKind> {
64 typedef typename internal::traits<Solve>::PlainObject PlainObject;
65 typedef typename internal::traits<Solve>::StorageIndex StorageIndex;
67 Solve(
const Decomposition &dec,
const RhsType &rhs) : m_dec(dec), m_rhs(rhs) {}
69 EIGEN_DEVICE_FUNC
constexpr Index rows()
const noexcept {
return m_dec.cols(); }
70 EIGEN_DEVICE_FUNC
constexpr Index cols()
const noexcept {
return m_rhs.cols(); }
72 EIGEN_DEVICE_FUNC
const Decomposition &dec()
const {
return m_dec; }
73 EIGEN_DEVICE_FUNC
const RhsType &rhs()
const {
return m_rhs; }
76 const Decomposition &m_dec;
77 const typename internal::ref_selector<RhsType>::type m_rhs;
81template <
typename Decomposition,
typename RhsType>
82class SolveImpl<Decomposition, RhsType,
Dense> :
public MatrixBase<Solve<Decomposition, RhsType> > {
87 EIGEN_DENSE_PUBLIC_INTERFACE(Derived)
95template <
typename Decomposition,
typename RhsType,
typename StorageKind>
96class SolveImpl :
public internal::generic_xpr_base<Solve<Decomposition, RhsType>, MatrixXpr, StorageKind>::type {
98 typedef typename internal::generic_xpr_base<Solve<Decomposition, RhsType>, MatrixXpr, StorageKind>::type Base;
104template <
typename Decomposition,
typename RhsType>
105struct evaluator<Solve<Decomposition, RhsType> >
106 :
public evaluator<typename Solve<Decomposition, RhsType>::PlainObject> {
107 typedef Solve<Decomposition, RhsType> SolveType;
108 typedef typename SolveType::PlainObject PlainObject;
109 typedef evaluator<PlainObject> Base;
113 EIGEN_DEVICE_FUNC
explicit evaluator(
const SolveType &solve) : m_result(solve.rows(), solve.cols()) {
114 internal::construct_at<Base>(
this, m_result);
115 solve.dec()._solve_impl(solve.rhs(), m_result);
119 PlainObject m_result;
125template <
typename DstXprType,
typename DecType,
typename RhsType,
typename Scalar>
126struct Assignment<DstXprType, Solve<DecType, RhsType>, internal::assign_op<Scalar, Scalar>, Dense2Dense> {
127 typedef Solve<DecType, RhsType> SrcXprType;
128 static void run(DstXprType &dst,
const SrcXprType &src,
const internal::assign_op<Scalar, Scalar> &) {
129 Index dstRows = src.rows();
130 Index dstCols = src.cols();
131 if ((dst.rows() != dstRows) || (dst.cols() != dstCols)) dst.resize(dstRows, dstCols);
133 src.dec()._solve_impl(src.rhs(), dst);
138template <
typename DstXprType,
typename DecType,
typename RhsType,
typename Scalar>
139struct Assignment<DstXprType, Solve<Transpose<const DecType>, RhsType>, internal::assign_op<Scalar, Scalar>,
141 typedef Solve<Transpose<const DecType>, RhsType> SrcXprType;
142 static void run(DstXprType &dst,
const SrcXprType &src,
const internal::assign_op<Scalar, Scalar> &) {
143 Index dstRows = src.rows();
144 Index dstCols = src.cols();
145 if ((dst.rows() != dstRows) || (dst.cols() != dstCols)) dst.resize(dstRows, dstCols);
147 src.dec().nestedExpression().template _solve_impl_transposed<false>(src.rhs(), dst);
152template <
typename DstXprType,
typename DecType,
typename RhsType,
typename Scalar>
155 Solve<CwiseUnaryOp<internal::scalar_conjugate_op<typename DecType::Scalar>, const Transpose<const DecType> >,
157 internal::assign_op<Scalar, Scalar>, Dense2Dense> {
158 typedef Solve<CwiseUnaryOp<internal::scalar_conjugate_op<typename DecType::Scalar>,
const Transpose<const DecType> >,
161 static void run(DstXprType &dst,
const SrcXprType &src,
const internal::assign_op<Scalar, Scalar> &) {
162 Index dstRows = src.rows();
163 Index dstCols = src.cols();
164 if ((dst.rows() != dstRows) || (dst.cols() != dstCols)) dst.resize(dstRows, dstCols);
166 src.dec().nestedExpression().nestedExpression().template _solve_impl_transposed<true>(src.rhs(), dst);
Base class for all dense matrices, vectors, and expressions.
Definition MatrixBase.h:52
Pseudo expression representing a solving operation.
Definition Solve.h:62
const unsigned int EvalBeforeNestingBit
Definition Constants.h:74
const unsigned int RowMajorBit
Definition Constants.h:70
Namespace containing all symbols from the Eigen library.
Definition B01_Experimental.dox:1
const int HugeCost
Definition Constants.h:48
EIGEN_DEFAULT_DENSE_INDEX_TYPE Index
The Index type as used for the API.
Definition Meta.h:82
Definition Constants.h:519