10 #ifndef EIGEN_SOLVEWITHGUESS_H
11 #define EIGEN_SOLVEWITHGUESS_H
13 #include "./InternalHeaderCheck.h"
17 template<
typename Decomposition,
typename RhsType,
typename GuessType>
class SolveWithGuess;
34 template<
typename Decomposition,
typename RhsType,
typename GuessType>
35 struct traits<SolveWithGuess<Decomposition, RhsType, GuessType> >
36 : traits<Solve<Decomposition,RhsType> >
42 template<
typename Decomposition,
typename RhsType,
typename GuessType>
43 class SolveWithGuess :
public internal::generic_xpr_base<SolveWithGuess<Decomposition,RhsType,GuessType>, MatrixXpr, typename internal::traits<RhsType>::StorageKind>::type
46 typedef typename internal::traits<SolveWithGuess>::Scalar Scalar;
47 typedef typename internal::traits<SolveWithGuess>::PlainObject PlainObject;
48 typedef typename internal::generic_xpr_base<SolveWithGuess<Decomposition,RhsType,GuessType>, MatrixXpr,
typename internal::traits<RhsType>::StorageKind>::type Base;
49 typedef typename internal::ref_selector<SolveWithGuess>::type Nested;
51 SolveWithGuess(
const Decomposition &dec,
const RhsType &rhs,
const GuessType &guess)
52 : m_dec(dec), m_rhs(rhs), m_guess(guess)
55 EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR
56 Index rows() const EIGEN_NOEXCEPT {
return m_dec.cols(); }
57 EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR
58 Index cols() const EIGEN_NOEXCEPT {
return m_rhs.cols(); }
60 EIGEN_DEVICE_FUNC
const Decomposition& dec()
const {
return m_dec; }
61 EIGEN_DEVICE_FUNC
const RhsType& rhs()
const {
return m_rhs; }
62 EIGEN_DEVICE_FUNC
const GuessType& guess()
const {
return m_guess; }
65 const Decomposition &m_dec;
67 const GuessType &m_guess;
71 Scalar coeff(
Index i)
const;
77 template<
typename Decomposition,
typename RhsType,
typename GuessType>
78 struct evaluator<SolveWithGuess<Decomposition,RhsType, GuessType> >
79 :
public evaluator<typename SolveWithGuess<Decomposition,RhsType,GuessType>::PlainObject>
81 typedef SolveWithGuess<Decomposition,RhsType,GuessType> SolveType;
82 typedef typename SolveType::PlainObject PlainObject;
83 typedef evaluator<PlainObject> Base;
85 evaluator(
const SolveType& solve)
86 : m_result(solve.rows(), solve.cols())
88 internal::construct_at<Base>(
this, m_result);
89 m_result = solve.guess();
90 solve.dec()._solve_with_guess_impl(solve.rhs(), m_result);
99 template<
typename DstXprType,
typename DecType,
typename RhsType,
typename GuessType,
typename Scalar>
100 struct Assignment<DstXprType, SolveWithGuess<DecType,RhsType,GuessType>, internal::assign_op<Scalar,Scalar>, Dense2Dense>
102 typedef SolveWithGuess<DecType,RhsType,GuessType> SrcXprType;
103 static void run(DstXprType &dst,
const SrcXprType &src,
const internal::assign_op<Scalar,Scalar> &)
105 Index dstRows = src.rows();
106 Index dstCols = src.cols();
107 if((dst.rows()!=dstRows) || (dst.cols()!=dstCols))
108 dst.resize(dstRows, dstCols);
111 src.dec()._solve_with_guess_impl(src.rhs(), dst);
Namespace containing all symbols from the Eigen library.
Definition: Core:139
EIGEN_DEFAULT_DENSE_INDEX_TYPE Index
The Index type as used for the API.
Definition: Meta.h:59