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