![]() |
Eigen
3.3.3
|
00001 // This file is part of Eigen, a lightweight C++ template library 00002 // for linear algebra. 00003 // 00004 // Copyright (C) 2015 Gael Guennebaud <gael.guennebaud@inria.fr> 00005 // 00006 // This Source Code Form is subject to the terms of the Mozilla 00007 // Public License v. 2.0. If a copy of the MPL was not distributed 00008 // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. 00009 00010 #ifndef EIGEN_SOLVERBASE_H 00011 #define EIGEN_SOLVERBASE_H 00012 00013 namespace Eigen { 00014 00015 namespace internal { 00016 00017 00018 00019 } // end namespace internal 00020 00040 template<typename Derived> 00041 class SolverBase : public EigenBase<Derived> 00042 { 00043 public: 00044 00045 typedef EigenBase<Derived> Base; 00046 typedef typename internal::traits<Derived>::Scalar Scalar; 00047 typedef Scalar CoeffReturnType; 00048 00049 enum { 00050 RowsAtCompileTime = internal::traits<Derived>::RowsAtCompileTime, 00051 ColsAtCompileTime = internal::traits<Derived>::ColsAtCompileTime, 00052 SizeAtCompileTime = (internal::size_at_compile_time<internal::traits<Derived>::RowsAtCompileTime, 00053 internal::traits<Derived>::ColsAtCompileTime>::ret), 00054 MaxRowsAtCompileTime = internal::traits<Derived>::MaxRowsAtCompileTime, 00055 MaxColsAtCompileTime = internal::traits<Derived>::MaxColsAtCompileTime, 00056 MaxSizeAtCompileTime = (internal::size_at_compile_time<internal::traits<Derived>::MaxRowsAtCompileTime, 00057 internal::traits<Derived>::MaxColsAtCompileTime>::ret), 00058 IsVectorAtCompileTime = internal::traits<Derived>::MaxRowsAtCompileTime == 1 00059 || internal::traits<Derived>::MaxColsAtCompileTime == 1 00060 }; 00061 00063 SolverBase() 00064 {} 00065 00066 ~SolverBase() 00067 {} 00068 00069 using Base::derived; 00070 00073 template<typename Rhs> 00074 inline const Solve<Derived, Rhs> 00075 solve(const MatrixBase<Rhs>& b) const 00076 { 00077 eigen_assert(derived().rows()==b.rows() && "solve(): invalid number of rows of the right hand side matrix b"); 00078 return Solve<Derived, Rhs>(derived(), b.derived()); 00079 } 00080 00082 typedef typename internal::add_const<Transpose<const Derived> >::type ConstTransposeReturnType; 00090 inline ConstTransposeReturnType transpose() const 00091 { 00092 return ConstTransposeReturnType(derived()); 00093 } 00094 00096 typedef typename internal::conditional<NumTraits<Scalar>::IsComplex, 00097 CwiseUnaryOp<internal::scalar_conjugate_op<Scalar>, ConstTransposeReturnType>, 00098 ConstTransposeReturnType 00099 >::type AdjointReturnType; 00109 inline AdjointReturnType adjoint() const 00110 { 00111 return AdjointReturnType(derived().transpose()); 00112 } 00113 00114 protected: 00115 }; 00116 00117 namespace internal { 00118 00119 template<typename Derived> 00120 struct generic_xpr_base<Derived, MatrixXpr, SolverStorage> 00121 { 00122 typedef SolverBase<Derived> type; 00123 00124 }; 00125 00126 } // end namespace internal 00127 00128 } // end namespace Eigen 00129 00130 #endif // EIGEN_SOLVERBASE_H