NDDEM
SolverBase.h
Go to the documentation of this file.
1 // This file is part of Eigen, a lightweight C++ template library
2 // for linear algebra.
3 //
4 // Copyright (C) 2015 Gael Guennebaud <gael.guennebaud@inria.fr>
5 //
6 // This Source Code Form is subject to the terms of the Mozilla
7 // Public License v. 2.0. If a copy of the MPL was not distributed
8 // with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 
10 #ifndef EIGEN_SOLVERBASE_H
11 #define EIGEN_SOLVERBASE_H
12 
13 namespace Eigen {
14 
15 namespace internal {
16 
17 template<typename Derived>
19  template<bool Transpose_, typename Rhs>
20  static void run(const Derived& solver, const Rhs& b) { solver.template _check_solve_assertion<Transpose_>(b); }
21 };
22 
23 template<typename Derived>
24 struct solve_assertion<Transpose<Derived> >
25 {
27 
28  template<bool Transpose_, typename Rhs>
29  static void run(const type& transpose, const Rhs& b)
30  {
32  }
33 };
34 
35 template<typename Scalar, typename Derived>
37 {
39 
40  template<bool Transpose_, typename Rhs>
41  static void run(const type& adjoint, const Rhs& b)
42  {
44  }
45 };
46 } // end namespace internal
47 
67 template<typename Derived>
68 class SolverBase : public EigenBase<Derived>
69 {
70  public:
71 
75 
76  template<typename Derived_>
78 
79  enum {
90  NumDimensions = int(MaxSizeAtCompileTime) == 1 ? 0 : bool(IsVectorAtCompileTime) ? 1 : 2
91  };
92 
95  {}
96 
98  {}
99 
100  using Base::derived;
101 
104  template<typename Rhs>
105  inline const Solve<Derived, Rhs>
106  solve(const MatrixBase<Rhs>& b) const
107  {
109  return Solve<Derived, Rhs>(derived(), b.derived());
110  }
111 
122  {
124  }
125 
140  inline AdjointReturnType adjoint() const
141  {
142  return AdjointReturnType(derived().transpose());
143  }
144 
145  protected:
146 
147  template<bool Transpose_, typename Rhs>
148  void _check_solve_assertion(const Rhs& b) const {
150  eigen_assert(derived().m_isInitialized && "Solver is not initialized.");
151  eigen_assert((Transpose_?derived().cols():derived().rows())==b.rows() && "SolverBase::solve(): invalid number of rows of the right hand side matrix b");
152  }
153 };
154 
155 namespace internal {
156 
157 template<typename Derived>
159 {
161 
162 };
163 
164 } // end namespace internal
165 
166 } // end namespace Eigen
167 
168 #endif // EIGEN_SOLVERBASE_H
#define EIGEN_ONLY_USED_FOR_DEBUG(x)
Definition: Macros.h:1049
#define eigen_assert(x)
Definition: Macros.h:1037
Generic expression where a coefficient-wise unary operator is applied to an expression.
Definition: CwiseUnaryOp.h:56
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const internal::remove_all< XprTypeNested >::type & nestedExpression() const
Definition: CwiseUnaryOp.h:80
Base class for all dense matrices, vectors, and expressions.
Definition: MatrixBase.h:50
Pseudo expression representing a solving operation.
Definition: Solve.h:63
A base class for matrix decomposition and solvers.
Definition: SolverBase.h:69
AdjointReturnType adjoint() const
Definition: SolverBase.h:140
internal::traits< Derived >::Scalar Scalar
Definition: SolverBase.h:73
EigenBase< Derived > Base
Definition: SolverBase.h:72
EIGEN_DEVICE_FUNC Derived & derived()
Definition: EigenBase.h:46
SolverBase()
Definition: SolverBase.h:94
~SolverBase()
Definition: SolverBase.h:97
ConstTransposeReturnType transpose() const
Definition: SolverBase.h:121
const Solve< Derived, Rhs > solve(const MatrixBase< Rhs > &b) const
Definition: SolverBase.h:106
Scalar CoeffReturnType
Definition: SolverBase.h:74
internal::conditional< NumTraits< Scalar >::IsComplex, CwiseUnaryOp< internal::scalar_conjugate_op< Scalar >, ConstTransposeReturnType >, ConstTransposeReturnType >::type AdjointReturnType
Definition: SolverBase.h:130
internal::add_const< Transpose< const Derived > >::type ConstTransposeReturnType
Definition: SolverBase.h:113
void _check_solve_assertion(const Rhs &b) const
Definition: SolverBase.h:148
@ RowsAtCompileTime
Definition: SolverBase.h:80
@ NumDimensions
Definition: SolverBase.h:90
@ ColsAtCompileTime
Definition: SolverBase.h:81
@ MaxRowsAtCompileTime
Definition: SolverBase.h:84
@ IsVectorAtCompileTime
Definition: SolverBase.h:88
@ MaxSizeAtCompileTime
Definition: SolverBase.h:86
@ MaxColsAtCompileTime
Definition: SolverBase.h:85
@ SizeAtCompileTime
Definition: SolverBase.h:82
Expression of the transpose of a matrix.
Definition: Transpose.h:54
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const internal::remove_all< MatrixTypeNested >::type & nestedExpression() const
Definition: Transpose.h:76
Namespace containing all symbols from the Eigen library.
Definition: LDLT.h:16
type
The type the bitset is encoded with.
Definition: bitset.hpp:44
Definition: document.h:416
Definition: EigenBase.h:30
EIGEN_DEVICE_FUNC Derived & derived()
Definition: EigenBase.h:46
EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR Index cols() const EIGEN_NOEXCEPT
Definition: EigenBase.h:63
EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR Index rows() const EIGEN_NOEXCEPT
Definition: EigenBase.h:60
Definition: Constants.h:522
Definition: Constants.h:513
Definition: Meta.h:208
Definition: Meta.h:109
SolverBase< Derived > type
Definition: SolverBase.h:160
Definition: XprHelper.h:501
Definition: UnaryFunctors.h:109
Definition: XprHelper.h:282
CwiseUnaryOp< Eigen::internal::scalar_conjugate_op< Scalar >, const Transpose< Derived > > type
Definition: SolverBase.h:38
Transpose< Derived > type
Definition: SolverBase.h:26
static void run(const type &transpose, const Rhs &b)
Definition: SolverBase.h:29
Definition: SolverBase.h:18
static void run(const Derived &solver, const Rhs &b)
Definition: SolverBase.h:20
Definition: ForwardDeclarations.h:17
Definition: Meta.h:96
#define const
Definition: zconf.h:233