Eigen  3.3.90 (mercurial changeset b7a5520e097f)
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 
13 namespace Eigen {
14 
15 namespace internal {
16 
17 
18 
19 } // end namespace internal
20 
40 template<typename Derived>
41 class SolverBase : public EigenBase<Derived>
42 {
43  public:
44 
45  typedef EigenBase<Derived> Base;
46  typedef typename internal::traits<Derived>::Scalar Scalar;
47  typedef Scalar CoeffReturnType;
48 
49  enum {
50  RowsAtCompileTime = internal::traits<Derived>::RowsAtCompileTime,
51  ColsAtCompileTime = internal::traits<Derived>::ColsAtCompileTime,
52  SizeAtCompileTime = (internal::size_at_compile_time<internal::traits<Derived>::RowsAtCompileTime,
53  internal::traits<Derived>::ColsAtCompileTime>::ret),
54  MaxRowsAtCompileTime = internal::traits<Derived>::MaxRowsAtCompileTime,
55  MaxColsAtCompileTime = internal::traits<Derived>::MaxColsAtCompileTime,
56  MaxSizeAtCompileTime = (internal::size_at_compile_time<internal::traits<Derived>::MaxRowsAtCompileTime,
57  internal::traits<Derived>::MaxColsAtCompileTime>::ret),
58  IsVectorAtCompileTime = internal::traits<Derived>::MaxRowsAtCompileTime == 1
59  || internal::traits<Derived>::MaxColsAtCompileTime == 1,
60  NumDimensions = int(MaxSizeAtCompileTime) == 1 ? 0 : bool(IsVectorAtCompileTime) ? 1 : 2
61  };
62 
65  {}
66 
67  ~SolverBase()
68  {}
69 
70  using Base::derived;
71 
74  template<typename Rhs>
75  inline const Solve<Derived, Rhs>
76  solve(const MatrixBase<Rhs>& b) const
77  {
78  eigen_assert(derived().rows()==b.rows() && "solve(): invalid number of rows of the right hand side matrix b");
79  return Solve<Derived, Rhs>(derived(), b.derived());
80  }
81 
83  typedef typename internal::add_const<Transpose<const Derived> >::type ConstTransposeReturnType;
91  inline ConstTransposeReturnType transpose() const
92  {
93  return ConstTransposeReturnType(derived());
94  }
95 
97  typedef typename internal::conditional<NumTraits<Scalar>::IsComplex,
98  CwiseUnaryOp<internal::scalar_conjugate_op<Scalar>, ConstTransposeReturnType>,
99  ConstTransposeReturnType
100  >::type AdjointReturnType;
110  inline AdjointReturnType adjoint() const
111  {
112  return AdjointReturnType(derived().transpose());
113  }
114 
115  protected:
116 };
117 
118 namespace internal {
119 
120 template<typename Derived>
121 struct generic_xpr_base<Derived, MatrixXpr, SolverStorage>
122 {
123  typedef SolverBase<Derived> type;
124 
125 };
126 
127 } // end namespace internal
128 
129 } // end namespace Eigen
130 
131 #endif // EIGEN_SOLVERBASE_H
const Solve< Derived, Rhs > solve(const MatrixBase< Rhs > &b) const
Definition: SolverBase.h:76
Expression of the transpose of a matrix.
Definition: Transpose.h:52
Namespace containing all symbols from the Eigen library.
Definition: Core:340
Derived & derived()
Definition: EigenBase.h:45
Definition: EigenBase.h:29
Index rows() const
Definition: EigenBase.h:59
ConstTransposeReturnType transpose() const
Definition: SolverBase.h:91
Definition: Eigen_Colamd.h:50
SolverBase()
Definition: SolverBase.h:64
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
AdjointReturnType adjoint() const
Definition: SolverBase.h:110
A base class for matrix decomposition and solvers.
Definition: SolverBase.h:41
Base class for all dense matrices, vectors, and expressions.
Definition: MatrixBase.h:48