1// This file is part of Eigen, a lightweight C++ template library
2// for linear algebra.
3//
4// Copyright (C) 2007-2010 Benoit Jacob <[email protected]>
5// Copyright (C) 2008-2009 Gael Guennebaud <[email protected]>
6//
7// This Source Code Form is subject to the terms of the Mozilla
8// Public License v. 2.0. If a copy of the MPL was not distributed
9// with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
10
11#ifndef EIGEN_FORWARDDECLARATIONS_H
12#define EIGEN_FORWARDDECLARATIONS_H
13
14namespace Eigen {
15namespace internal {
16
17template<typename T> struct traits;
18
19// here we say once and for all that traits<const T> == traits<T>
20// When constness must affect traits, it has to be constness on template parameters on which T itself depends.
21// For example, traits<Map<const T> > != traits<Map<T> >, but
22// traits<const Map<T> > == traits<Map<T> >
23template<typename T> struct traits<const T> : traits<T> {};
24
25template<typename Derived> struct has_direct_access
26{
27 enum { ret = (traits<Derived>::Flags & DirectAccessBit) ? 1 : 0 };
28};
29
30template<typename Derived> struct accessors_level
31{
32 enum { has_direct_access = (traits<Derived>::Flags & DirectAccessBit) ? 1 : 0,
33 has_write_access = (traits<Derived>::Flags & LvalueBit) ? 1 : 0,
34 value = has_direct_access ? (has_write_access ? DirectWriteAccessors : DirectAccessors)
35 : (has_write_access ? WriteAccessors : ReadOnlyAccessors)
36 };
37};
38
39template<typename T> struct evaluator_traits;
40
41template< typename T> struct evaluator;
42
43} // end namespace internal
44
45template<typename T> struct NumTraits;
46
47template<typename Derived> struct EigenBase;
48template<typename Derived> class DenseBase;
49template<typename Derived> class PlainObjectBase;
50template<typename Derived, int Level> class DenseCoeffsBase;
51
52template<typename _Scalar, int _Rows, int _Cols,
53 int _Options = AutoAlign |
54#if EIGEN_GNUC_AT(3,4)
55 // workaround a bug in at least gcc 3.4.6
56 // the innermost ?: ternary operator is misparsed. We write it slightly
57 // differently and this makes gcc 3.4.6 happy, but it's ugly.
58 // The error would only show up with EIGEN_DEFAULT_TO_ROW_MAJOR is defined
59 // (when EIGEN_DEFAULT_MATRIX_STORAGE_ORDER_OPTION is RowMajor)
60 ( (_Rows==1 && _Cols!=1) ? Eigen::RowMajor
61 : !(_Cols==1 && _Rows!=1) ? EIGEN_DEFAULT_MATRIX_STORAGE_ORDER_OPTION
62 : Eigen::ColMajor ),
63#else
64 ( (_Rows==1 && _Cols!=1) ? Eigen::RowMajor
65 : (_Cols==1 && _Rows!=1) ? Eigen::ColMajor
66 : EIGEN_DEFAULT_MATRIX_STORAGE_ORDER_OPTION ),
67#endif
68 int _MaxRows = _Rows,
69 int _MaxCols = _Cols
70> class Matrix;
71
72template<typename Derived> class MatrixBase;
73template<typename Derived> class ArrayBase;
74
75template<typename ExpressionType, unsigned int Added, unsigned int Removed> class Flagged;
76template<typename ExpressionType, template <typename> class StorageBase > class NoAlias;
77template<typename ExpressionType> class NestByValue;
78template<typename ExpressionType> class ForceAlignedAccess;
79template<typename ExpressionType> class SwapWrapper;
80
81template<typename XprType, int BlockRows=Dynamic, int BlockCols=Dynamic, bool InnerPanel = false> class Block;
82
83template<typename MatrixType, int Size=Dynamic> class VectorBlock;
84template<typename MatrixType> class Transpose;
85template<typename MatrixType> class Conjugate;
86template<typename NullaryOp, typename MatrixType> class CwiseNullaryOp;
87template<typename UnaryOp, typename MatrixType> class CwiseUnaryOp;
88template<typename ViewOp, typename MatrixType> class CwiseUnaryView;
89template<typename BinaryOp, typename Lhs, typename Rhs> class CwiseBinaryOp;
90template<typename TernaryOp, typename Arg1, typename Arg2, typename Arg3> class CwiseTernaryOp;
91template<typename Decomposition, typename Rhstype> class Solve;
92template<typename XprType> class Inverse;
93
94template<typename Lhs, typename Rhs, int Option = DefaultProduct> class Product;
95
96template<typename Derived> class DiagonalBase;
97template<typename _DiagonalVectorType> class DiagonalWrapper;
98template<typename _Scalar, int SizeAtCompileTime, int MaxSizeAtCompileTime=SizeAtCompileTime> class DiagonalMatrix;
99template<typename MatrixType, typename DiagonalType, int ProductOrder> class DiagonalProduct;
100template<typename MatrixType, int Index = 0> class Diagonal;
101template<int SizeAtCompileTime, int MaxSizeAtCompileTime = SizeAtCompileTime, typename IndexType=int> class PermutationMatrix;
102template<int SizeAtCompileTime, int MaxSizeAtCompileTime = SizeAtCompileTime, typename IndexType=int> class Transpositions;
103template<typename Derived> class PermutationBase;
104template<typename Derived> class TranspositionsBase;
105template<typename _IndicesType> class PermutationWrapper;
106template<typename _IndicesType> class TranspositionsWrapper;
107
108template<typename Derived,
109 int Level = internal::accessors_level<Derived>::has_write_access ? WriteAccessors : ReadOnlyAccessors
110> class MapBase;
111template<int InnerStrideAtCompileTime, int OuterStrideAtCompileTime> class Stride;
112template<int Value = Dynamic> class InnerStride;
113template<int Value = Dynamic> class OuterStride;
114template<typename MatrixType, int MapOptions=Unaligned, typename StrideType = Stride<0,0> > class Map;
115template<typename Derived> class RefBase;
116template<typename PlainObjectType, int Options = 0,
117 typename StrideType = typename internal::conditional<PlainObjectType::IsVectorAtCompileTime,InnerStride<1>,OuterStride<> >::type > class Ref;
118
119template<typename Derived> class TriangularBase;
120template<typename MatrixType, unsigned int Mode> class TriangularView;
121template<typename MatrixType, unsigned int Mode> class SelfAdjointView;
122template<typename MatrixType> class SparseView;
123template<typename ExpressionType> class WithFormat;
124template<typename MatrixType> struct CommaInitializer;
125template<typename Derived> class ReturnByValue;
126template<typename ExpressionType> class ArrayWrapper;
127template<typename ExpressionType> class MatrixWrapper;
128template<typename Derived> class SolverBase;
129template<typename XprType> class InnerIterator;
130
131namespace internal {
132template<typename DecompositionType> struct kernel_retval_base;
133template<typename DecompositionType> struct kernel_retval;
134template<typename DecompositionType> struct image_retval_base;
135template<typename DecompositionType> struct image_retval;
136} // end namespace internal
137
138namespace internal {
139template<typename _Scalar, int Rows=Dynamic, int Cols=Dynamic, int Supers=Dynamic, int Subs=Dynamic, int Options=0> class BandMatrix;
140}
141
142namespace internal {
143template<typename Lhs, typename Rhs> struct product_type;
144
145template<bool> struct EnableIf;
146
147/** \internal
148 * \class product_evaluator
149 * Products need their own evaluator with more template arguments allowing for
150 * easier partial template specializations.
151 */
152template< typename T,
153 int ProductTag = internal::product_type<typename T::Lhs,typename T::Rhs>::ret,
154 typename LhsShape = typename evaluator_traits<typename T::Lhs>::Shape,
155 typename RhsShape = typename evaluator_traits<typename T::Rhs>::Shape,
156 typename LhsScalar = typename traits<typename T::Lhs>::Scalar,
157 typename RhsScalar = typename traits<typename T::Rhs>::Scalar
158 > struct product_evaluator;
159}
160
161template<typename Lhs, typename Rhs,
162 int ProductType = internal::product_type<Lhs,Rhs>::value>
163struct ProductReturnType;
164
165// this is a workaround for sun CC
166template<typename Lhs, typename Rhs> struct LazyProductReturnType;
167
168namespace internal {
169
170// Provides scalar/packet-wise product and product with accumulation
171// with optional conjugation of the arguments.
172template<typename LhsScalar, typename RhsScalar, bool ConjLhs=false, bool ConjRhs=false> struct conj_helper;
173
174template<typename LhsScalar,typename RhsScalar=LhsScalar> struct scalar_sum_op;
175template<typename LhsScalar,typename RhsScalar=LhsScalar> struct scalar_difference_op;
176template<typename LhsScalar,typename RhsScalar=LhsScalar> struct scalar_conj_product_op;
177template<typename LhsScalar,typename RhsScalar=LhsScalar> struct scalar_min_op;
178template<typename LhsScalar,typename RhsScalar=LhsScalar> struct scalar_max_op;
179template<typename Scalar> struct scalar_opposite_op;
180template<typename Scalar> struct scalar_conjugate_op;
181template<typename Scalar> struct scalar_real_op;
182template<typename Scalar> struct scalar_imag_op;
183template<typename Scalar> struct scalar_abs_op;
184template<typename Scalar> struct scalar_abs2_op;
185template<typename Scalar> struct scalar_sqrt_op;
186template<typename Scalar> struct scalar_rsqrt_op;
187template<typename Scalar> struct scalar_exp_op;
188template<typename Scalar> struct scalar_log_op;
189template<typename Scalar> struct scalar_cos_op;
190template<typename Scalar> struct scalar_sin_op;
191template<typename Scalar> struct scalar_acos_op;
192template<typename Scalar> struct scalar_asin_op;
193template<typename Scalar> struct scalar_tan_op;
194template<typename Scalar> struct scalar_inverse_op;
195template<typename Scalar> struct scalar_square_op;
196template<typename Scalar> struct scalar_cube_op;
197template<typename Scalar, typename NewType> struct scalar_cast_op;
198template<typename Scalar> struct scalar_random_op;
199template<typename Scalar> struct scalar_constant_op;
200template<typename Scalar> struct scalar_identity_op;
201template<typename Scalar,bool iscpx> struct scalar_sign_op;
202template<typename Scalar,typename ScalarExponent> struct scalar_pow_op;
203template<typename LhsScalar,typename RhsScalar=LhsScalar> struct scalar_hypot_op;
204template<typename LhsScalar,typename RhsScalar=LhsScalar> struct scalar_product_op;
205template<typename LhsScalar,typename RhsScalar=LhsScalar> struct scalar_quotient_op;
206
207// SpecialFunctions module
208template<typename Scalar> struct scalar_lgamma_op;
209template<typename Scalar> struct scalar_digamma_op;
210template<typename Scalar> struct scalar_erf_op;
211template<typename Scalar> struct scalar_erfc_op;
212template<typename Scalar> struct scalar_igamma_op;
213template<typename Scalar> struct scalar_igammac_op;
214template<typename Scalar> struct scalar_zeta_op;
215template<typename Scalar> struct scalar_betainc_op;
216
217} // end namespace internal
218
219struct IOFormat;
220
221// Array module
222template<typename _Scalar, int _Rows, int _Cols,
223 int _Options = AutoAlign |
224#if EIGEN_GNUC_AT(3,4)
225 // workaround a bug in at least gcc 3.4.6
226 // the innermost ?: ternary operator is misparsed. We write it slightly
227 // differently and this makes gcc 3.4.6 happy, but it's ugly.
228 // The error would only show up with EIGEN_DEFAULT_TO_ROW_MAJOR is defined
229 // (when EIGEN_DEFAULT_MATRIX_STORAGE_ORDER_OPTION is RowMajor)
230 ( (_Rows==1 && _Cols!=1) ? Eigen::RowMajor
231 : !(_Cols==1 && _Rows!=1) ? EIGEN_DEFAULT_MATRIX_STORAGE_ORDER_OPTION
232 : Eigen::ColMajor ),
233#else
234 ( (_Rows==1 && _Cols!=1) ? Eigen::RowMajor
235 : (_Cols==1 && _Rows!=1) ? Eigen::ColMajor
236 : EIGEN_DEFAULT_MATRIX_STORAGE_ORDER_OPTION ),
237#endif
238 int _MaxRows = _Rows, int _MaxCols = _Cols> class Array;
239template<typename ConditionMatrixType, typename ThenMatrixType, typename ElseMatrixType> class Select;
240template<typename MatrixType, typename BinaryOp, int Direction> class PartialReduxExpr;
241template<typename ExpressionType, int Direction> class VectorwiseOp;
242template<typename MatrixType,int RowFactor,int ColFactor> class Replicate;
243template<typename MatrixType, int Direction = BothDirections> class Reverse;
244
245template<typename MatrixType> class FullPivLU;
246template<typename MatrixType> class PartialPivLU;
247namespace internal {
248template<typename MatrixType> struct inverse_impl;
249}
250template<typename MatrixType> class HouseholderQR;
251template<typename MatrixType> class ColPivHouseholderQR;
252template<typename MatrixType> class FullPivHouseholderQR;
253template<typename MatrixType> class CompleteOrthogonalDecomposition;
254template<typename MatrixType, int QRPreconditioner = ColPivHouseholderQRPreconditioner> class JacobiSVD;
255template<typename MatrixType> class BDCSVD;
256template<typename MatrixType, int UpLo = Lower> class LLT;
257template<typename MatrixType, int UpLo = Lower> class LDLT;
258template<typename VectorsType, typename CoeffsType, int Side=OnTheLeft> class HouseholderSequence;
259template<typename Scalar> class JacobiRotation;
260
261// Geometry module:
262template<typename Derived, int _Dim> class RotationBase;
263template<typename Lhs, typename Rhs> class Cross;
264template<typename Derived> class QuaternionBase;
265template<typename Scalar> class Rotation2D;
266template<typename Scalar> class AngleAxis;
267template<typename Scalar,int Dim> class Translation;
268template<typename Scalar,int Dim> class AlignedBox;
269template<typename Scalar, int Options = AutoAlign> class Quaternion;
270template<typename Scalar,int Dim,int Mode,int _Options=AutoAlign> class Transform;
271template <typename _Scalar, int _AmbientDim, int Options=AutoAlign> class ParametrizedLine;
272template <typename _Scalar, int _AmbientDim, int Options=AutoAlign> class Hyperplane;
273template<typename Scalar> class UniformScaling;
274template<typename MatrixType,int Direction> class Homogeneous;
275
276// Sparse module:
277template<typename Derived> class SparseMatrixBase;
278
279// MatrixFunctions module
280template<typename Derived> struct MatrixExponentialReturnValue;
281template<typename Derived> class MatrixFunctionReturnValue;
282template<typename Derived> class MatrixSquareRootReturnValue;
283template<typename Derived> class MatrixLogarithmReturnValue;
284template<typename Derived> class MatrixPowerReturnValue;
285template<typename Derived> class MatrixComplexPowerReturnValue;
286
287namespace internal {
288template <typename Scalar>
289struct stem_function
290{
291 typedef std::complex<typename NumTraits<Scalar>::Real> ComplexScalar;
292 typedef ComplexScalar type(ComplexScalar, int);
293};
294}
295
296} // end namespace Eigen
297
298#endif // EIGEN_FORWARDDECLARATIONS_H
299