From aae0667e1e120b5809a7e2fe442d67832ff9ed0f Mon Sep 17 00:00:00 2001 From: Benoit Jacob Date: Fri, 11 Jan 2008 07:16:18 +0000 Subject: [PATCH] reorganization/cleanup --- Eigen/Core | 5 ++- Eigen/src/Core/ForwardDeclarations.h | 64 ++++++++++++++++++++++++++++ Eigen/src/Core/MatrixBase.h | 2 +- Eigen/src/Core/Util.h | 45 ++----------------- 4 files changed, 72 insertions(+), 44 deletions(-) create mode 100644 Eigen/src/Core/ForwardDeclarations.h diff --git a/Eigen/Core b/Eigen/Core index e046c2dff..6c2589957 100644 --- a/Eigen/Core +++ b/Eigen/Core @@ -5,6 +5,7 @@ namespace Eigen { #include "src/Core/Util.h" +#include "src/Core/ForwardDeclarations.h" #include "src/Core/NumTraits.h" #include "src/Core/MathFunctions.h" #include "src/Core/MatrixBase.h" @@ -15,11 +16,11 @@ namespace Eigen { #include "src/Core/Matrix.h" #include "src/Core/Cast.h" #include "src/Core/Eval.h" -#include "src/Core/ScalarMultiple.h" #include "src/Core/Sum.h" #include "src/Core/Difference.h" -#include "src/Core/Product.h" #include "src/Core/Opposite.h" +#include "src/Core/ScalarMultiple.h" +#include "src/Core/Product.h" #include "src/Core/Row.h" #include "src/Core/Column.h" #include "src/Core/DynBlock.h" diff --git a/Eigen/src/Core/ForwardDeclarations.h b/Eigen/src/Core/ForwardDeclarations.h new file mode 100644 index 000000000..ea5d0dd36 --- /dev/null +++ b/Eigen/src/Core/ForwardDeclarations.h @@ -0,0 +1,64 @@ +// This file is part of Eigen, a lightweight C++ template library +// for linear algebra. Eigen itself is part of the KDE project. +// +// Copyright (C) 2006-2008 Benoit Jacob +// +// Eigen is free software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the Free Software +// Foundation; either version 2 or (at your option) any later version. +// +// Eigen is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +// FOR A PARTICULAR PURPOSE. See the GNU General Public License for more +// details. +// +// You should have received a copy of the GNU General Public License along +// with Eigen; if not, write to the Free Software Foundation, Inc., 51 +// Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. This exception does not invalidate any other reasons why a work +// based on this file might be covered by the GNU General Public License. + +#ifndef EIGEN_FORWARDDECLARATIONS_H +#define EIGEN_FORWARDDECLARATIONS_H + +template class Matrix; +template class MatrixRef; +template class Cast; +template class Row; +template class Column; +template class Minor; +template class DynBlock; +template class Block; +template class Transpose; +template class Conjugate; +template class Opposite; +template class Sum; +template class Difference; +template class Product; +template class ScalarMultiple; +template class Random; +template class Zero; +template class Ones; +template class DiagonalMatrix; +template class DiagonalCoeffs; +template class Identity; +template class Eval; +template class Map; + +template struct Reference +{ + typedef T Type; +}; + +template +struct Reference > +{ + typedef MatrixRef > Type; +}; + +#endif // EIGEN_FORWARDDECLARATIONS_H diff --git a/Eigen/src/Core/MatrixBase.h b/Eigen/src/Core/MatrixBase.h index c817cf4de..8d9bd6491 100644 --- a/Eigen/src/Core/MatrixBase.h +++ b/Eigen/src/Core/MatrixBase.h @@ -96,7 +96,7 @@ template class MatrixBase * other hand, this MatrixBase type is an actual matrix or vector type, then \a Ref is * a typedef to MatrixRef, which works as a reference, so that matrices and vectors * are passed by reference, not by value. \sa ref()*/ - typedef typename ForwardDecl::Ref Ref; + typedef typename Reference::Type Ref; /** This is the "real scalar" type; if the \a Scalar type is already real numbers * (e.g. int, float or double) then \a RealScalar is just the same as \a Scalar. If diff --git a/Eigen/src/Core/Util.h b/Eigen/src/Core/Util.h index 72b355530..91e51a476 100644 --- a/Eigen/src/Core/Util.h +++ b/Eigen/src/Core/Util.h @@ -58,9 +58,9 @@ using Eigen::MatrixBase; #endif #ifdef __GNUC__ -# define EIGEN_ALWAYS_INLINE __attribute__((always_inline)) +#define EIGEN_ALWAYS_INLINE __attribute__((always_inline)) #else -# define EIGEN_ALWAYS_INLINE +#define EIGEN_ALWAYS_INLINE #endif #define EIGEN_INHERIT_ASSIGNMENT_OPERATOR(Derived, Op) \ @@ -88,48 +88,11 @@ EIGEN_INHERIT_ASSIGNMENT_OPERATOR(Derived, -=) \ EIGEN_INHERIT_SCALAR_ASSIGNMENT_OPERATOR(Derived, *=) \ EIGEN_INHERIT_SCALAR_ASSIGNMENT_OPERATOR(Derived, /=) -const int Dynamic = -1; -const int Generic = -2; +const int Dynamic = -10; +const int Generic = -20; const int ColumnMajor = 0; const int RowMajor = 1; -//forward declarations -template - class Matrix; -template class MatrixRef; -template class Cast; -template class Row; -template class Column; -template class Minor; -template class DynBlock; -template class Block; -template class Transpose; -template class Conjugate; -template class Opposite; -template class Sum; -template class Difference; -template class Product; -template class ScalarMultiple; -template class Random; -template class Zero; -template class Ones; -template class DiagonalMatrix; -template class DiagonalCoeffs; -template class Identity; -template class Eval; -template class Map; - -template struct ForwardDecl -{ - typedef T Ref; -}; - -template -struct ForwardDecl > -{ - typedef MatrixRef > Ref; -}; - //classes inheriting NoOperatorEquals don't generate a default operator=. class NoOperatorEquals {