Medial Code Documentation
Loading...
Searching...
No Matches
SolverBase.h
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
13namespace Eigen {
14
15namespace internal {
16
17template<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
23template<typename Derived>
24struct 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
35template<typename Scalar, typename Derived>
37{
39
40 template<bool Transpose_, typename Rhs>
41 static void run(const type& adjoint, const Rhs& b)
42 {
43 internal::solve_assertion<typename internal::remove_all<Transpose<Derived> >::type>::template run<true>(adjoint.nestedExpression(), b);
44 }
45};
46} // end namespace internal
47
67template<typename Derived>
68class SolverBase : public EigenBase<Derived>
69{
70 public:
71
73 typedef typename internal::traits<Derived>::Scalar Scalar;
74 typedef Scalar CoeffReturnType;
75
76 template<typename Derived_>
77 friend struct internal::solve_assertion;
78
79 enum {
88 IsVectorAtCompileTime = internal::traits<Derived>::MaxRowsAtCompileTime == 1
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>
111
113 typedef Transpose<const Derived> ConstTransposeReturnType;
122 {
124 }
125
128 CwiseUnaryOp<internal::scalar_conjugate_op<Scalar>, const ConstTransposeReturnType>,
129 const ConstTransposeReturnType
130 >::type AdjointReturnType;
140 inline const AdjointReturnType adjoint() const
141 {
143 }
144
145 protected:
146
147 template<bool Transpose_, typename Rhs>
148 void _check_solve_assertion(const Rhs& b) const {
149 EIGEN_ONLY_USED_FOR_DEBUG(b);
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
155namespace internal {
156
157template<typename Derived>
159{
161
162};
163
164} // end namespace internal
165
166} // end namespace Eigen
167
168#endif // EIGEN_SOLVERBASE_H
Generic expression where a coefficient-wise unary operator is applied to an expression.
Definition CwiseUnaryOp.h:56
Base class for all dense matrices, vectors, and expressions.
Definition MatrixBase.h:50
A base class for matrix decomposition and solvers.
Definition SolverBase.h:69
SolverBase()
Default constructor.
Definition SolverBase.h:94
const ConstTransposeReturnType transpose() const
Definition SolverBase.h:121
const Solve< Derived, Rhs > solve(const MatrixBase< Rhs > &b) const
Definition SolverBase.h:106
EIGEN_DEVICE_FUNC Derived & derived()
Definition EigenBase.h:46
const AdjointReturnType adjoint() const
Definition SolverBase.h:140
Expression of the transpose of a matrix.
Definition Transpose.h:54
Namespace containing all symbols from the Eigen library.
Definition LDLT.h:16
Common base class for all classes T such that MatrixBase has an operator=(T) and a constructor Matrix...
Definition EigenBase.h:30
EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR Index cols() const EIGEN_NOEXCEPT
Definition EigenBase.h:63
EIGEN_DEVICE_FUNC Derived & derived()
Definition EigenBase.h:46
EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR Index rows() const EIGEN_NOEXCEPT
Definition EigenBase.h:60
The type used to identify a matrix expression.
Definition Constants.h:522
The type used to identify a general solver (factored) storage.
Definition Constants.h:513
Definition Meta.h:109
Definition XprHelper.h:501
Definition UnaryFunctors.h:109
Definition XprHelper.h:282
Definition SolverBase.h:18
Definition ForwardDeclarations.h:17
Definition Meta.h:96