10 #ifndef EIGEN_SOLVEWITHGUESS_H 11 #define EIGEN_SOLVEWITHGUESS_H 15 template<
typename Decomposition,
typename RhsType,
typename GuessType>
class SolveWithGuess;
32 template<
typename Decomposition,
typename RhsType,
typename GuessType>
34 : traits<Solve<Decomposition,RhsType> >
40 template<
typename Decomposition,
typename RhsType,
typename GuessType>
41 class SolveWithGuess :
public internal::generic_xpr_base<SolveWithGuess<Decomposition,RhsType,GuessType>, MatrixXpr, typename internal::traits<RhsType>::StorageKind>::type
44 typedef typename internal::traits<SolveWithGuess>::Scalar Scalar;
45 typedef typename internal::traits<SolveWithGuess>::PlainObject PlainObject;
46 typedef typename internal::generic_xpr_base<SolveWithGuess<Decomposition,RhsType,GuessType>,
MatrixXpr,
typename internal::traits<RhsType>::StorageKind>::type Base;
47 typedef typename internal::ref_selector<SolveWithGuess>::type Nested;
49 SolveWithGuess(
const Decomposition &dec,
const RhsType &rhs,
const GuessType &guess)
50 : m_dec(dec), m_rhs(rhs), m_guess(guess)
53 EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR
54 Index rows() const EIGEN_NOEXCEPT {
return m_dec.cols(); }
55 EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR
56 Index cols() const EIGEN_NOEXCEPT {
return m_rhs.cols(); }
58 EIGEN_DEVICE_FUNC
const Decomposition& dec()
const {
return m_dec; }
59 EIGEN_DEVICE_FUNC
const RhsType& rhs()
const {
return m_rhs; }
60 EIGEN_DEVICE_FUNC
const GuessType& guess()
const {
return m_guess; }
63 const Decomposition &m_dec;
65 const GuessType &m_guess;
69 Scalar coeff(
Index i)
const;
75 template<
typename Decomposition,
typename RhsType,
typename GuessType>
76 struct evaluator<
SolveWithGuess<Decomposition,RhsType, GuessType> >
77 :
public evaluator<typename SolveWithGuess<Decomposition,RhsType,GuessType>::PlainObject>
80 typedef typename SolveType::PlainObject PlainObject;
81 typedef evaluator<PlainObject> Base;
83 evaluator(
const SolveType& solve)
84 : m_result(solve.rows(), solve.cols())
86 ::new (static_cast<Base*>(
this)) Base(m_result);
87 m_result = solve.guess();
88 solve.dec()._solve_with_guess_impl(solve.rhs(), m_result);
97 template<typename DstXprType, typename DecType, typename RhsType, typename GuessType, typename Scalar>
98 struct Assignment<DstXprType,
SolveWithGuess<DecType,RhsType,GuessType>,
internal::assign_op<Scalar,Scalar>, Dense2Dense>
101 static void run(DstXprType &dst,
const SrcXprType &src,
const internal::assign_op<Scalar,Scalar> &)
103 Index dstRows = src.rows();
104 Index dstCols = src.cols();
105 if((dst.rows()!=dstRows) || (dst.cols()!=dstCols))
106 dst.resize(dstRows, dstCols);
109 src.dec()._solve_with_guess_impl(src.rhs(), dst);
117 #endif // EIGEN_SOLVEWITHGUESS_H Pseudo expression representing a solving operation.
Definition: SolveWithGuess.h:15
Namespace containing all symbols from the Eigen library.
Definition: Core:141
Definition: Constants.h:522
EIGEN_DEFAULT_DENSE_INDEX_TYPE Index
The Index type as used for the API.
Definition: Meta.h:74
Definition: Eigen_Colamd.h:50