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 
74  typedef Scalar CoeffReturnType;
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 
121  inline ConstTransposeReturnType transpose() const
122  {
123  return ConstTransposeReturnType(derived());
124  }
125 
128  CwiseUnaryOp<internal::scalar_conjugate_op<Scalar>, ConstTransposeReturnType>,
129  ConstTransposeReturnType
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
const Solve< Derived, Rhs > solve(const MatrixBase< Rhs > &b) const
Definition: SolverBase.h:106
Scalar * b
Definition: benchVecAdd.cpp:17
void adjoint(const MatrixType &m)
Definition: adjoint.cpp:67
internal::traits< Derived >::Scalar Scalar
Definition: SolverBase.h:73
static void run(const Derived &solver, const Rhs &b)
Definition: SolverBase.h:20
Expression of the transpose of a matrix.
Definition: Transpose.h:52
static void run(const type &transpose, const Rhs &b)
Definition: SolverBase.h:29
Namespace containing all symbols from the Eigen library.
Definition: jet.h:637
CwiseUnaryOp< Eigen::internal::scalar_conjugate_op< Scalar >, const Transpose< Derived > > type
Definition: SolverBase.h:38
EigenBase< Derived > Base
Definition: SolverBase.h:72
BiCGSTAB< SparseMatrix< double > > solver
Scalar CoeffReturnType
Definition: SolverBase.h:74
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const internal::remove_all< MatrixTypeNested >::type & nestedExpression() const
Definition: Transpose.h:76
ConstTransposeReturnType transpose() const
Definition: SolverBase.h:121
#define eigen_assert(x)
Definition: Macros.h:1037
DenseIndex ret
internal::conditional< NumTraits< Scalar >::IsComplex, CwiseUnaryOp< internal::scalar_conjugate_op< Scalar >, ConstTransposeReturnType >, ConstTransposeReturnType >::type AdjointReturnType
Definition: SolverBase.h:130
Pseudo expression representing a solving operation.
Definition: Solve.h:62
Generic expression where a coefficient-wise unary operator is applied to an expression.
Definition: CwiseUnaryOp.h:55
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const internal::remove_all< XprTypeNested >::type & nestedExpression() const
Definition: CwiseUnaryOp.h:80
AdjointReturnType adjoint() const
Definition: SolverBase.h:140
A base class for matrix decomposition and solvers.
Definition: SolverBase.h:68
Base class for all dense matrices, vectors, and expressions.
Definition: MatrixBase.h:48
internal::add_const< Transpose< const Derived > >::type ConstTransposeReturnType
Definition: SolverBase.h:113
void _check_solve_assertion(const Rhs &b) const
Definition: SolverBase.h:148
Definition: pytypes.h:1370
#define EIGEN_ONLY_USED_FOR_DEBUG(x)
Definition: Macros.h:1049


gtsam
Author(s):
autogenerated on Tue Jul 4 2023 02:35:53