diff options
author | Gael Guennebaud <g.gael@free.fr> | 2008-03-04 12:34:58 +0000 |
---|---|---|
committer | Gael Guennebaud <g.gael@free.fr> | 2008-03-04 12:34:58 +0000 |
commit | f65cca5d1d28cff4880026d48a9e95b279bed3e3 (patch) | |
tree | 33b8efd96071734e14fd83bdbc2886d4e76550b3 /Eigen/src | |
parent | 46885d33bfd6cdcf3040923a4aef1b059684b854 (diff) |
* Eigen compiles with any GCC versions from, at least, 3.3 without the previous ugly hack :)
* Renamed the scalar functors with the "Scalar" prefix (instead of "Cwise")
Diffstat (limited to 'Eigen/src')
-rw-r--r-- | Eigen/src/Core/Block.h | 5 | ||||
-rw-r--r-- | Eigen/src/Core/Cast.h | 15 | ||||
-rw-r--r-- | Eigen/src/Core/Column.h | 21 | ||||
-rw-r--r-- | Eigen/src/Core/CwiseBinaryOp.h | 23 | ||||
-rw-r--r-- | Eigen/src/Core/CwiseUnaryOp.h | 21 | ||||
-rw-r--r-- | Eigen/src/Core/DiagonalCoeffs.h | 17 | ||||
-rw-r--r-- | Eigen/src/Core/DiagonalMatrix.h | 15 | ||||
-rw-r--r-- | Eigen/src/Core/ForwardDeclarations.h | 11 | ||||
-rw-r--r-- | Eigen/src/Core/Identity.h | 15 | ||||
-rw-r--r-- | Eigen/src/Core/Map.h | 17 | ||||
-rw-r--r-- | Eigen/src/Core/Matrix.h | 35 | ||||
-rw-r--r-- | Eigen/src/Core/MatrixBase.h | 75 | ||||
-rw-r--r-- | Eigen/src/Core/MatrixRef.h | 11 | ||||
-rw-r--r-- | Eigen/src/Core/Minor.h | 19 | ||||
-rw-r--r-- | Eigen/src/Core/Ones.h | 15 | ||||
-rw-r--r-- | Eigen/src/Core/Product.h | 15 | ||||
-rw-r--r-- | Eigen/src/Core/Random.h | 17 | ||||
-rw-r--r-- | Eigen/src/Core/Row.h | 21 | ||||
-rw-r--r-- | Eigen/src/Core/ScalarMultiple.h | 67 | ||||
-rw-r--r-- | Eigen/src/Core/Transpose.h | 23 | ||||
-rw-r--r-- | Eigen/src/Core/Zero.h | 15 |
21 files changed, 247 insertions, 226 deletions
diff --git a/Eigen/src/Core/Block.h b/Eigen/src/Core/Block.h index 288a8782a..5c1827c43 100644 --- a/Eigen/src/Core/Block.h +++ b/Eigen/src/Core/Block.h @@ -6,12 +6,12 @@ // // Eigen is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either +// License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // // Alternatively, 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 of +// published by the Free Software Foundation; either version 2 of // the License, or (at your option) any later version. // // Eigen is distributed in the hope that it will be useful, but WITHOUT ANY @@ -65,6 +65,7 @@ template<typename MatrixType, typedef typename MatrixType::Scalar Scalar; typedef typename MatrixType::Ref MatRef; friend class MatrixBase<Scalar, Block>; + friend class MatrixBase<Scalar, Block>::Traits; typedef MatrixBase<Scalar, Block> Base; /** Fixed-size constructor diff --git a/Eigen/src/Core/Cast.h b/Eigen/src/Core/Cast.h index 42c0a7f0f..cc67ce5d8 100644 --- a/Eigen/src/Core/Cast.h +++ b/Eigen/src/Core/Cast.h @@ -5,12 +5,12 @@ // // Eigen is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either +// License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // // Alternatively, 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 of +// published by the Free Software Foundation; either version 2 of // the License, or (at your option) any later version. // // Eigen is distributed in the hope that it will be useful, but WITHOUT ANY @@ -18,7 +18,7 @@ // FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License or the // GNU General Public License for more details. // -// You should have received a copy of the GNU Lesser General Public +// You should have received a copy of the GNU Lesser General Public // License and a copy of the GNU General Public License along with // Eigen. If not, see <http://www.gnu.org/licenses/>. @@ -52,10 +52,11 @@ template<typename NewScalar, typename MatrixType> class Cast : NoOperatorEquals, typedef NewScalar Scalar; typedef typename MatrixType::Ref MatRef; friend class MatrixBase<Scalar, Cast>; + friend class MatrixBase<Scalar, Cast>::Traits; typedef MatrixBase<Scalar, Cast> Base; - + Cast(const MatRef& matrix) : m_matrix(matrix) {} - + private: enum { RowsAtCompileTime = MatrixType::Traits::RowsAtCompileTime, @@ -66,12 +67,12 @@ template<typename NewScalar, typename MatrixType> class Cast : NoOperatorEquals, const Cast& _ref() const { return *this; } int _rows() const { return m_matrix.rows(); } int _cols() const { return m_matrix.cols(); } - + NewScalar _coeff(int row, int col) const { return static_cast<NewScalar>(m_matrix.coeff(row, col)); } - + protected: const MatRef m_matrix; }; diff --git a/Eigen/src/Core/Column.h b/Eigen/src/Core/Column.h index 37d959743..bece3caa7 100644 --- a/Eigen/src/Core/Column.h +++ b/Eigen/src/Core/Column.h @@ -5,12 +5,12 @@ // // Eigen is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either +// License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // // Alternatively, 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 of +// published by the Free Software Foundation; either version 2 of // the License, or (at your option) any later version. // // Eigen is distributed in the hope that it will be useful, but WITHOUT ANY @@ -18,7 +18,7 @@ // FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License or the // GNU General Public License for more details. // -// You should have received a copy of the GNU Lesser General Public +// You should have received a copy of the GNU Lesser General Public // License and a copy of the GNU General Public License along with // Eigen. If not, see <http://www.gnu.org/licenses/>. @@ -52,16 +52,17 @@ template<typename MatrixType> class Column typedef typename MatrixType::Scalar Scalar; typedef typename MatrixType::Ref MatRef; friend class MatrixBase<Scalar, Column>; + friend class MatrixBase<Scalar, Column>::Traits; typedef MatrixBase<Scalar, Column> Base; - + Column(const MatRef& matrix, int col) : m_matrix(matrix), m_col(col) { assert(col >= 0 && col < matrix.cols()); } - + EIGEN_INHERIT_ASSIGNMENT_OPERATORS(Column) - + private: enum { RowsAtCompileTime = MatrixType::Traits::RowsAtCompileTime, @@ -69,21 +70,21 @@ template<typename MatrixType> class Column MaxRowsAtCompileTime = MatrixType::Traits::MaxRowsAtCompileTime, MaxColsAtCompileTime = 1 }; - + const Column& _ref() const { return *this; } int _rows() const { return m_matrix.rows(); } int _cols() const { return 1; } - + Scalar& _coeffRef(int row, int) { return m_matrix.coeffRef(row, m_col); } - + Scalar _coeff(int row, int) const { return m_matrix.coeff(row, m_col); } - + protected: MatRef m_matrix; const int m_col; diff --git a/Eigen/src/Core/CwiseBinaryOp.h b/Eigen/src/Core/CwiseBinaryOp.h index b06163c39..571c0ebad 100644 --- a/Eigen/src/Core/CwiseBinaryOp.h +++ b/Eigen/src/Core/CwiseBinaryOp.h @@ -6,12 +6,12 @@ // // Eigen is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either +// License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // // Alternatively, 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 of +// published by the Free Software Foundation; either version 2 of // the License, or (at your option) any later version. // // Eigen is distributed in the hope that it will be useful, but WITHOUT ANY @@ -44,7 +44,7 @@ * Here is an example illustrating this: * \include class_CwiseBinaryOp.cpp * - * \sa class CwiseProductOp, class CwiseQuotientOp + * \sa class ScalarProductOp, class ScalarQuotientOp */ template<typename BinaryOp, typename Lhs, typename Rhs> class CwiseBinaryOp : NoOperatorEquals, @@ -55,6 +55,7 @@ class CwiseBinaryOp : NoOperatorEquals, typedef typename Lhs::Ref LhsRef; typedef typename Rhs::Ref RhsRef; friend class MatrixBase<Scalar, CwiseBinaryOp>; + friend class MatrixBase<Scalar, CwiseBinaryOp>::Traits; typedef MatrixBase<Scalar, CwiseBinaryOp> Base; CwiseBinaryOp(const LhsRef& lhs, const RhsRef& rhs) @@ -79,7 +80,7 @@ class CwiseBinaryOp : NoOperatorEquals, { return BinaryOp::template op<Scalar>(m_lhs.coeff(row, col), m_rhs.coeff(row, col)); } - + protected: const LhsRef m_lhs; const RhsRef m_rhs; @@ -105,7 +106,7 @@ struct CwiseDifferenceOp { * * \sa class CwiseBinaryOp, MatrixBase::cwiseProduct() */ -struct CwiseProductOp { +struct ScalarProductOp { template<typename Scalar> static Scalar op(const Scalar& a, const Scalar& b) { return a * b; } }; @@ -113,7 +114,7 @@ struct CwiseProductOp { * * \sa class CwiseBinaryOp, MatrixBase::cwiseQuotient() */ -struct CwiseQuotientOp { +struct ScalarQuotientOp { template<typename Scalar> static Scalar op(const Scalar& a, const Scalar& b) { return a / b; } }; @@ -175,10 +176,10 @@ MatrixBase<Scalar, Derived>::operator+=(const MatrixBase<Scalar, OtherDerived>& */ template<typename Scalar, typename Derived> template<typename OtherDerived> -const CwiseBinaryOp<CwiseProductOp, Derived, OtherDerived> +const CwiseBinaryOp<ScalarProductOp, Derived, OtherDerived> MatrixBase<Scalar, Derived>::cwiseProduct(const MatrixBase<Scalar, OtherDerived> &other) const { - return CwiseBinaryOp<CwiseProductOp, Derived, OtherDerived>(ref(), other.ref()); + return CwiseBinaryOp<ScalarProductOp, Derived, OtherDerived>(ref(), other.ref()); } @@ -188,10 +189,10 @@ MatrixBase<Scalar, Derived>::cwiseProduct(const MatrixBase<Scalar, OtherDerived> */ template<typename Scalar, typename Derived> template<typename OtherDerived> -const CwiseBinaryOp<CwiseQuotientOp, Derived, OtherDerived> +const CwiseBinaryOp<ScalarQuotientOp, Derived, OtherDerived> MatrixBase<Scalar, Derived>::cwiseQuotient(const MatrixBase<Scalar, OtherDerived> &other) const { - return CwiseBinaryOp<CwiseQuotientOp, Derived, OtherDerived>(ref(), other.ref()); + return CwiseBinaryOp<ScalarQuotientOp, Derived, OtherDerived>(ref(), other.ref()); } @@ -220,7 +221,7 @@ cwise(const MatrixBase<Scalar, Derived1> &mat1, const MatrixBase<Scalar, Derived * the keyword template as to be used if the matrix type is also a template parameter: * \code * template <typename MatrixType> void foo(const MatrixType& m1, const MatrixType& m2) { - * m1.template cwise<CwiseProductOp>(m2); + * m1.template cwise<ScalarProductOp>(m2); * } * \endcode * diff --git a/Eigen/src/Core/CwiseUnaryOp.h b/Eigen/src/Core/CwiseUnaryOp.h index 27e8c288f..e3eb9090f 100644 --- a/Eigen/src/Core/CwiseUnaryOp.h +++ b/Eigen/src/Core/CwiseUnaryOp.h @@ -47,6 +47,7 @@ class CwiseUnaryOp : NoOperatorEquals, typedef typename MatrixType::Scalar Scalar; typedef typename MatrixType::Ref MatRef; friend class MatrixBase<Scalar, CwiseUnaryOp>; + friend class MatrixBase<Scalar, CwiseUnaryOp>::Traits; typedef MatrixBase<Scalar, CwiseUnaryOp> Base; CwiseUnaryOp(const MatRef& mat) : m_matrix(mat) {} @@ -76,7 +77,7 @@ class CwiseUnaryOp : NoOperatorEquals, * * \sa class CwiseUnaryOp, MatrixBase::operator- */ -struct CwiseOppositeOp { +struct ScalarOppositeOp { template<typename Scalar> static Scalar op(const Scalar& a) { return -a; } }; @@ -84,7 +85,7 @@ struct CwiseOppositeOp { * * \sa class CwiseUnaryOp, MatrixBase::cwiseAbs */ -struct CwiseAbsOp { +struct ScalarAbsOp { template<typename Scalar> static Scalar op(const Scalar& a) { return ei_abs(a); } }; @@ -92,19 +93,19 @@ struct CwiseAbsOp { /** \returns an expression of the opposite of \c *this */ template<typename Scalar, typename Derived> -const CwiseUnaryOp<CwiseOppositeOp,Derived> +const CwiseUnaryOp<ScalarOppositeOp,Derived> MatrixBase<Scalar, Derived>::operator-() const { - return CwiseUnaryOp<CwiseOppositeOp,Derived>(ref()); + return CwiseUnaryOp<ScalarOppositeOp,Derived>(ref()); } /** \returns an expression of the opposite of \c *this */ template<typename Scalar, typename Derived> -const CwiseUnaryOp<CwiseAbsOp,Derived> +const CwiseUnaryOp<ScalarAbsOp,Derived> MatrixBase<Scalar, Derived>::cwiseAbs() const { - return CwiseUnaryOp<CwiseAbsOp,Derived>(ref()); + return CwiseUnaryOp<ScalarAbsOp,Derived>(ref()); } @@ -133,7 +134,7 @@ cwise(const MatrixBase<Scalar, Derived> &mat) * the keyword template as to be used if the matrix type is also a template parameter: * \code * template <typename MatrixType> void foo(const MatrixType& m) { - * m.template cwise<CwiseAbsOp>(); + * m.template cwise<ScalarAbsOp>(); * } * \endcode * @@ -152,7 +153,7 @@ MatrixBase<Scalar, Derived>::cwise() const * * \sa class CwiseUnaryOp, MatrixBase::conjugate() */ -struct ConjugateOp { +struct ScalarConjugateOp { template<typename Scalar> static Scalar op(const Scalar& a) { return ei_conj(a); } }; @@ -160,10 +161,10 @@ struct ConjugateOp { * * \sa adjoint(), class Conjugate */ template<typename Scalar, typename Derived> -const CwiseUnaryOp<ConjugateOp, Derived> +const CwiseUnaryOp<ScalarConjugateOp, Derived> MatrixBase<Scalar, Derived>::conjugate() const { - return CwiseUnaryOp<ConjugateOp, Derived>(ref()); + return CwiseUnaryOp<ScalarConjugateOp, Derived>(ref()); } diff --git a/Eigen/src/Core/DiagonalCoeffs.h b/Eigen/src/Core/DiagonalCoeffs.h index 9baee22b6..291bfe472 100644 --- a/Eigen/src/Core/DiagonalCoeffs.h +++ b/Eigen/src/Core/DiagonalCoeffs.h @@ -5,12 +5,12 @@ // // Eigen is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either +// License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // // Alternatively, 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 of +// published by the Free Software Foundation; either version 2 of // the License, or (at your option) any later version. // // Eigen is distributed in the hope that it will be useful, but WITHOUT ANY @@ -18,7 +18,7 @@ // FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License or the // GNU General Public License for more details. // -// You should have received a copy of the GNU Lesser General Public +// You should have received a copy of the GNU Lesser General Public // License and a copy of the GNU General Public License along with // Eigen. If not, see <http://www.gnu.org/licenses/>. @@ -44,12 +44,13 @@ template<typename MatrixType> class DiagonalCoeffs typedef typename MatrixType::Scalar Scalar; typedef typename MatrixType::Ref MatRef; friend class MatrixBase<Scalar, DiagonalCoeffs>; + friend class MatrixBase<Scalar, DiagonalCoeffs>::Traits; typedef MatrixBase<Scalar, DiagonalCoeffs> Base; DiagonalCoeffs(const MatRef& matrix) : m_matrix(matrix) {} - + EIGEN_INHERIT_ASSIGNMENT_OPERATORS(DiagonalCoeffs) - + private: enum { RowsAtCompileTime = MatrixType::Traits::SizeAtCompileTime == Dynamic ? Dynamic @@ -65,17 +66,17 @@ template<typename MatrixType> class DiagonalCoeffs const DiagonalCoeffs& _ref() const { return *this; } int _rows() const { return std::min(m_matrix.rows(), m_matrix.cols()); } int _cols() const { return 1; } - + Scalar& _coeffRef(int row, int) { return m_matrix.coeffRef(row, row); } - + Scalar _coeff(int row, int) const { return m_matrix.coeff(row, row); } - + protected: MatRef m_matrix; }; diff --git a/Eigen/src/Core/DiagonalMatrix.h b/Eigen/src/Core/DiagonalMatrix.h index 11106ea75..6cfd910c6 100644 --- a/Eigen/src/Core/DiagonalMatrix.h +++ b/Eigen/src/Core/DiagonalMatrix.h @@ -5,12 +5,12 @@ // // Eigen is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either +// License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // // Alternatively, 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 of +// published by the Free Software Foundation; either version 2 of // the License, or (at your option) any later version. // // Eigen is distributed in the hope that it will be useful, but WITHOUT ANY @@ -18,7 +18,7 @@ // FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License or the // GNU General Public License for more details. // -// You should have received a copy of the GNU Lesser General Public +// You should have received a copy of the GNU Lesser General Public // License and a copy of the GNU General Public License along with // Eigen. If not, see <http://www.gnu.org/licenses/>. @@ -47,6 +47,7 @@ class DiagonalMatrix : NoOperatorEquals, typedef typename CoeffsVectorType::Scalar Scalar; typedef typename CoeffsVectorType::Ref CoeffsVecRef; friend class MatrixBase<Scalar, DiagonalMatrix>; + friend class MatrixBase<Scalar, DiagonalMatrix>::Traits; typedef MatrixBase<Scalar, DiagonalMatrix> Base; DiagonalMatrix(const CoeffsVecRef& coeffs) : m_coeffs(coeffs) @@ -54,7 +55,7 @@ class DiagonalMatrix : NoOperatorEquals, assert(CoeffsVectorType::Traits::IsVectorAtCompileTime && coeffs.size() > 0); } - + private: enum { RowsAtCompileTime = CoeffsVectorType::Traits::SizeAtCompileTime, @@ -62,16 +63,16 @@ class DiagonalMatrix : NoOperatorEquals, MaxRowsAtCompileTime = CoeffsVectorType::Traits::MaxSizeAtCompileTime, MaxColsAtCompileTime = CoeffsVectorType::Traits::MaxSizeAtCompileTime }; - + const DiagonalMatrix& _ref() const { return *this; } int _rows() const { return m_coeffs.size(); } int _cols() const { return m_coeffs.size(); } - + Scalar _coeff(int row, int col) const { return row == col ? m_coeffs.coeff(row) : static_cast<Scalar>(0); } - + protected: const CoeffsVecRef m_coeffs; }; diff --git a/Eigen/src/Core/ForwardDeclarations.h b/Eigen/src/Core/ForwardDeclarations.h index 6935c030f..6ed9dacfe 100644 --- a/Eigen/src/Core/ForwardDeclarations.h +++ b/Eigen/src/Core/ForwardDeclarations.h @@ -35,12 +35,7 @@ template<typename MatrixType, int BlockRows=Dynamic, int BlockCols=Dynamic> clas template<typename MatrixType> class Transpose; template<typename MatrixType> class Conjugate; template<typename BinaryOp, typename Lhs, typename Rhs> class CwiseBinaryOp; -struct CwiseProductOp; -struct CwiseQuotientOp; template<typename UnaryOp, typename MatrixType> class CwiseUnaryOp; -struct CwiseOppositeOp; -struct ConjugateOp; -struct CwiseAbsOp; template<typename Lhs, typename Rhs> class Product; template<typename MatrixType> class ScalarMultiple; template<typename MatrixType> class Random; @@ -52,6 +47,12 @@ template<typename MatrixType> class Identity; template<typename MatrixType> class Map; template<typename Derived> class Eval; +struct ScalarProductOp; +struct ScalarQuotientOp; +struct ScalarOppositeOp; +struct ScalarConjugateOp; +struct ScalarAbsOp; + template<typename T> struct Reference { typedef T Type; diff --git a/Eigen/src/Core/Identity.h b/Eigen/src/Core/Identity.h index fbe1479a4..a057e915b 100644 --- a/Eigen/src/Core/Identity.h +++ b/Eigen/src/Core/Identity.h @@ -5,12 +5,12 @@ // // Eigen is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either +// License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // // Alternatively, 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 of +// published by the Free Software Foundation; either version 2 of // the License, or (at your option) any later version. // // Eigen is distributed in the hope that it will be useful, but WITHOUT ANY @@ -18,7 +18,7 @@ // FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License or the // GNU General Public License for more details. // -// You should have received a copy of the GNU Lesser General Public +// You should have received a copy of the GNU Lesser General Public // License and a copy of the GNU General Public License along with // Eigen. If not, see <http://www.gnu.org/licenses/>. @@ -37,6 +37,7 @@ template<typename MatrixType> class Identity : NoOperatorEquals, public: typedef typename MatrixType::Scalar Scalar; friend class MatrixBase<Scalar, Identity>; + friend class MatrixBase<Scalar, Identity>::Traits; typedef MatrixBase<Scalar, Identity> Base; Identity(int rows, int cols) : m_rows(rows), m_cols(cols) @@ -46,7 +47,7 @@ template<typename MatrixType> class Identity : NoOperatorEquals, && cols > 0 && (ColsAtCompileTime == Dynamic || ColsAtCompileTime == cols)); } - + private: enum { RowsAtCompileTime = MatrixType::Traits::RowsAtCompileTime, @@ -54,16 +55,16 @@ template<typename MatrixType> class Identity : NoOperatorEquals, MaxRowsAtCompileTime = MatrixType::Traits::MaxRowsAtCompileTime, MaxColsAtCompileTime = MatrixType::Traits::MaxColsAtCompileTime }; - + const Identity& _ref() const { return *this; } int _rows() const { return m_rows.value(); } int _cols() const { return m_cols.value(); } - + Scalar _coeff(int row, int col) const { return row == col ? static_cast<Scalar>(1) : static_cast<Scalar>(0); } - + protected: const IntAtRunTimeIfDynamic<RowsAtCompileTime> m_rows; const IntAtRunTimeIfDynamic<ColsAtCompileTime> m_cols; diff --git a/Eigen/src/Core/Map.h b/Eigen/src/Core/Map.h index 352703a12..b3160396a 100644 --- a/Eigen/src/Core/Map.h +++ b/Eigen/src/Core/Map.h @@ -5,12 +5,12 @@ // // Eigen is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either +// License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // // Alternatively, 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 of +// published by the Free Software Foundation; either version 2 of // the License, or (at your option) any later version. // // Eigen is distributed in the hope that it will be useful, but WITHOUT ANY @@ -18,7 +18,7 @@ // FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License or the // GNU General Public License for more details. // -// You should have received a copy of the GNU Lesser General Public +// You should have received a copy of the GNU Lesser General Public // License and a copy of the GNU General Public License along with // Eigen. If not, see <http://www.gnu.org/licenses/>. @@ -44,6 +44,7 @@ template<typename MatrixType> class Map public: typedef typename MatrixType::Scalar Scalar; friend class MatrixBase<Scalar, Map>; + friend class MatrixBase<Scalar, Map>::Traits; typedef MatrixBase<Scalar, Map> Base; private: @@ -58,7 +59,7 @@ template<typename MatrixType> class Map const Map& _ref() const { return *this; } int _rows() const { return m_rows; } int _cols() const { return m_cols; } - + const Scalar& _coeff(int row, int col) const { if(Order == ColumnMajor) @@ -66,7 +67,7 @@ template<typename MatrixType> class Map else // RowMajor return m_data[col + row * m_cols]; } - + Scalar& _coeffRef(int row, int col) { if(Order == ColumnMajor) @@ -74,7 +75,7 @@ template<typename MatrixType> class Map else // RowMajor return const_cast<Scalar*>(m_data)[col + row * m_cols]; } - + public: Map(const Scalar* data, int rows, int cols) : m_data(data), m_rows(rows), m_cols(cols) { @@ -83,9 +84,9 @@ template<typename MatrixType> class Map && cols > 0 && (ColsAtCompileTime == Dynamic || ColsAtCompileTime == cols)); } - + EIGEN_INHERIT_ASSIGNMENT_OPERATORS(Map) - + protected: const Scalar* m_data; const int m_rows, m_cols; diff --git a/Eigen/src/Core/Matrix.h b/Eigen/src/Core/Matrix.h index 29d3066d7..bfb6d5f65 100644 --- a/Eigen/src/Core/Matrix.h +++ b/Eigen/src/Core/Matrix.h @@ -5,12 +5,12 @@ // // Eigen is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either +// License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // // Alternatively, 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 of +// published by the Free Software Foundation; either version 2 of // the License, or (at your option) any later version. // // Eigen is distributed in the hope that it will be useful, but WITHOUT ANY @@ -18,7 +18,7 @@ // FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License or the // GNU General Public License for more details. // -// You should have received a copy of the GNU Lesser General Public +// You should have received a copy of the GNU Lesser General Public // License and a copy of the GNU General Public License along with // Eigen. If not, see <http://www.gnu.org/licenses/>. @@ -79,13 +79,14 @@ class Matrix : public MatrixBase<_Scalar, Matrix<_Scalar, _Rows, _Cols, { public: friend class MatrixBase<_Scalar, Matrix>; + friend class MatrixBase<_Scalar, Matrix>::Traits; friend class Map<Matrix>; - + typedef MatrixBase<_Scalar, Matrix> Base; typedef _Scalar Scalar; typedef MatrixRef<Matrix> Ref; friend class MatrixRef<Matrix>; - + private: enum { RowsAtCompileTime = _Rows, @@ -103,7 +104,7 @@ class Matrix : public MatrixBase<_Scalar, Matrix<_Scalar, _Rows, _Cols, Ref _ref() const { return Ref(*this); } int _rows() const { return m_storage.rows(); } int _cols() const { return m_storage.cols(); } - + const Scalar& _coeff(int row, int col) const { if(StorageOrder == ColumnMajor) @@ -111,7 +112,7 @@ class Matrix : public MatrixBase<_Scalar, Matrix<_Scalar, _Rows, _Cols, else // RowMajor return m_storage.data()[col + row * m_storage.cols()]; } - + Scalar& _coeffRef(int row, int col) { if(StorageOrder == ColumnMajor) @@ -119,12 +120,12 @@ class Matrix : public MatrixBase<_Scalar, Matrix<_Scalar, _Rows, _Cols, else // RowMajor return m_storage.data()[col + row * m_storage.cols()]; } - + public: /** \returns a const pointer to the data array of this matrix */ const Scalar *data() const { return m_storage.data(); } - + /** \returns a pointer to the data array of this matrix */ Scalar *data() { return m_storage.data(); } @@ -148,7 +149,7 @@ class Matrix : public MatrixBase<_Scalar, Matrix<_Scalar, _Rows, _Cols, * is allowed. The resizing, if any, is then done in the appropriate way so that * row-vectors remain row-vectors and vectors remain vectors. */ - template<typename OtherDerived> + template<typename OtherDerived> Matrix& operator=(const MatrixBase<Scalar, OtherDerived>& other) { if(RowsAtCompileTime == 1) @@ -164,7 +165,7 @@ class Matrix : public MatrixBase<_Scalar, Matrix<_Scalar, _Rows, _Cols, else resize(other.rows(), other.cols()); return Base::operator=(other); } - + /** This is a special case of the templated operator=. Its purpose is to * prevent a default operator= from hiding the templated operator=. */ @@ -172,19 +173,19 @@ class Matrix : public MatrixBase<_Scalar, Matrix<_Scalar, _Rows, _Cols, { return operator=<Matrix>(other); } - + EIGEN_INHERIT_ASSIGNMENT_OPERATOR(Matrix, +=) EIGEN_INHERIT_ASSIGNMENT_OPERATOR(Matrix, -=) EIGEN_INHERIT_SCALAR_ASSIGNMENT_OPERATOR(Matrix, *=) EIGEN_INHERIT_SCALAR_ASSIGNMENT_OPERATOR(Matrix, /=) - + static const Map<Matrix> map(const Scalar* array, int rows, int cols); static const Map<Matrix> map(const Scalar* array, int size); static const Map<Matrix> map(const Scalar* array); static Map<Matrix> map(Scalar* array, int rows, int cols); static Map<Matrix> map(Scalar* array, int size); static Map<Matrix> map(Scalar* array); - + /** Default constructor, does nothing. Only for fixed-size matrices. * For dynamic-size matrices and vectors, this constructor is forbidden (guarded by * an assertion) because it would leave the matrix without an allocated data buffer. @@ -193,7 +194,7 @@ class Matrix : public MatrixBase<_Scalar, Matrix<_Scalar, _Rows, _Cols, { assert(RowsAtCompileTime > 0 && ColsAtCompileTime > 0); } - + /** Constructs a vector or row-vector with given dimension. \only_for_vectors * * Note that this is only useful for dynamic-size vectors. For fixed-size vectors, @@ -208,7 +209,7 @@ class Matrix : public MatrixBase<_Scalar, Matrix<_Scalar, _Rows, _Cols, || (ColsAtCompileTime == 1 && (RowsAtCompileTime == Dynamic || RowsAtCompileTime == dim))); } - + /** This constructor has two very different behaviors, depending on the type of *this. * * \li When Matrix is a fixed-size vector type of size 2, this constructor constructs @@ -271,7 +272,7 @@ class Matrix : public MatrixBase<_Scalar, Matrix<_Scalar, _Rows, _Cols, Matrix(const Scalar *data, int rows, int cols); Matrix(const Scalar *data, int size); explicit Matrix(const Scalar *data); - + /** Constructor copying the value of the expression \a other */ template<typename OtherDerived> Matrix(const MatrixBase<Scalar, OtherDerived>& other) diff --git a/Eigen/src/Core/MatrixBase.h b/Eigen/src/Core/MatrixBase.h index 102b14529..7d401e96c 100644 --- a/Eigen/src/Core/MatrixBase.h +++ b/Eigen/src/Core/MatrixBase.h @@ -143,8 +143,8 @@ template<typename Scalar, typename Derived> class MatrixBase * \sa class NumTraits */ typedef typename NumTraits<Scalar>::Real RealScalar; - - /// \name a - matrix properties + + /// \name matrix properties //@{ /** \returns the number of rows. \sa cols(), Traits::RowsAtCompileTime */ int rows() const { return static_cast<const Derived *>(this)->_rows(); } @@ -163,12 +163,12 @@ template<typename Scalar, typename Derived> class MatrixBase /** \returns a Ref to *this. \sa Ref */ Ref ref() const { return static_cast<const Derived *>(this)->_ref(); } - + //@{ /** Copies \a other into *this. \returns a reference to *this. */ template<typename OtherDerived> Derived& operator=(const MatrixBase<Scalar, OtherDerived>& other); - + /** Special case of the template operator=, in order to prevent the compiler * from generating a default operator= (issue hit with g++ 4.1) */ @@ -176,7 +176,7 @@ template<typename Scalar, typename Derived> class MatrixBase { return this->operator=<Derived>(other); } - + /** swaps *this with the expression \a other. * * \note \a other is only marked const because I couln't find another way @@ -186,22 +186,22 @@ template<typename Scalar, typename Derived> class MatrixBase template<typename OtherDerived> void swap(const MatrixBase<Scalar, OtherDerived>& other); //@} - - /// \name c - sub-matrices + + /// \name sub-matrices //@{ Row<Derived> row(int i); const Row<Derived> row(int i) const; - + Column<Derived> col(int i); const Column<Derived> col(int i) const; - + Minor<Derived> minor(int row, int col); const Minor<Derived> minor(int row, int col) const; - + Block<Derived> block(int startRow, int startCol, int blockRows, int blockCols); const Block<Derived> block(int startRow, int startCol, int blockRows, int blockCols) const; - + Block<Derived> block(int start, int size); const Block<Derived> block(int start, int size) const; @@ -223,7 +223,7 @@ template<typename Scalar, typename Derived> class MatrixBase const DiagonalCoeffs<Derived> diagonal() const; //@} - /// \name d - matrix transformation + /// \name matrix transformation //@{ template<typename NewScalar> const Cast<NewScalar, Derived> cast() const; @@ -231,23 +231,24 @@ template<typename Scalar, typename Derived> class MatrixBase Transpose<Derived> transpose(); const Transpose<Derived> transpose() const; - - const CwiseUnaryOp<ConjugateOp, Derived> conjugate() const; - const Transpose<CwiseUnaryOp<ConjugateOp, Derived> > adjoint() const; + + const CwiseUnaryOp<ScalarConjugateOp, Derived> conjugate() const; + const Transpose<CwiseUnaryOp<ScalarConjugateOp, Derived> > adjoint() const; const ScalarMultiple<Derived> normalized() const; //@} - /// \name f - metrics (??) + // FIXME not sure about the following name + /// \name metrics //@{ Scalar trace() const; - + template<typename OtherDerived> Scalar dot(const MatrixBase<Scalar, OtherDerived>& other) const; RealScalar norm2() const; RealScalar norm() const; //@} - + static const Eval<Random<Derived> > random(int rows, int cols); static const Eval<Random<Derived> > random(int size); static const Eval<Random<Derived> > random(); @@ -259,24 +260,24 @@ template<typename Scalar, typename Derived> class MatrixBase static const Ones<Derived> ones(); static const Identity<Derived> identity(); static const Identity<Derived> identity(int rows, int cols); - + Derived& setZero(); Derived& setOnes(); Derived& setRandom(); Derived& setIdentity(); - - /// \name g - matrix diagnostic and comparison + + /// \name matrix diagnostic and comparison //@{ bool isZero(RealScalar prec = precision<Scalar>()) const; bool isOnes(RealScalar prec = precision<Scalar>()) const; bool isIdentity(RealScalar prec = precision<Scalar>()) const; bool isDiagonal(RealScalar prec = precision<Scalar>()) const; - + template<typename OtherDerived> bool isOrtho(const MatrixBase<Scalar, OtherDerived>& other, RealScalar prec = precision<Scalar>()) const; bool isOrtho(RealScalar prec = precision<Scalar>()) const; - + template<typename OtherDerived> bool isApprox(const OtherDerived& other, RealScalar prec = precision<Scalar>()) const; @@ -286,10 +287,10 @@ template<typename Scalar, typename Derived> class MatrixBase bool isMuchSmallerThan(const MatrixBase<Scalar, OtherDerived>& other, RealScalar prec = precision<Scalar>()) const; //@} - - /// \name e - arithemetic operators + + /// \name arithemetic operators //@{ - const CwiseUnaryOp<CwiseOppositeOp,Derived> operator-() const; + const CwiseUnaryOp<ScalarOppositeOp,Derived> operator-() const; template<typename OtherDerived> Derived& operator+=(const MatrixBase<Scalar, OtherDerived>& other); @@ -306,38 +307,38 @@ template<typename Scalar, typename Derived> class MatrixBase friend const ScalarMultiple<Derived> operator*(const Scalar& scalar, - const MatrixBase& matrix) - { return matrix*scalar; } + const MatrixBase& matrix) + { return matrix*scalar; } template<typename OtherDerived> const Product<Derived, OtherDerived> lazyProduct(const MatrixBase<Scalar, OtherDerived>& other) const EIGEN_ALWAYS_INLINE; - const CwiseUnaryOp<CwiseAbsOp,Derived> cwiseAbs() const; + const CwiseUnaryOp<ScalarAbsOp,Derived> cwiseAbs() const; template<typename OtherDerived> - const CwiseBinaryOp<CwiseProductOp, Derived, OtherDerived> + const CwiseBinaryOp<ScalarProductOp, Derived, OtherDerived> cwiseProduct(const MatrixBase<Scalar, OtherDerived> &other) const; template<typename OtherDerived> - const CwiseBinaryOp<CwiseQuotientOp, Derived, OtherDerived> + const CwiseBinaryOp<ScalarQuotientOp, Derived, OtherDerived> cwiseQuotient(const MatrixBase<Scalar, OtherDerived> &other) const; //@} - /// \name b - coefficient accessors + /// \name coefficient accessors //@{ Scalar coeff(int row, int col) const; Scalar operator()(int row, int col) const; - + Scalar& coeffRef(int row, int col); Scalar& operator()(int row, int col); - + Scalar coeff(int index) const; Scalar operator[](int index) const; - + Scalar& coeffRef(int index); Scalar& operator[](int index); - + Scalar x() const; Scalar y() const; Scalar z() const; @@ -348,7 +349,7 @@ template<typename Scalar, typename Derived> class MatrixBase Scalar& w(); //@} - /// \name h - special functions + /// \name special functions //@{ const Eval<Derived> eval() const EIGEN_ALWAYS_INLINE; diff --git a/Eigen/src/Core/MatrixRef.h b/Eigen/src/Core/MatrixRef.h index bfc8491bd..7cc1fd138 100644 --- a/Eigen/src/Core/MatrixRef.h +++ b/Eigen/src/Core/MatrixRef.h @@ -5,12 +5,12 @@ // // Eigen is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either +// License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // // Alternatively, 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 of +// published by the Free Software Foundation; either version 2 of // the License, or (at your option) any later version. // // Eigen is distributed in the hope that it will be useful, but WITHOUT ANY @@ -18,7 +18,7 @@ // FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License or the // GNU General Public License for more details. // -// You should have received a copy of the GNU Lesser General Public +// You should have received a copy of the GNU Lesser General Public // License and a copy of the GNU General Public License along with // Eigen. If not, see <http://www.gnu.org/licenses/>. @@ -31,8 +31,9 @@ template<typename MatrixType> class MatrixRef public: typedef typename MatrixType::Scalar Scalar; friend class MatrixBase<Scalar, MatrixRef>; + friend class MatrixBase<Scalar, MatrixRef>::Traits; typedef MatrixBase<Scalar, MatrixRef> Base; - + MatrixRef(const MatrixType& matrix) : m_matrix(matrix) {} ~MatrixRef() {} @@ -54,7 +55,7 @@ template<typename MatrixType> class MatrixRef { return m_matrix._coeff(row, col); } - + Scalar& _coeffRef(int row, int col) { return const_cast<MatrixType*>(&m_matrix)->_coeffRef(row, col); diff --git a/Eigen/src/Core/Minor.h b/Eigen/src/Core/Minor.h index ae631ba41..b98f09707 100644 --- a/Eigen/src/Core/Minor.h +++ b/Eigen/src/Core/Minor.h @@ -5,12 +5,12 @@ // // Eigen is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either +// License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // // Alternatively, 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 of +// published by the Free Software Foundation; either version 2 of // the License, or (at your option) any later version. // // Eigen is distributed in the hope that it will be useful, but WITHOUT ANY @@ -18,7 +18,7 @@ // FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License or the // GNU General Public License for more details. // -// You should have received a copy of the GNU Lesser General Public +// You should have received a copy of the GNU Lesser General Public // License and a copy of the GNU General Public License along with // Eigen. If not, see <http://www.gnu.org/licenses/>. @@ -44,8 +44,9 @@ template<typename MatrixType> class Minor typedef typename MatrixType::Scalar Scalar; typedef typename MatrixType::Ref MatRef; friend class MatrixBase<Scalar, Minor>; + friend class MatrixBase<Scalar, Minor>::Traits; typedef MatrixBase<Scalar, Minor> Base; - + Minor(const MatRef& matrix, int row, int col) : m_matrix(matrix), m_row(row), m_col(col) @@ -53,9 +54,9 @@ template<typename MatrixType> class Minor assert(row >= 0 && row < matrix.rows() && col >= 0 && col < matrix.cols()); } - + EIGEN_INHERIT_ASSIGNMENT_OPERATORS(Minor) - + private: enum { RowsAtCompileTime = (MatrixType::Traits::RowsAtCompileTime != Dynamic) ? @@ -71,17 +72,17 @@ template<typename MatrixType> class Minor const Minor& _ref() const { return *this; } int _rows() const { return m_matrix.rows() - 1; } int _cols() const { return m_matrix.cols() - 1; } - + Scalar& _coeffRef(int row, int col) { return m_matrix.coeffRef(row + (row >= m_row), col + (col >= m_col)); } - + Scalar _coeff(int row, int col) const { return m_matrix.coeff(row + (row >= m_row), col + (col >= m_col)); } - + protected: MatRef m_matrix; const int m_row, m_col; diff --git a/Eigen/src/Core/Ones.h b/Eigen/src/Core/Ones.h index 48b1156b1..e9131cd51 100644 --- a/Eigen/src/Core/Ones.h +++ b/Eigen/src/Core/Ones.h @@ -5,12 +5,12 @@ // // Eigen is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either +// License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // // Alternatively, 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 of +// published by the Free Software Foundation; either version 2 of // the License, or (at your option) any later version. // // Eigen is distributed in the hope that it will be useful, but WITHOUT ANY @@ -18,7 +18,7 @@ // FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License or the // GNU General Public License for more details. // -// You should have received a copy of the GNU Lesser General Public +// You should have received a copy of the GNU Lesser General Public // License and a copy of the GNU General Public License along with // Eigen. If not, see <http://www.gnu.org/licenses/>. @@ -38,6 +38,7 @@ template<typename MatrixType> class Ones : NoOperatorEquals, public: typedef typename MatrixType::Scalar Scalar; friend class MatrixBase<Scalar, Ones>; + friend class MatrixBase<Scalar, Ones>::Traits; typedef MatrixBase<Scalar, Ones> Base; private: @@ -47,16 +48,16 @@ template<typename MatrixType> class Ones : NoOperatorEquals, MaxRowsAtCompileTime = MatrixType::Traits::MaxRowsAtCompileTime, MaxColsAtCompileTime = MatrixType::Traits::MaxColsAtCompileTime }; - + const Ones& _ref() const { return *this; } int _rows() const { return m_rows.value(); } int _cols() const { return m_cols.value(); } - + Scalar _coeff(int, int) const { return static_cast<Scalar>(1); } - + public: Ones(int rows, int cols) : m_rows(rows), m_cols(cols) { @@ -65,7 +66,7 @@ template<typename MatrixType> class Ones : NoOperatorEquals, && cols > 0 && (ColsAtCompileTime == Dynamic || ColsAtCompileTime == cols)); } - + protected: const IntAtRunTimeIfDynamic<RowsAtCompileTime> m_rows; const IntAtRunTimeIfDynamic<ColsAtCompileTime> m_cols; diff --git a/Eigen/src/Core/Product.h b/Eigen/src/Core/Product.h index f6204ed40..f41d887a5 100644 --- a/Eigen/src/Core/Product.h +++ b/Eigen/src/Core/Product.h @@ -5,12 +5,12 @@ // // Eigen is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either +// License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // // Alternatively, 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 of +// published by the Free Software Foundation; either version 2 of // the License, or (at your option) any later version. // // Eigen is distributed in the hope that it will be useful, but WITHOUT ANY @@ -18,7 +18,7 @@ // FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License or the // GNU General Public License for more details. // -// You should have received a copy of the GNU Lesser General Public +// You should have received a copy of the GNU Lesser General Public // License and a copy of the GNU General Public License along with // Eigen. If not, see <http://www.gnu.org/licenses/>. @@ -80,14 +80,15 @@ template<typename Lhs, typename Rhs> class Product : NoOperatorEquals, typedef typename Lhs::Ref LhsRef; typedef typename Rhs::Ref RhsRef; friend class MatrixBase<Scalar, Product>; + friend class MatrixBase<Scalar, Product>::Traits; typedef MatrixBase<Scalar, Product> Base; Product(const LhsRef& lhs, const RhsRef& rhs) - : m_lhs(lhs), m_rhs(rhs) + : m_lhs(lhs), m_rhs(rhs) { assert(lhs.cols() == rhs.rows()); } - + private: enum { RowsAtCompileTime = Lhs::Traits::RowsAtCompileTime, @@ -99,7 +100,7 @@ template<typename Lhs, typename Rhs> class Product : NoOperatorEquals, const Product& _ref() const { return *this; } int _rows() const { return m_lhs.rows(); } int _cols() const { return m_rhs.cols(); } - + Scalar _coeff(int row, int col) const { Scalar res; @@ -117,7 +118,7 @@ template<typename Lhs, typename Rhs> class Product : NoOperatorEquals, } return res; } - + protected: const LhsRef m_lhs; const RhsRef m_rhs; diff --git a/Eigen/src/Core/Random.h b/Eigen/src/Core/Random.h index aa24dd453..468216d56 100644 --- a/Eigen/src/Core/Random.h +++ b/Eigen/src/Core/Random.h @@ -5,12 +5,12 @@ // // Eigen is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either +// License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // // Alternatively, 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 of +// published by the Free Software Foundation; either version 2 of // the License, or (at your option) any later version. // // Eigen is distributed in the hope that it will be useful, but WITHOUT ANY @@ -18,7 +18,7 @@ // FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License or the // GNU General Public License for more details. // -// You should have received a copy of the GNU Lesser General Public +// You should have received a copy of the GNU Lesser General Public // License and a copy of the GNU General Public License along with // Eigen. If not, see <http://www.gnu.org/licenses/>. @@ -38,8 +38,9 @@ template<typename MatrixType> class Random : NoOperatorEquals, public: typedef typename MatrixType::Scalar Scalar; friend class MatrixBase<Scalar, Random>; + friend class MatrixBase<Scalar, Random>::Traits; typedef MatrixBase<Scalar, Random> Base; - + private: enum { RowsAtCompileTime = MatrixType::Traits::RowsAtCompileTime, @@ -47,16 +48,16 @@ template<typename MatrixType> class Random : NoOperatorEquals, MaxRowsAtCompileTime = MatrixType::Traits::MaxRowsAtCompileTime, MaxColsAtCompileTime = MatrixType::Traits::MaxColsAtCompileTime }; - + const Random& _ref() const { return *this; } int _rows() const { return m_rows.value(); } int _cols() const { return m_cols.value(); } - + Scalar _coeff(int, int) const { return ei_random<Scalar>(); } - + public: Random(int rows, int cols) : m_rows(rows), m_cols(cols) { @@ -65,7 +66,7 @@ template<typename MatrixType> class Random : NoOperatorEquals, && cols > 0 && (ColsAtCompileTime == Dynamic || ColsAtCompileTime == cols)); } - + protected: const IntAtRunTimeIfDynamic<RowsAtCompileTime> m_rows; const IntAtRunTimeIfDynamic<ColsAtCompileTime> m_cols; diff --git a/Eigen/src/Core/Row.h b/Eigen/src/Core/Row.h index 05ee45e72..4657e32db 100644 --- a/Eigen/src/Core/Row.h +++ b/Eigen/src/Core/Row.h @@ -5,12 +5,12 @@ // // Eigen is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either +// License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // // Alternatively, 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 of +// published by the Free Software Foundation; either version 2 of // the License, or (at your option) any later version. // // Eigen is distributed in the hope that it will be useful, but WITHOUT ANY @@ -18,7 +18,7 @@ // FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License or the // GNU General Public License for more details. // -// You should have received a copy of the GNU Lesser General Public +// You should have received a copy of the GNU Lesser General Public // License and a copy of the GNU General Public License along with // Eigen. If not, see <http://www.gnu.org/licenses/>. @@ -52,6 +52,7 @@ template<typename MatrixType> class Row typedef typename MatrixType::Scalar Scalar; typedef typename MatrixType::Ref MatRef; friend class MatrixBase<Scalar, Row>; + friend class MatrixBase<Scalar, Row>::Traits; typedef MatrixBase<Scalar, Row> Base; Row(const MatRef& matrix, int row) @@ -59,15 +60,15 @@ template<typename MatrixType> class Row { assert(row >= 0 && row < matrix.rows()); } - + template<typename OtherDerived> Row& operator=(const MatrixBase<Scalar, OtherDerived>& other) { return MatrixBase<Scalar, Row<MatrixType> >::operator=(other); } - + EIGEN_INHERIT_ASSIGNMENT_OPERATORS(Row) - + private: enum { RowsAtCompileTime = 1, @@ -77,20 +78,20 @@ template<typename MatrixType> class Row }; const Row& _ref() const { return *this; } - + int _rows() const { return 1; } int _cols() const { return m_matrix.cols(); } - + Scalar& _coeffRef(int, int col) { return m_matrix.coeffRef(m_row, col); } - + Scalar _coeff(int, int col) const { return m_matrix.coeff(m_row, col); } - + protected: MatRef m_matrix; const int m_row; diff --git a/Eigen/src/Core/ScalarMultiple.h b/Eigen/src/Core/ScalarMultiple.h index 5ea664994..29858cea9 100644 --- a/Eigen/src/Core/ScalarMultiple.h +++ b/Eigen/src/Core/ScalarMultiple.h @@ -5,12 +5,12 @@ // // Eigen is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either +// License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // // Alternatively, 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 of +// published by the Free Software Foundation; either version 2 of // the License, or (at your option) any later version. // // Eigen is distributed in the hope that it will be useful, but WITHOUT ANY @@ -18,7 +18,7 @@ // FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License or the // GNU General Public License for more details. // -// You should have received a copy of the GNU Lesser General Public +// You should have received a copy of the GNU Lesser General Public // License and a copy of the GNU General Public License along with // Eigen. If not, see <http://www.gnu.org/licenses/>. @@ -43,6 +43,7 @@ template<typename MatrixType> class ScalarMultiple : NoOperatorEquals, typedef typename MatrixType::Scalar Scalar; typedef typename MatrixType::Ref MatRef; friend class MatrixBase<Scalar, ScalarMultiple>; + friend class MatrixBase<Scalar, ScalarMultiple>::Traits; typedef MatrixBase<Scalar, ScalarMultiple> Base; ScalarMultiple(const MatRef& matrix, Scalar factor) @@ -70,37 +71,37 @@ template<typename MatrixType> class ScalarMultiple : NoOperatorEquals, const Scalar m_factor; }; -/** relates MatrixBase sa class ScalarMultiple */ -template<typename Scalar, typename Derived> -const ScalarMultiple<Derived> -MatrixBase<Scalar, Derived>::operator*(const Scalar& scalar) const -{ - return ScalarMultiple<Derived>(ref(), scalar); -} - -/** \relates MatrixBase \sa class ScalarMultiple */ -template<typename Scalar, typename Derived> -const ScalarMultiple<Derived> -MatrixBase<Scalar, Derived>::operator/(const Scalar& scalar) const -{ - assert(NumTraits<Scalar>::HasFloatingPoint); - return ScalarMultiple<Derived>(ref(), static_cast<Scalar>(1) / scalar); +/** relates MatrixBase sa class ScalarMultiple */ +template<typename Scalar, typename Derived> +const ScalarMultiple<Derived> +MatrixBase<Scalar, Derived>::operator*(const Scalar& scalar) const +{ + return ScalarMultiple<Derived>(ref(), scalar); } - -/** \sa ScalarMultiple */ -template<typename Scalar, typename Derived> -Derived& -MatrixBase<Scalar, Derived>::operator*=(const Scalar& other) -{ - return *this = *this * other; -} - -/** \sa ScalarMultiple */ -template<typename Scalar, typename Derived> -Derived& -MatrixBase<Scalar, Derived>::operator/=(const Scalar& other) -{ - return *this = *this / other; + +/** \relates MatrixBase \sa class ScalarMultiple */ +template<typename Scalar, typename Derived> +const ScalarMultiple<Derived> +MatrixBase<Scalar, Derived>::operator/(const Scalar& scalar) const +{ + assert(NumTraits<Scalar>::HasFloatingPoint); + return ScalarMultiple<Derived>(ref(), static_cast<Scalar>(1) / scalar); +} + +/** \sa ScalarMultiple */ +template<typename Scalar, typename Derived> +Derived& +MatrixBase<Scalar, Derived>::operator*=(const Scalar& other) +{ + return *this = *this * other; +} + +/** \sa ScalarMultiple */ +template<typename Scalar, typename Derived> +Derived& +MatrixBase<Scalar, Derived>::operator/=(const Scalar& other) +{ + return *this = *this / other; } #endif // EIGEN_SCALARMULTIPLE_H diff --git a/Eigen/src/Core/Transpose.h b/Eigen/src/Core/Transpose.h index 5320ad522..3fbf87b0c 100644 --- a/Eigen/src/Core/Transpose.h +++ b/Eigen/src/Core/Transpose.h @@ -5,12 +5,12 @@ // // Eigen is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either +// License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // // Alternatively, 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 of +// published by the Free Software Foundation; either version 2 of // the License, or (at your option) any later version. // // Eigen is distributed in the hope that it will be useful, but WITHOUT ANY @@ -18,7 +18,7 @@ // FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License or the // GNU General Public License for more details. // -// You should have received a copy of the GNU Lesser General Public +// You should have received a copy of the GNU Lesser General Public // License and a copy of the GNU General Public License along with // Eigen. If not, see <http://www.gnu.org/licenses/>. @@ -44,12 +44,13 @@ template<typename MatrixType> class Transpose typedef typename MatrixType::Scalar Scalar; typedef typename MatrixType::Ref MatRef; friend class MatrixBase<Scalar, Transpose>; + friend class MatrixBase<Scalar, Transpose>::Traits; typedef MatrixBase<Scalar, Transpose> Base; - + Transpose(const MatRef& matrix) : m_matrix(matrix) {} - + EIGEN_INHERIT_ASSIGNMENT_OPERATORS(Transpose) - + private: enum { RowsAtCompileTime = MatrixType::Traits::ColsAtCompileTime, @@ -61,17 +62,17 @@ template<typename MatrixType> class Transpose const Transpose& _ref() const { return *this; } int _rows() const { return m_matrix.cols(); } int _cols() const { return m_matrix.rows(); } - + Scalar& _coeffRef(int row, int col) { return m_matrix.coeffRef(col, row); } - + Scalar _coeff(int row, int col) const { return m_matrix.coeff(col, row); } - + protected: MatRef m_matrix; }; @@ -102,9 +103,9 @@ MatrixBase<Scalar, Derived>::transpose() const * Example: \include MatrixBase_adjoint.cpp * Output: \verbinclude MatrixBase_adjoint.out * - * \sa transpose(), conjugate(), class Transpose, class ConjugateOp */ + * \sa transpose(), conjugate(), class Transpose, class ScalarConjugateOp */ template<typename Scalar, typename Derived> -const Transpose<CwiseUnaryOp<ConjugateOp, Derived> > +const Transpose<CwiseUnaryOp<ScalarConjugateOp, Derived> > MatrixBase<Scalar, Derived>::adjoint() const { return conjugate().transpose(); diff --git a/Eigen/src/Core/Zero.h b/Eigen/src/Core/Zero.h index 5ed4e4c9a..e152a6fc1 100644 --- a/Eigen/src/Core/Zero.h +++ b/Eigen/src/Core/Zero.h @@ -5,12 +5,12 @@ // // Eigen is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either +// License as published by the Free Software Foundation; either // version 3 of the License, or (at your option) any later version. // // Alternatively, 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 of +// published by the Free Software Foundation; either version 2 of // the License, or (at your option) any later version. // // Eigen is distributed in the hope that it will be useful, but WITHOUT ANY @@ -18,7 +18,7 @@ // FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License or the // GNU General Public License for more details. // -// You should have received a copy of the GNU Lesser General Public +// You should have received a copy of the GNU Lesser General Public // License and a copy of the GNU General Public License along with // Eigen. If not, see <http://www.gnu.org/licenses/>. @@ -38,8 +38,9 @@ template<typename MatrixType> class Zero : NoOperatorEquals, public: typedef typename MatrixType::Scalar Scalar; friend class MatrixBase<Scalar, Zero>; + friend class MatrixBase<Scalar, Zero>::Traits; typedef MatrixBase<Scalar, Zero> Base; - + private: enum { RowsAtCompileTime = MatrixType::Traits::RowsAtCompileTime, @@ -51,12 +52,12 @@ template<typename MatrixType> class Zero : NoOperatorEquals, const Zero& _ref() const { return *this; } int _rows() const { return m_rows.value(); } int _cols() const { return m_cols.value(); } - + Scalar _coeff(int, int) const { return static_cast<Scalar>(0); } - + public: Zero(int rows, int cols) : m_rows(rows), m_cols(cols) { @@ -65,7 +66,7 @@ template<typename MatrixType> class Zero : NoOperatorEquals, && cols > 0 && (ColsAtCompileTime == Dynamic || ColsAtCompileTime == cols)); } - + protected: const IntAtRunTimeIfDynamic<RowsAtCompileTime> m_rows; const IntAtRunTimeIfDynamic<ColsAtCompileTime> m_cols; |