10#ifndef EIGEN_SOLVEWITHGUESS_H
11#define EIGEN_SOLVEWITHGUESS_H
14#include "./InternalHeaderCheck.h"
18template <
typename Decomposition,
typename RhsType,
typename GuessType>
35template <
typename Decomposition,
typename RhsType,
typename GuessType>
36struct traits<SolveWithGuess<Decomposition, RhsType, GuessType> > : traits<Solve<Decomposition, RhsType> > {};
40template <
typename Decomposition,
typename RhsType,
typename GuessType>
41class SolveWithGuess :
public internal::generic_xpr_base<SolveWithGuess<Decomposition, RhsType, GuessType>, MatrixXpr,
42 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,
47 typename internal::traits<RhsType>::StorageKind>::type Base;
48 typedef typename internal::ref_selector<SolveWithGuess>::type Nested;
50 SolveWithGuess(
const Decomposition &dec,
const RhsType &rhs,
const GuessType &guess)
51 : m_dec(dec), m_rhs(rhs), m_guess(guess) {}
53 EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR
Index rows()
const EIGEN_NOEXCEPT {
return m_dec.cols(); }
54 EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR
Index cols()
const EIGEN_NOEXCEPT {
return m_rhs.cols(); }
56 EIGEN_DEVICE_FUNC
const Decomposition &dec()
const {
return m_dec; }
57 EIGEN_DEVICE_FUNC
const RhsType &rhs()
const {
return m_rhs; }
58 EIGEN_DEVICE_FUNC
const GuessType &guess()
const {
return m_guess; }
61 const Decomposition &m_dec;
63 const GuessType &m_guess;
67 Scalar coeff(
Index i)
const;
73template <
typename Decomposition,
typename RhsType,
typename GuessType>
74struct evaluator<
SolveWithGuess<Decomposition, RhsType, GuessType> >
75 :
public evaluator<typename SolveWithGuess<Decomposition, RhsType, GuessType>::PlainObject> {
77 typedef typename SolveType::PlainObject PlainObject;
78 typedef evaluator<PlainObject> Base;
80 evaluator(
const SolveType &solve) : m_result(solve.rows(), solve.cols()) {
81 internal::construct_at<Base>(
this, m_result);
82 m_result = solve.guess();
83 solve.dec()._solve_with_guess_impl(solve.rhs(), m_result);
93template <
typename DstXprType,
typename DecType,
typename RhsType,
typename GuessType,
typename Scalar>
94struct Assignment<DstXprType, SolveWithGuess<DecType, RhsType, GuessType>, internal::assign_op<Scalar, Scalar>,
96 typedef SolveWithGuess<DecType, RhsType, GuessType> SrcXprType;
97 static void run(DstXprType &dst,
const SrcXprType &src,
const internal::assign_op<Scalar, Scalar> &) {
98 Index dstRows = src.rows();
99 Index dstCols = src.cols();
100 if ((dst.rows() != dstRows) || (dst.cols() != dstCols)) dst.resize(dstRows, dstCols);
103 src.dec()._solve_with_guess_impl(src.rhs(), dst );
Pseudo expression representing a solving operation.
Definition SolveWithGuess.h:42
Namespace containing all symbols from the Eigen library.
Definition Core:137
EIGEN_DEFAULT_DENSE_INDEX_TYPE Index
The Index type as used for the API.
Definition Meta.h:83
Definition Constants.h:531