ForwardDeclarations.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) 2007-2010 Benoit Jacob <jacob.benoit.1@gmail.com>
5 // Copyright (C) 2008-2009 Gael Guennebaud <gael.guennebaud@inria.fr>
6 //
7 // Eigen is free software; you can redistribute it and/or
8 // modify it under the terms of the GNU Lesser General Public
9 // License as published by the Free Software Foundation; either
10 // version 3 of the License, or (at your option) any later version.
11 //
12 // Alternatively, you can redistribute it and/or
13 // modify it under the terms of the GNU General Public License as
14 // published by the Free Software Foundation; either version 2 of
15 // the License, or (at your option) any later version.
16 //
17 // Eigen is distributed in the hope that it will be useful, but WITHOUT ANY
18 // WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
19 // FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License or the
20 // GNU General Public License for more details.
21 //
22 // You should have received a copy of the GNU Lesser General Public
23 // License and a copy of the GNU General Public License along with
24 // Eigen. If not, see <http://www.gnu.org/licenses/>.
25 
26 #ifndef EIGEN_FORWARDDECLARATIONS_H
27 #define EIGEN_FORWARDDECLARATIONS_H
28 
29 namespace Eigen {
30 namespace internal {
31 
32 template<typename T> struct traits;
33 
34 // here we say once and for all that traits<const T> == traits<T>
35 // When constness must affect traits, it has to be constness on template parameters on which T itself depends.
36 // For example, traits<Map<const T> > != traits<Map<T> >, but
37 // traits<const Map<T> > == traits<Map<T> >
38 template<typename T> struct traits<const T> : traits<T> {};
39 
40 template<typename Derived> struct has_direct_access
41 {
42  enum { ret = (traits<Derived>::Flags & DirectAccessBit) ? 1 : 0 };
43 };
44 
45 template<typename Derived> struct accessors_level
46 {
47  enum { has_direct_access = (traits<Derived>::Flags & DirectAccessBit) ? 1 : 0,
48  has_write_access = (traits<Derived>::Flags & LvalueBit) ? 1 : 0,
49  value = has_direct_access ? (has_write_access ? DirectWriteAccessors : DirectAccessors)
50  : (has_write_access ? WriteAccessors : ReadOnlyAccessors)
51  };
52 };
53 
54 } // end namespace internal
55 
56 template<typename T> struct NumTraits;
57 
58 template<typename Derived> struct EigenBase;
59 template<typename Derived> class DenseBase;
60 template<typename Derived> class PlainObjectBase;
61 
62 
63 template<typename Derived,
64  int Level = internal::accessors_level<Derived>::value >
65 class DenseCoeffsBase;
66 
67 template<typename _Scalar, int _Rows, int _Cols,
68  int _Options = AutoAlign |
69 #if defined(__GNUC__) && __GNUC__==3 && __GNUC_MINOR__==4
70  // workaround a bug in at least gcc 3.4.6
71  // the innermost ?: ternary operator is misparsed. We write it slightly
72  // differently and this makes gcc 3.4.6 happy, but it's ugly.
73  // The error would only show up with EIGEN_DEFAULT_TO_ROW_MAJOR is defined
74  // (when EIGEN_DEFAULT_MATRIX_STORAGE_ORDER_OPTION is RowMajor)
75  ( (_Rows==1 && _Cols!=1) ? RowMajor
76  : !(_Cols==1 && _Rows!=1) ? EIGEN_DEFAULT_MATRIX_STORAGE_ORDER_OPTION
77  : ColMajor ),
78 #else
79  ( (_Rows==1 && _Cols!=1) ? RowMajor
80  : (_Cols==1 && _Rows!=1) ? ColMajor
82 #endif
83  int _MaxRows = _Rows,
84  int _MaxCols = _Cols
85 > class Matrix;
86 
87 template<typename Derived> class MatrixBase;
88 template<typename Derived> class ArrayBase;
89 
90 template<typename ExpressionType, unsigned int Added, unsigned int Removed> class Flagged;
91 template<typename ExpressionType, template <typename> class StorageBase > class NoAlias;
92 template<typename ExpressionType> class NestByValue;
93 template<typename ExpressionType> class ForceAlignedAccess;
94 template<typename ExpressionType> class SwapWrapper;
95 
96 template<typename XprType, int BlockRows=Dynamic, int BlockCols=Dynamic, bool InnerPanel = false,
97  bool HasDirectAccess = internal::has_direct_access<XprType>::ret> class Block;
98 
99 template<typename MatrixType, int Size=Dynamic> class VectorBlock;
100 template<typename MatrixType> class Transpose;
101 template<typename MatrixType> class Conjugate;
102 template<typename NullaryOp, typename MatrixType> class CwiseNullaryOp;
103 template<typename UnaryOp, typename MatrixType> class CwiseUnaryOp;
104 template<typename ViewOp, typename MatrixType> class CwiseUnaryView;
105 template<typename BinaryOp, typename Lhs, typename Rhs> class CwiseBinaryOp;
106 template<typename BinOp, typename Lhs, typename Rhs> class SelfCwiseBinaryOp;
107 template<typename Derived, typename Lhs, typename Rhs> class ProductBase;
108 template<typename Lhs, typename Rhs, int Mode> class GeneralProduct;
109 template<typename Lhs, typename Rhs, int NestingFlags> class CoeffBasedProduct;
110 
111 template<typename Derived> class DiagonalBase;
112 template<typename _DiagonalVectorType> class DiagonalWrapper;
113 template<typename _Scalar, int SizeAtCompileTime, int MaxSizeAtCompileTime=SizeAtCompileTime> class DiagonalMatrix;
114 template<typename MatrixType, typename DiagonalType, int ProductOrder> class DiagonalProduct;
115 template<typename MatrixType, int Index = 0> class Diagonal;
116 template<int SizeAtCompileTime, int MaxSizeAtCompileTime = SizeAtCompileTime, typename IndexType=int> class PermutationMatrix;
117 template<int SizeAtCompileTime, int MaxSizeAtCompileTime = SizeAtCompileTime, typename IndexType=int> class Transpositions;
118 template<typename Derived> class PermutationBase;
119 template<typename Derived> class TranspositionsBase;
120 template<typename _IndicesType> class PermutationWrapper;
121 template<typename _IndicesType> class TranspositionsWrapper;
122 
123 template<typename Derived,
124  int Level = internal::accessors_level<Derived>::has_write_access ? WriteAccessors : ReadOnlyAccessors
125 > class MapBase;
126 template<int InnerStrideAtCompileTime, int OuterStrideAtCompileTime> class Stride;
127 template<typename MatrixType, int MapOptions=Unaligned, typename StrideType = Stride<0,0> > class Map;
128 
129 template<typename Derived> class TriangularBase;
130 template<typename MatrixType, unsigned int Mode> class TriangularView;
131 template<typename MatrixType, unsigned int Mode> class SelfAdjointView;
132 template<typename MatrixType> class SparseView;
133 template<typename ExpressionType> class WithFormat;
134 template<typename MatrixType> struct CommaInitializer;
135 template<typename Derived> class ReturnByValue;
136 template<typename ExpressionType> class ArrayWrapper;
137 template<typename ExpressionType> class MatrixWrapper;
138 
139 namespace internal {
140 template<typename DecompositionType, typename Rhs> struct solve_retval_base;
141 template<typename DecompositionType, typename Rhs> struct solve_retval;
142 template<typename DecompositionType> struct kernel_retval_base;
143 template<typename DecompositionType> struct kernel_retval;
144 template<typename DecompositionType> struct image_retval_base;
145 template<typename DecompositionType> struct image_retval;
146 } // end namespace internal
147 
148 namespace internal {
149 template<typename _Scalar, int Rows=Dynamic, int Cols=Dynamic, int Supers=Dynamic, int Subs=Dynamic, int Options=0> class BandMatrix;
150 }
151 
152 namespace internal {
153 template<typename Lhs, typename Rhs> struct product_type;
154 }
155 
156 template<typename Lhs, typename Rhs,
157  int ProductType = internal::product_type<Lhs,Rhs>::value>
158 struct ProductReturnType;
159 
160 // this is a workaround for sun CC
161 template<typename Lhs, typename Rhs> struct LazyProductReturnType;
162 
163 namespace internal {
164 
165 // Provides scalar/packet-wise product and product with accumulation
166 // with optional conjugation of the arguments.
167 template<typename LhsScalar, typename RhsScalar, bool ConjLhs=false, bool ConjRhs=false> struct conj_helper;
168 
169 template<typename Scalar> struct scalar_sum_op;
170 template<typename Scalar> struct scalar_difference_op;
171 template<typename LhsScalar,typename RhsScalar> struct scalar_conj_product_op;
172 template<typename Scalar> struct scalar_quotient_op;
173 template<typename Scalar> struct scalar_opposite_op;
174 template<typename Scalar> struct scalar_conjugate_op;
175 template<typename Scalar> struct scalar_real_op;
176 template<typename Scalar> struct scalar_imag_op;
177 template<typename Scalar> struct scalar_abs_op;
178 template<typename Scalar> struct scalar_abs2_op;
179 template<typename Scalar> struct scalar_sqrt_op;
180 template<typename Scalar> struct scalar_exp_op;
181 template<typename Scalar> struct scalar_log_op;
182 template<typename Scalar> struct scalar_cos_op;
183 template<typename Scalar> struct scalar_sin_op;
184 template<typename Scalar> struct scalar_acos_op;
185 template<typename Scalar> struct scalar_asin_op;
186 template<typename Scalar> struct scalar_tan_op;
187 template<typename Scalar> struct scalar_pow_op;
188 template<typename Scalar> struct scalar_inverse_op;
189 template<typename Scalar> struct scalar_square_op;
190 template<typename Scalar> struct scalar_cube_op;
191 template<typename Scalar, typename NewType> struct scalar_cast_op;
192 template<typename Scalar> struct scalar_multiple_op;
193 template<typename Scalar> struct scalar_quotient1_op;
194 template<typename Scalar> struct scalar_min_op;
195 template<typename Scalar> struct scalar_max_op;
196 template<typename Scalar> struct scalar_random_op;
197 template<typename Scalar> struct scalar_add_op;
198 template<typename Scalar> struct scalar_constant_op;
199 template<typename Scalar> struct scalar_identity_op;
200 
201 template<typename LhsScalar,typename RhsScalar=LhsScalar> struct scalar_product_op;
202 template<typename LhsScalar,typename RhsScalar> struct scalar_multiple2_op;
203 
204 } // end namespace internal
205 
206 struct IOFormat;
207 
208 // Array module
209 template<typename _Scalar, int _Rows, int _Cols,
210  int _Options = AutoAlign |
211 #if defined(__GNUC__) && __GNUC__==3 && __GNUC_MINOR__==4
212  // workaround a bug in at least gcc 3.4.6
213  // the innermost ?: ternary operator is misparsed. We write it slightly
214  // differently and this makes gcc 3.4.6 happy, but it's ugly.
215  // The error would only show up with EIGEN_DEFAULT_TO_ROW_MAJOR is defined
216  // (when EIGEN_DEFAULT_MATRIX_STORAGE_ORDER_OPTION is RowMajor)
217  ( (_Rows==1 && _Cols!=1) ? RowMajor
218  : !(_Cols==1 && _Rows!=1) ? EIGEN_DEFAULT_MATRIX_STORAGE_ORDER_OPTION
219  : ColMajor ),
220 #else
221  ( (_Rows==1 && _Cols!=1) ? RowMajor
222  : (_Cols==1 && _Rows!=1) ? ColMajor
223  : EIGEN_DEFAULT_MATRIX_STORAGE_ORDER_OPTION ),
224 #endif
225  int _MaxRows = _Rows, int _MaxCols = _Cols> class Array;
226 template<typename ConditionMatrixType, typename ThenMatrixType, typename ElseMatrixType> class Select;
227 template<typename MatrixType, typename BinaryOp, int Direction> class PartialReduxExpr;
228 template<typename ExpressionType, int Direction> class VectorwiseOp;
229 template<typename MatrixType,int RowFactor,int ColFactor> class Replicate;
230 template<typename MatrixType, int Direction = BothDirections> class Reverse;
231 
232 template<typename MatrixType> class FullPivLU;
233 template<typename MatrixType> class PartialPivLU;
234 namespace internal {
235 template<typename MatrixType> struct inverse_impl;
236 }
237 template<typename MatrixType> class HouseholderQR;
238 template<typename MatrixType> class ColPivHouseholderQR;
239 template<typename MatrixType> class FullPivHouseholderQR;
240 template<typename MatrixType, int QRPreconditioner = ColPivHouseholderQRPreconditioner> class JacobiSVD;
241 template<typename MatrixType, int UpLo = Lower> class LLT;
242 template<typename MatrixType, int UpLo = Lower> class LDLT;
243 template<typename VectorsType, typename CoeffsType, int Side=OnTheLeft> class HouseholderSequence;
244 template<typename Scalar> class JacobiRotation;
245 
246 // Geometry module:
247 template<typename Derived, int _Dim> class RotationBase;
248 template<typename Lhs, typename Rhs> class Cross;
249 template<typename Derived> class QuaternionBase;
250 template<typename Scalar> class Rotation2D;
251 template<typename Scalar> class AngleAxis;
252 template<typename Scalar,int Dim> class Translation;
253 
254 #ifdef EIGEN2_SUPPORT
255 template<typename Derived, int _Dim> class eigen2_RotationBase;
256 template<typename Lhs, typename Rhs> class eigen2_Cross;
257 template<typename Scalar> class eigen2_Quaternion;
258 template<typename Scalar> class eigen2_Rotation2D;
259 template<typename Scalar> class eigen2_AngleAxis;
260 template<typename Scalar,int Dim> class eigen2_Transform;
261 template <typename _Scalar, int _AmbientDim> class eigen2_ParametrizedLine;
262 template <typename _Scalar, int _AmbientDim> class eigen2_Hyperplane;
263 template<typename Scalar,int Dim> class eigen2_Translation;
264 template<typename Scalar,int Dim> class eigen2_Scaling;
265 #endif
266 
267 #if EIGEN2_SUPPORT_STAGE < STAGE20_RESOLVE_API_CONFLICTS
268 template<typename Scalar> class Quaternion;
269 template<typename Scalar,int Dim> class Transform;
270 template <typename _Scalar, int _AmbientDim> class ParametrizedLine;
271 template <typename _Scalar, int _AmbientDim> class Hyperplane;
272 template<typename Scalar,int Dim> class Scaling;
273 #endif
274 
275 #if EIGEN2_SUPPORT_STAGE > STAGE20_RESOLVE_API_CONFLICTS
276 template<typename Scalar, int Options = AutoAlign> class Quaternion;
277 template<typename Scalar,int Dim,int Mode,int _Options=AutoAlign> class Transform;
278 template <typename _Scalar, int _AmbientDim, int Options=AutoAlign> class ParametrizedLine;
279 template <typename _Scalar, int _AmbientDim, int Options=AutoAlign> class Hyperplane;
280 template<typename Scalar> class UniformScaling;
281 template<typename MatrixType,int Direction> class Homogeneous;
282 #endif
283 
284 // MatrixFunctions module
285 template<typename Derived> struct MatrixExponentialReturnValue;
286 template<typename Derived> class MatrixFunctionReturnValue;
287 template<typename Derived> class MatrixSquareRootReturnValue;
288 template<typename Derived> class MatrixLogarithmReturnValue;
289 
290 namespace internal {
291 template <typename Scalar>
292 struct stem_function
293 {
294  typedef std::complex<typename NumTraits<Scalar>::Real> ComplexScalar;
295  typedef ComplexScalar type(ComplexScalar, int);
296 };
297 }
298 
299 
300 #ifdef EIGEN2_SUPPORT
301 template<typename ExpressionType> class Cwise;
302 template<typename MatrixType> class Minor;
303 template<typename MatrixType> class LU;
304 template<typename MatrixType> class QR;
305 template<typename MatrixType> class SVD;
306 namespace internal {
307 template<typename MatrixType, unsigned int Mode> struct eigen2_part_return_type;
308 }
309 #endif
310 
311 } // end namespace Eigen
312 
313 #endif // EIGEN_FORWARDDECLARATIONS_H