diff --git a/CMakeLists.txt b/CMakeLists.txt index 180453180..e499bdf92 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,4 +1,4 @@ -project(Eigen) +project(gen) OPTION(BUILD_TESTS "Build tests" OFF) OPTION(BUILD_EXAMPLES "Build examples" OFF) diff --git a/doc/example.cpp b/doc/example.cpp index 75d47f988..ca10d077a 100644 --- a/doc/example.cpp +++ b/doc/example.cpp @@ -1,23 +1,25 @@ #include "../src/Core.h" +USING_EIGEN_DATA_TYPES + using namespace std; template -void foo(const EiObject& m) +void foo(const Eigen::Object& m) { cout << "Here's m:" << endl << m << endl; } template -EiScalarProduct -twice(const EiObject& m) +Eigen::ScalarProduct +twice(const Eigen::Object& m) { return 2 * m; } int main(int, char**) { - EiMatrix2d m; + Matrix2d m; m(0,0)= 1; m(1,0)= 2; m(0,1)= 3; diff --git a/doc/tutorial.cpp b/doc/tutorial.cpp index ab145bf3f..4400bd2d1 100644 --- a/doc/tutorial.cpp +++ b/doc/tutorial.cpp @@ -1,10 +1,12 @@ #include "../src/Core.h" +USING_EIGEN_DATA_TYPES + using namespace std; int main(int, char **) { - EiMatrix m; // 2x2 fixed-size matrix with uninitialized entries + Matrix m; // 2x2 fixed-size matrix with uninitialized entries m(0,0) = 1; m(0,1) = 2; m(1,0) = 3; @@ -12,7 +14,7 @@ int main(int, char **) cout << "Here is a 2x2 matrix m:" << endl << m << endl; cout << "Let us now build a 4x4 matrix m2 by assembling together four 2x2 blocks." << endl; - EiMatrixXd m2(4,4); // dynamic matrix with initial size 4x4 and uninitialized entries + MatrixXd m2(4,4); // dynamic matrix with initial size 4x4 and uninitialized entries // notice how we are mixing fixed-size and dynamic-size types. cout << "In the top-left block, we put the matrix m shown above." << endl; diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 12c48c4a4..78a05eec6 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -1,4 +1,4 @@ -FILE(GLOB Eigen_SRCS "*.h") +FILE(GLOB gen_SRCS "*.h") SET(INCLUDE_INSTALL_DIR "${CMAKE_INSTALL_PREFIX}/include/eigen2" @@ -7,7 +7,7 @@ SET(INCLUDE_INSTALL_DIR FORCE) INSTALL(FILES - ${Eigen_SRCS} + ${gen_SRCS} DESTINATION ${INCLUDE_INSTALL_DIR} ) diff --git a/src/Core.h b/src/Core.h index 658f7fe08..2fd9423dd 100644 --- a/src/Core.h +++ b/src/Core.h @@ -1,3 +1,10 @@ + +#include +#include +#include + +namespace Eigen { + #include "Core/Util.h" #include "Core/Numeric.h" #include "Core/Object.h" @@ -14,3 +21,5 @@ #include "Core/Trace.h" #include "Core/Dot.h" #include "Core/Random.h" + +} // namespace Eigen diff --git a/src/Core/Block.h b/src/Core/Block.h index 90bb9ac8a..1ddd86540 100644 --- a/src/Core/Block.h +++ b/src/Core/Block.h @@ -1,19 +1,19 @@ -// This file is part of Eigen, a lightweight C++ template library -// for linear algebra. Eigen itself is part of the KDE project. +// This file is part of gen, a lightweight C++ template library +// for linear algebra. gen itself is part of the KDE project. // // Copyright (C) 2006-2007 Benoit Jacob // -// Eigen is free software; you can redistribute it and/or modify it under the +// gen 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 +// gen 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 +// with gen; 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 @@ -26,18 +26,18 @@ #ifndef EI_BLOCK_H #define EI_BLOCK_H -template class EiBlock - : public EiObject > +template class Block + : public Object > { public: typedef typename MatrixType::Scalar Scalar; typedef typename MatrixType::Ref MatRef; - friend class EiObject >; + friend class Object >; - static const int RowsAtCompileTime = EiDynamic, - ColsAtCompileTime = EiDynamic; + static const int RowsAtCompileTime = Dynamic, + ColsAtCompileTime = Dynamic; - EiBlock(const MatRef& matrix, + Block(const MatRef& matrix, int startRow, int endRow, int startCol = 0, int endCol = 0) : m_matrix(matrix), m_startRow(startRow), m_endRow(endRow), @@ -47,15 +47,15 @@ template class EiBlock && startCol >= 0 && startCol <= endCol && endCol < matrix.cols()); } - EiBlock(const EiBlock& other) + Block(const Block& other) : m_matrix(other.m_matrix), m_startRow(other.m_startRow), m_endRow(other.m_endRow), m_startCol(other.m_startCol), m_endCol(other.m_endCol) {} - EI_INHERIT_ASSIGNMENT_OPERATORS(EiBlock) + EI_INHERIT_ASSIGNMENT_OPERATORS(Block) private: - EiBlock& _ref() { return *this; } - const EiBlock& _constRef() const { return *this; } + Block& _ref() { return *this; } + const Block& _constRef() const { return *this; } int _rows() const { return m_endRow - m_startRow + 1; } int _cols() const { return m_endCol - m_startCol + 1; } @@ -75,10 +75,10 @@ template class EiBlock }; template -EiBlock -EiObject::block(int startRow, int endRow, int startCol, int endCol) +Block +Object::block(int startRow, int endRow, int startCol, int endCol) { - return EiBlock(static_cast(this)->ref(), startRow, endRow, startCol, endCol); + return Block(static_cast(this)->ref(), startRow, endRow, startCol, endCol); } #endif // EI_BLOCK_H diff --git a/src/Core/CMakeLists.txt b/src/Core/CMakeLists.txt index dc4473416..f5a6743ce 100644 --- a/src/Core/CMakeLists.txt +++ b/src/Core/CMakeLists.txt @@ -1,6 +1,6 @@ -FILE(GLOB Eigen_Core_SRCS "*.h") +FILE(GLOB gen_Core_SRCS "*.h") INSTALL(FILES - ${Eigen_Core_SRCS} + ${gen_Core_SRCS} DESTINATION ${INCLUDE_INSTALL_DIR}/Core ) diff --git a/src/Core/Column.h b/src/Core/Column.h index f83028ed0..bc669261a 100644 --- a/src/Core/Column.h +++ b/src/Core/Column.h @@ -1,19 +1,19 @@ -// This file is part of Eigen, a lightweight C++ template library -// for linear algebra. Eigen itself is part of the KDE project. +// This file is part of gen, a lightweight C++ template library +// for linear algebra. gen itself is part of the KDE project. // // Copyright (C) 2006-2007 Benoit Jacob // -// Eigen is free software; you can redistribute it and/or modify it under the +// gen 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 +// gen 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 +// with gen; 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 @@ -26,31 +26,31 @@ #ifndef EI_COLUMN_H #define EI_COLUMN_H -template class EiColumn - : public EiObject > +template class Column + : public Object > { public: typedef typename MatrixType::Scalar Scalar; typedef typename MatrixType::Ref MatRef; - friend class EiObject >; + friend class Object >; static const int RowsAtCompileTime = MatrixType::RowsAtCompileTime, ColsAtCompileTime = 1; - EiColumn(const MatRef& matrix, int col) + Column(const MatRef& matrix, int col) : m_matrix(matrix), m_col(col) { EI_CHECK_COL_RANGE(matrix, col); } - EiColumn(const EiColumn& other) + Column(const Column& other) : m_matrix(other.m_matrix), m_col(other.m_col) {} - EI_INHERIT_ASSIGNMENT_OPERATORS(EiColumn) + EI_INHERIT_ASSIGNMENT_OPERATORS(Column) private: - EiColumn& _ref() { return *this; } - const EiColumn& _constRef() const { return *this; } + Column& _ref() { return *this; } + const Column& _constRef() const { return *this; } int _rows() const { return m_matrix.rows(); } int _cols() const { return 1; } @@ -74,10 +74,10 @@ template class EiColumn }; template -EiColumn -EiObject::col(int i) +Column +Object::col(int i) { - return EiColumn(static_cast(this)->ref(), i); + return Column(static_cast(this)->ref(), i); } #endif // EI_COLUMN_H diff --git a/src/Core/Conjugate.h b/src/Core/Conjugate.h index 9ca055e92..6431558f4 100644 --- a/src/Core/Conjugate.h +++ b/src/Core/Conjugate.h @@ -1,19 +1,19 @@ -// This file is part of Eigen, a lightweight C++ template library -// for linear algebra. Eigen itself is part of the KDE project. +// This file is part of gen, a lightweight C++ template library +// for linear algebra. gen itself is part of the KDE project. // // Copyright (C) 2006-2007 Benoit Jacob // -// Eigen is free software; you can redistribute it and/or modify it under the +// gen 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 +// gen 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 +// with gen; 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 @@ -26,33 +26,33 @@ #ifndef EI_CONJUGATE_H #define EI_CONJUGATE_H -template class EiConjugate - : public EiObject > +template class Conjugate + : public Object > { public: typedef typename MatrixType::Scalar Scalar; typedef typename MatrixType::ConstRef MatRef; - friend class EiObject >; + friend class Object >; static const int RowsAtCompileTime = MatrixType::RowsAtCompileTime, ColsAtCompileTime = MatrixType::ColsAtCompileTime; - EiConjugate(const MatRef& matrix) : m_matrix(matrix) {} + Conjugate(const MatRef& matrix) : m_matrix(matrix) {} - EiConjugate(const EiConjugate& other) + Conjugate(const Conjugate& other) : m_matrix(other.m_matrix) {} - EI_INHERIT_ASSIGNMENT_OPERATORS(EiConjugate) + EI_INHERIT_ASSIGNMENT_OPERATORS(Conjugate) private: - EiConjugate& _ref() { return *this; } - const EiConjugate& _constRef() const { return *this; } + Conjugate& _ref() { return *this; } + const Conjugate& _constRef() const { return *this; } int _rows() const { return m_matrix.rows(); } int _cols() const { return m_matrix.cols(); } Scalar _read(int row, int col) const { - return EiConj(m_matrix.read(row, col)); + return Conj(m_matrix.read(row, col)); } protected: @@ -60,10 +60,10 @@ template class EiConjugate }; template -EiConjugate -EiObject::conjugate() const +Conjugate +Object::conjugate() const { - return EiConjugate(static_cast(this)->constRef()); + return Conjugate(static_cast(this)->constRef()); } #endif // EI_CONJUGATE_H diff --git a/src/Core/CopyHelper.h b/src/Core/CopyHelper.h index ccd754c12..4bb6c31c7 100644 --- a/src/Core/CopyHelper.h +++ b/src/Core/CopyHelper.h @@ -1,20 +1,20 @@ -// This file is part of Eigen, a lightweight C++ template library -// for linear algebra. Eigen itself is part of the KDE project. +// This file is part of gen, a lightweight C++ template library +// for linear algebra. gen itself is part of the KDE project. // // Copyright (C) 2007 Michael Olbrich // Copyright (C) 2006-2007 Benoit Jacob // -// Eigen is free software; you can redistribute it and/or modify it under the +// gen 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 +// gen 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 +// with gen; 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 @@ -27,7 +27,7 @@ #ifndef EI_COPYHELPER_H #define EI_COPYHELPER_H -template struct EiCopyHelperUnroller +template struct CopyHelperUnroller { static const int col = (UnrollCount-1) / Rows; static const int row = (UnrollCount-1) % Rows; @@ -35,12 +35,12 @@ template struct EiCopyHelperUnroller template static void run(Derived1 &dst, const Derived2 &src) { - EiCopyHelperUnroller::run(dst, src); + CopyHelperUnroller::run(dst, src); dst.write(row, col) = src.read(row, col); } }; -template struct EiCopyHelperUnroller<0, Rows> +template struct CopyHelperUnroller<0, Rows> { template static void run(Derived1 &dst, const Derived2 &src) @@ -49,7 +49,7 @@ template struct EiCopyHelperUnroller<0, Rows> } }; -template struct EiCopyHelperUnroller +template struct CopyHelperUnroller { template static void run(Derived1 &dst, const Derived2 &src) @@ -61,10 +61,10 @@ template struct EiCopyHelperUnroller template template -void EiObject::_copy_helper(const EiObject& other) +void Object::_copy_helper(const Object& other) { - if(SizeAtCompileTime != EiDynamic && SizeAtCompileTime <= EI_LOOP_UNROLLING_LIMIT) - EiCopyHelperUnroller::run(*this, other); + if(SizeAtCompileTime != Dynamic && SizeAtCompileTime <= EI_LOOP_UNROLLING_LIMIT) + CopyHelperUnroller::run(*this, other); else for(int i = 0; i < rows(); i++) for(int j = 0; j < cols(); j++) diff --git a/src/Core/Dot.h b/src/Core/Dot.h index ea9653f8a..98adf3853 100644 --- a/src/Core/Dot.h +++ b/src/Core/Dot.h @@ -1,19 +1,19 @@ -// This file is part of Eigen, a lightweight C++ template library -// for linear algebra. Eigen itself is part of the KDE project. +// This file is part of gen, a lightweight C++ template library +// for linear algebra. gen itself is part of the KDE project. // // Copyright (C) 2006-2007 Benoit Jacob // -// Eigen is free software; you can redistribute it and/or modify it under the +// gen 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 +// gen 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 +// with gen; 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 @@ -27,26 +27,26 @@ #define EI_DOT_H template -struct EiDotUnroller +struct DotUnroller { static void run(const Derived1 &v1, const Derived2& v2, typename Derived1::Scalar &dot) { - EiDotUnroller::run(v1, v2, dot); - dot += v1[Index] * EiConj(v2[Index]); + DotUnroller::run(v1, v2, dot); + dot += v1[Index] * Conj(v2[Index]); } }; template -struct EiDotUnroller<0, Size, Derived1, Derived2> +struct DotUnroller<0, Size, Derived1, Derived2> { static void run(const Derived1 &v1, const Derived2& v2, typename Derived1::Scalar &dot) { - dot = v1[0] * EiConj(v2[0]); + dot = v1[0] * Conj(v2[0]); } }; template -struct EiDotUnroller +struct DotUnroller { static void run(const Derived1 &v1, const Derived2& v2, typename Derived1::Scalar &dot) { @@ -58,37 +58,37 @@ struct EiDotUnroller template template -Scalar EiObject::dot(const OtherDerived& other) const +Scalar Object::dot(const OtherDerived& other) const { assert(IsVector && OtherDerived::IsVector && size() == other.size()); Scalar res; - if(SizeAtCompileTime != EiDynamic && SizeAtCompileTime <= 16) - EiDotUnroller + if(SizeAtCompileTime != Dynamic && SizeAtCompileTime <= 16) + DotUnroller ::run(*static_cast(this), other, res); else { - res = (*this)[0] * EiConj(other[0]); + res = (*this)[0] * Conj(other[0]); for(int i = 1; i < size(); i++) - res += (*this)[i]* EiConj(other[i]); + res += (*this)[i]* Conj(other[i]); } return res; } template -typename EiNumTraits::Real EiObject::norm2() const +typename NumTraits::Real Object::norm2() const { assert(IsVector); - return EiReal(dot(*this)); + return Real(dot(*this)); } template -typename EiNumTraits::Real EiObject::norm() const +typename NumTraits::Real Object::norm() const { - return EiSqrt(norm2()); + return Sqrt(norm2()); } template -EiScalarProduct EiObject::normalized() const +ScalarProduct Object::normalized() const { return (*this) / norm(); } diff --git a/src/Core/Eval.h b/src/Core/Eval.h index 4de32ebac..5551d8e21 100644 --- a/src/Core/Eval.h +++ b/src/Core/Eval.h @@ -1,19 +1,19 @@ -// This file is part of Eigen, a lightweight C++ template library -// for linear algebra. Eigen itself is part of the KDE project. +// This file is part of gen, a lightweight C++ template library +// for linear algebra. gen itself is part of the KDE project. // // Copyright (C) 2006-2007 Benoit Jacob // -// Eigen is free software; you can redistribute it and/or modify it under the +// gen 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 +// gen 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 +// with gen; 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 @@ -26,26 +26,26 @@ #ifndef EI_EVAL_H #define EI_EVAL_H -template class EiEval - : public EiMatrix< typename Expression::Scalar, +template class Eval + : public Matrix< typename Expression::Scalar, Expression::RowsAtCompileTime, Expression::ColsAtCompileTime > { public: typedef typename Expression::Scalar Scalar; - typedef EiMatrix MatrixType; + typedef Matrix MatrixType; typedef Expression Base; - friend class EiObject; + friend class Object; - EI_INHERIT_ASSIGNMENT_OPERATORS(EiEval) + EI_INHERIT_ASSIGNMENT_OPERATORS(Eval) - EiEval(const Expression& expression) : MatrixType(expression) {} + Eval(const Expression& expression) : MatrixType(expression) {} }; template -EiEval EiObject::eval() const +Eval Object::eval() const { - return EiEval(*static_cast(this)); + return Eval(*static_cast(this)); } #endif // EI_EVAL_H diff --git a/src/Core/Fuzzy.h b/src/Core/Fuzzy.h index 44b20615d..8730a073b 100644 --- a/src/Core/Fuzzy.h +++ b/src/Core/Fuzzy.h @@ -1,19 +1,19 @@ -// This file is part of Eigen, a lightweight C++ template library -// for linear algebra. Eigen itself is part of the KDE project. +// This file is part of gen, a lightweight C++ template library +// for linear algebra. gen itself is part of the KDE project. // // Copyright (C) 2006-2007 Benoit Jacob // -// Eigen is free software; you can redistribute it and/or modify it under the +// gen 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 +// gen 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 +// with gen; 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 @@ -28,13 +28,13 @@ template template -bool EiObject::isApprox(const OtherDerived& other) const +bool Object::isApprox(const OtherDerived& other) const { if(IsVector) { return((*this - other).norm2() <= std::min(norm2(), other.norm2()) - * EiAbs2(EiNumTraits::epsilon())); + * Abs2(NumTraits::epsilon())); } else { @@ -46,11 +46,11 @@ bool EiObject::isApprox(const OtherDerived& other) const } template -bool EiObject::isNegligble(const Scalar& other) const +bool Object::isNegligble(const Scalar& other) const { if(IsVector) { - return(norm2() <= EiAbs2(other) * EiAbs2(EiNumTraits::epsilon())); + return(norm2() <= Abs2(other) * Abs2(NumTraits::epsilon())); } else { @@ -63,11 +63,11 @@ bool EiObject::isNegligble(const Scalar& other) const template template -bool EiObject::isNegligble(const EiObject& other) const +bool Object::isNegligble(const Object& other) const { if(IsVector) { - return(norm2() <= other.norm2() * EiAbs2(EiNumTraits::epsilon())); + return(norm2() <= other.norm2() * Abs2(NumTraits::epsilon())); } else { diff --git a/src/Core/Matrix.h b/src/Core/Matrix.h index b4df04b11..a87de43ac 100644 --- a/src/Core/Matrix.h +++ b/src/Core/Matrix.h @@ -1,19 +1,19 @@ -// This file is part of Eigen, a lightweight C++ template library -// for linear algebra. Eigen itself is part of the KDE project. +// This file is part of gen, a lightweight C++ template library +// for linear algebra. gen itself is part of the KDE project. // // Copyright (C) 2006-2007 Benoit Jacob // -// Eigen is free software; you can redistribute it and/or modify it under the +// gen 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 +// gen 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 +// with gen; 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 @@ -33,18 +33,18 @@ #include "MatrixStorage.h" template -class EiMatrix : public EiObject<_Scalar, EiMatrix<_Scalar, _Rows, _Cols> >, - public EiMatrixStorage<_Scalar, _Rows, _Cols> +class Matrix : public Object<_Scalar, Matrix<_Scalar, _Rows, _Cols> >, + public MatrixStorage<_Scalar, _Rows, _Cols> { public: - friend class EiObject<_Scalar, EiMatrix>; - typedef EiObject<_Scalar, EiMatrix> Base; - typedef EiMatrixStorage<_Scalar, _Rows, _Cols> Storage; + friend class Object<_Scalar, Matrix>; + typedef Object<_Scalar, Matrix> Base; + typedef MatrixStorage<_Scalar, _Rows, _Cols> Storage; typedef _Scalar Scalar; - typedef EiMatrixRef Ref; - typedef EiMatrixConstRef ConstRef; - friend class EiMatrixRef; - friend class EiMatrixConstRef; + typedef MatrixRef Ref; + typedef MatrixConstRef ConstRef; + friend class MatrixRef; + friend class MatrixConstRef; static const int RowsAtCompileTime = _Rows, ColsAtCompileTime = _Cols; @@ -72,46 +72,46 @@ class EiMatrix : public EiObject<_Scalar, EiMatrix<_Scalar, _Rows, _Cols> >, public: template - EiMatrix& operator=(const EiObject& other) + Matrix& operator=(const Object& other) { resize(other.rows(), other.cols()); return Base::operator=(other); } - EiMatrix& operator=(const EiMatrix& other) + Matrix& operator=(const Matrix& other) { resize(other.rows(), other.cols()); return Base::operator=(other); } - EI_INHERIT_ASSIGNMENT_OPERATOR(EiMatrix, +=) - EI_INHERIT_ASSIGNMENT_OPERATOR(EiMatrix, -=) - EI_INHERIT_SCALAR_ASSIGNMENT_OPERATOR(EiMatrix, *=) - EI_INHERIT_SCALAR_ASSIGNMENT_OPERATOR(EiMatrix, /=) + EI_INHERIT_ASSIGNMENT_OPERATOR(Matrix, +=) + EI_INHERIT_ASSIGNMENT_OPERATOR(Matrix, -=) + EI_INHERIT_SCALAR_ASSIGNMENT_OPERATOR(Matrix, *=) + EI_INHERIT_SCALAR_ASSIGNMENT_OPERATOR(Matrix, /=) - explicit EiMatrix(int rows = 1, int cols = 1) : Storage(rows, cols) {} + explicit Matrix(int rows = 1, int cols = 1) : Storage(rows, cols) {} template - EiMatrix(const EiObject& other) : Storage(other.rows(), other.cols()) + Matrix(const Object& other) : Storage(other.rows(), other.cols()) { *this = other; } - EiMatrix(const EiMatrix& other) : Storage(other.rows(), other.cols()) + Matrix(const Matrix& other) : Storage(other.rows(), other.cols()) { *this = other; } - ~EiMatrix() {} + ~Matrix() {} }; #define EI_MAKE_TYPEDEFS(Type, TypeSuffix, Size, SizeSuffix) \ -typedef EiMatrix EiMatrix##SizeSuffix##TypeSuffix; \ -typedef EiMatrix EiVector##SizeSuffix##TypeSuffix; \ -typedef EiMatrix EiRowVector##SizeSuffix##TypeSuffix; +typedef Matrix Matrix##SizeSuffix##TypeSuffix; \ +typedef Matrix Vector##SizeSuffix##TypeSuffix; \ +typedef Matrix RowVector##SizeSuffix##TypeSuffix; #define EI_MAKE_TYPEDEFS_ALL_SIZES(Type, TypeSuffix) \ EI_MAKE_TYPEDEFS(Type, TypeSuffix, 2, 2) \ EI_MAKE_TYPEDEFS(Type, TypeSuffix, 3, 3) \ EI_MAKE_TYPEDEFS(Type, TypeSuffix, 4, 4) \ -EI_MAKE_TYPEDEFS(Type, TypeSuffix, EiDynamic, X) +EI_MAKE_TYPEDEFS(Type, TypeSuffix, Dynamic, X) EI_MAKE_TYPEDEFS_ALL_SIZES(int, i) EI_MAKE_TYPEDEFS_ALL_SIZES(float, f) @@ -123,6 +123,25 @@ EI_MAKE_TYPEDEFS_ALL_SIZES(std::complex, cd) #undef EI_MAKE_TYPEDEFS_ALL_SIZES #undef EI_MAKE_TYPEDEFS +#define EI_USING_MATRIX_TYPEDEFS_FOR_TYPE_AND_SIZE(Type, TypeSuffix, Size, SizeSuffix) \ +using Eigen::Matrix##SizeSuffix##TypeSuffix; \ +using Eigen::Vector##SizeSuffix##TypeSuffix; \ +using Eigen::RowVector##SizeSuffix##TypeSuffix; + +#define EI_USING_MATRIX_TYPEDEFS_FOR_TYPE(Type, TypeSuffix) \ +EI_USING_MATRIX_TYPEDEFS_FOR_TYPE_AND_SIZE(Type, TypeSuffix, 2, 2) \ +EI_USING_MATRIX_TYPEDEFS_FOR_TYPE_AND_SIZE(Type, TypeSuffix, 3, 3) \ +EI_USING_MATRIX_TYPEDEFS_FOR_TYPE_AND_SIZE(Type, TypeSuffix, 4, 4) \ +EI_USING_MATRIX_TYPEDEFS_FOR_TYPE_AND_SIZE(Type, TypeSuffix, Dynamic, X) + +#define EI_USING_MATRIX_TYPEDEFS \ +EI_USING_MATRIX_TYPEDEFS_FOR_TYPE(int, i) \ +EI_USING_MATRIX_TYPEDEFS_FOR_TYPE(float, f) \ +EI_USING_MATRIX_TYPEDEFS_FOR_TYPE(double, d) \ +EI_USING_MATRIX_TYPEDEFS_FOR_TYPE(std::complex, ci) \ +EI_USING_MATRIX_TYPEDEFS_FOR_TYPE(std::complex, cf) \ +EI_USING_MATRIX_TYPEDEFS_FOR_TYPE(std::complex, cd) + #include "Eval.h" #include "MatrixOps.h" #include "ScalarOps.h" diff --git a/src/Core/MatrixOps.h b/src/Core/MatrixOps.h index 1449a3923..0861a2bff 100644 --- a/src/Core/MatrixOps.h +++ b/src/Core/MatrixOps.h @@ -1,19 +1,19 @@ -// This file is part of Eigen, a lightweight C++ template library -// for linear algebra. Eigen itself is part of the KDE project. +// This file is part of gen, a lightweight C++ template library +// for linear algebra. gen itself is part of the KDE project. // // Copyright (C) 2006-2007 Benoit Jacob // -// Eigen is free software; you can redistribute it and/or modify it under the +// gen 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 +// gen 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 +// with gen; 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 @@ -26,33 +26,33 @@ #ifndef EI_MATRIXOPS_H #define EI_MATRIXOPS_H -template class EiSum - : public EiObject > +template class Sum + : public Object > { public: typedef typename Lhs::Scalar Scalar; typedef typename Lhs::ConstRef LhsRef; typedef typename Rhs::ConstRef RhsRef; - friend class EiObject; + friend class Object; static const int RowsAtCompileTime = Lhs::RowsAtCompileTime, ColsAtCompileTime = Rhs::ColsAtCompileTime; - EiSum(const LhsRef& lhs, const RhsRef& rhs) + Sum(const LhsRef& lhs, const RhsRef& rhs) : m_lhs(lhs), m_rhs(rhs) { assert(lhs.rows() == rhs.rows() && lhs.cols() == rhs.cols()); } - EiSum(const EiSum& other) + Sum(const Sum& other) : m_lhs(other.m_lhs), m_rhs(other.m_rhs) {} - EI_INHERIT_ASSIGNMENT_OPERATORS(EiSum) + EI_INHERIT_ASSIGNMENT_OPERATORS(Sum) private: - const EiSum& _ref() const { return *this; } - const EiSum& _constRef() const { return *this; } + const Sum& _ref() const { return *this; } + const Sum& _constRef() const { return *this; } int _rows() const { return m_lhs.rows(); } int _cols() const { return m_lhs.cols(); } @@ -66,32 +66,32 @@ template class EiSum const RhsRef m_rhs; }; -template class EiDifference - : public EiObject > +template class Difference + : public Object > { public: typedef typename Lhs::Scalar Scalar; typedef typename Lhs::ConstRef LhsRef; typedef typename Rhs::ConstRef RhsRef; - friend class EiObject; + friend class Object; static const int RowsAtCompileTime = Lhs::RowsAtCompileTime, ColsAtCompileTime = Rhs::ColsAtCompileTime; - EiDifference(const LhsRef& lhs, const RhsRef& rhs) + Difference(const LhsRef& lhs, const RhsRef& rhs) : m_lhs(lhs), m_rhs(rhs) { assert(lhs.rows() == rhs.rows() && lhs.cols() == rhs.cols()); } - EiDifference(const EiDifference& other) + Difference(const Difference& other) : m_lhs(other.m_lhs), m_rhs(other.m_rhs) {} - EI_INHERIT_ASSIGNMENT_OPERATORS(EiDifference) + EI_INHERIT_ASSIGNMENT_OPERATORS(Difference) private: - const EiDifference& _ref() const { return *this; } - const EiDifference& _constRef() const { return *this; } + const Difference& _ref() const { return *this; } + const Difference& _constRef() const { return *this; } int _rows() const { return m_lhs.rows(); } int _cols() const { return m_lhs.cols(); } @@ -106,18 +106,18 @@ template class EiDifference }; template -struct EiMatrixProductUnroller +struct MatrixProductUnroller { static void run(int row, int col, const Lhs& lhs, const Rhs& rhs, typename Lhs::Scalar &res) { - EiMatrixProductUnroller::run(row, col, lhs, rhs, res); + MatrixProductUnroller::run(row, col, lhs, rhs, res); res += lhs.read(row, Index) * rhs.read(Index, col); } }; template -struct EiMatrixProductUnroller<0, Size, Lhs, Rhs> +struct MatrixProductUnroller<0, Size, Lhs, Rhs> { static void run(int row, int col, const Lhs& lhs, const Rhs& rhs, typename Lhs::Scalar &res) @@ -127,7 +127,7 @@ struct EiMatrixProductUnroller<0, Size, Lhs, Rhs> }; template -struct EiMatrixProductUnroller +struct MatrixProductUnroller { static void run(int row, int col, const Lhs& lhs, const Rhs& rhs, typename Lhs::Scalar &res) @@ -140,40 +140,40 @@ struct EiMatrixProductUnroller } }; -template class EiMatrixProduct - : public EiObject > +template class MatrixProduct + : public Object > { public: typedef typename Lhs::Scalar Scalar; typedef typename Lhs::ConstRef LhsRef; typedef typename Rhs::ConstRef RhsRef; - friend class EiObject; + friend class Object; static const int RowsAtCompileTime = Lhs::RowsAtCompileTime, ColsAtCompileTime = Rhs::ColsAtCompileTime; - EiMatrixProduct(const LhsRef& lhs, const RhsRef& rhs) + MatrixProduct(const LhsRef& lhs, const RhsRef& rhs) : m_lhs(lhs), m_rhs(rhs) { assert(lhs.cols() == rhs.rows()); } - EiMatrixProduct(const EiMatrixProduct& other) + MatrixProduct(const MatrixProduct& other) : m_lhs(other.m_lhs), m_rhs(other.m_rhs) {} - EI_INHERIT_ASSIGNMENT_OPERATORS(EiMatrixProduct) + EI_INHERIT_ASSIGNMENT_OPERATORS(MatrixProduct) private: - const EiMatrixProduct& _ref() const { return *this; } - const EiMatrixProduct& _constRef() const { return *this; } + const MatrixProduct& _ref() const { return *this; } + const MatrixProduct& _constRef() const { return *this; } int _rows() const { return m_lhs.rows(); } int _cols() const { return m_rhs.cols(); } Scalar _read(int row, int col) const { Scalar res; - if(Lhs::ColsAtCompileTime != EiDynamic && Lhs::ColsAtCompileTime <= 16) - EiMatrixProductUnroller + if(Lhs::ColsAtCompileTime != Dynamic && Lhs::ColsAtCompileTime <= 16) + MatrixProductUnroller ::run(row, col, m_lhs, m_rhs, res); else { @@ -190,30 +190,30 @@ template class EiMatrixProduct }; template -EiSum -operator+(const EiObject &mat1, const EiObject &mat2) +Sum +operator+(const Object &mat1, const Object &mat2) { - return EiSum(mat1.constRef(), mat2.constRef()); + return Sum(mat1.constRef(), mat2.constRef()); } template -EiDifference -operator-(const EiObject &mat1, const EiObject &mat2) +Difference +operator-(const Object &mat1, const Object &mat2) { - return EiDifference(mat1.constRef(), mat2.constRef()); + return Difference(mat1.constRef(), mat2.constRef()); } template template -EiMatrixProduct -EiObject::lazyMul(const EiObject &other) const +MatrixProduct +Object::lazyMul(const Object &other) const { - return EiMatrixProduct(constRef(), other.constRef()); + return MatrixProduct(constRef(), other.constRef()); } template -EiEval > -operator*(const EiObject &mat1, const EiObject &mat2) +Eval > +operator*(const Object &mat1, const Object &mat2) { return mat1.lazyMul(mat2).eval(); } @@ -221,7 +221,7 @@ operator*(const EiObject &mat1, const EiObject template Derived & -EiObject::operator+=(const EiObject& other) +Object::operator+=(const Object& other) { return *this = *this + other; } @@ -229,7 +229,7 @@ EiObject::operator+=(const EiObject& othe template template Derived & -EiObject::operator-=(const EiObject &other) +Object::operator-=(const Object &other) { return *this = *this - other; } @@ -237,7 +237,7 @@ EiObject::operator-=(const EiObject &othe template template Derived & -EiObject::operator*=(const EiObject &other) +Object::operator*=(const Object &other) { return *this = *this * other; } diff --git a/src/Core/MatrixRef.h b/src/Core/MatrixRef.h index 7bf3ebe44..d3fdae581 100644 --- a/src/Core/MatrixRef.h +++ b/src/Core/MatrixRef.h @@ -1,19 +1,19 @@ -// This file is part of Eigen, a lightweight C++ template library -// for linear algebra. Eigen itself is part of the KDE project. +// This file is part of gen, a lightweight C++ template library +// for linear algebra. gen itself is part of the KDE project. // // Copyright (C) 2006-2007 Benoit Jacob // -// Eigen is free software; you can redistribute it and/or modify it under the +// gen 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 +// gen 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 +// with gen; 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 @@ -26,18 +26,18 @@ #ifndef EI_MATRIXREF_H #define EI_MATRIXREF_H -template class EiMatrixConstRef - : public EiObject > +template class MatrixConstRef + : public Object > { public: typedef typename MatrixType::Scalar Scalar; - friend class EiObject; + friend class Object; - EiMatrixConstRef(const MatrixType& matrix) : m_matrix(matrix) {} - EiMatrixConstRef(const EiMatrixConstRef& other) : m_matrix(other.m_matrix) {} - ~EiMatrixConstRef() {} + MatrixConstRef(const MatrixType& matrix) : m_matrix(matrix) {} + MatrixConstRef(const MatrixConstRef& other) : m_matrix(other.m_matrix) {} + ~MatrixConstRef() {} - EI_INHERIT_ASSIGNMENT_OPERATORS(EiMatrixConstRef) + EI_INHERIT_ASSIGNMENT_OPERATORS(MatrixConstRef) private: int _rows() const { return m_matrix.rows(); } @@ -51,18 +51,18 @@ template class EiMatrixConstRef const MatrixType& m_matrix; }; -template class EiMatrixRef - : public EiObject > +template class MatrixRef + : public Object > { public: typedef typename MatrixType::Scalar Scalar; - friend class EiObject; + friend class Object; - EiMatrixRef(MatrixType& matrix) : m_matrix(matrix) {} - EiMatrixRef(const EiMatrixRef& other) : m_matrix(other.m_matrix) {} - ~EiMatrixRef() {} + MatrixRef(MatrixType& matrix) : m_matrix(matrix) {} + MatrixRef(const MatrixRef& other) : m_matrix(other.m_matrix) {} + ~MatrixRef() {} - EI_INHERIT_ASSIGNMENT_OPERATORS(EiMatrixRef) + EI_INHERIT_ASSIGNMENT_OPERATORS(MatrixRef) private: int _rows() const { return m_matrix.rows(); } diff --git a/src/Core/MatrixStorage.h b/src/Core/MatrixStorage.h index b3b3f9e06..1fbc96ebc 100644 --- a/src/Core/MatrixStorage.h +++ b/src/Core/MatrixStorage.h @@ -1,19 +1,19 @@ -// This file is part of Eigen, a lightweight C++ template library -// for linear algebra. Eigen itself is part of the KDE project. +// This file is part of gen, a lightweight C++ template library +// for linear algebra. gen itself is part of the KDE project. // // Copyright (C) 2006-2007 Benoit Jacob // -// Eigen is free software; you can redistribute it and/or modify it under the +// gen 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 +// gen 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 +// with gen; 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 @@ -29,7 +29,7 @@ template -class EiMatrixStorage +class MatrixStorage { protected: Scalar m_array[RowsAtCompileTime * ColsAtCompileTime]; @@ -44,18 +44,18 @@ class EiMatrixStorage { return ColsAtCompileTime; } public: - EiMatrixStorage(int rows, int cols) + MatrixStorage(int rows, int cols) { EI_UNUSED(rows); EI_UNUSED(cols); assert(RowsAtCompileTime > 0 && ColsAtCompileTime > 0); } - ~EiMatrixStorage() {}; + ~MatrixStorage() {}; }; template -class EiMatrixStorage +class MatrixStorage { protected: int m_rows; @@ -79,18 +79,18 @@ class EiMatrixStorage { return ColsAtCompileTime; } public: - EiMatrixStorage(int rows, int cols) : m_rows(rows) + MatrixStorage(int rows, int cols) : m_rows(rows) { assert(m_rows > 0 && cols == ColsAtCompileTime); m_array = new Scalar[m_rows * ColsAtCompileTime]; } - ~EiMatrixStorage() + ~MatrixStorage() { delete[] m_array; } }; template -class EiMatrixStorage +class MatrixStorage { protected: int m_cols; @@ -114,18 +114,18 @@ class EiMatrixStorage { return m_cols; } public: - EiMatrixStorage(int rows, int cols) : m_cols(cols) + MatrixStorage(int rows, int cols) : m_cols(cols) { assert(rows == RowsAtCompileTime && cols > 0); m_array = new Scalar[m_cols * RowsAtCompileTime]; } - ~EiMatrixStorage() + ~MatrixStorage() { delete[] m_array; } }; template -class EiMatrixStorage +class MatrixStorage { protected: int m_rows, m_cols; @@ -150,13 +150,13 @@ class EiMatrixStorage { return m_cols; } public: - EiMatrixStorage(int rows, int cols) : m_rows(rows), m_cols(cols) + MatrixStorage(int rows, int cols) : m_rows(rows), m_cols(cols) { assert(m_rows > 0 && m_cols > 0); m_array = new Scalar[m_rows * m_cols]; } - ~EiMatrixStorage() + ~MatrixStorage() { delete[] m_array; } }; diff --git a/src/Core/Minor.h b/src/Core/Minor.h index 217ee9059..11ca541bc 100644 --- a/src/Core/Minor.h +++ b/src/Core/Minor.h @@ -1,19 +1,19 @@ -// This file is part of Eigen, a lightweight C++ template library -// for linear algebra. Eigen itself is part of the KDE project. +// This file is part of gen, a lightweight C++ template library +// for linear algebra. gen itself is part of the KDE project. // // Copyright (C) 2006-2007 Benoit Jacob // -// Eigen is free software; you can redistribute it and/or modify it under the +// gen 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 +// gen 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 +// with gen; 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 @@ -26,35 +26,35 @@ #ifndef EI_MINOR_H #define EI_MINOR_H -template class EiMinor - : public EiObject > +template class Minor + : public Object > { public: typedef typename MatrixType::Scalar Scalar; typedef typename MatrixType::Ref MatRef; - friend class EiObject >; + friend class Object >; static const int - RowsAtCompileTime = (MatrixType::RowsAtCompileTime != EiDynamic) ? - MatrixType::RowsAtCompileTime - 1 : EiDynamic, - ColsAtCompileTime = (MatrixType::ColsAtCompileTime != EiDynamic) ? - MatrixType::ColsAtCompileTime - 1 : EiDynamic; + RowsAtCompileTime = (MatrixType::RowsAtCompileTime != Dynamic) ? + MatrixType::RowsAtCompileTime - 1 : Dynamic, + ColsAtCompileTime = (MatrixType::ColsAtCompileTime != Dynamic) ? + MatrixType::ColsAtCompileTime - 1 : Dynamic; - EiMinor(const MatRef& matrix, + Minor(const MatRef& matrix, int row, int col = 0) : m_matrix(matrix), m_row(row), m_col(col) { EI_CHECK_RANGES(matrix, row, col); } - EiMinor(const EiMinor& other) + Minor(const Minor& other) : m_matrix(other.m_matrix), m_row(other.m_row), m_col(other.m_col) {} - EI_INHERIT_ASSIGNMENT_OPERATORS(EiMinor) + EI_INHERIT_ASSIGNMENT_OPERATORS(Minor) private: - EiMinor& _ref() { return *this; } - const EiMinor& _constRef() const { return *this; } + Minor& _ref() { return *this; } + const Minor& _constRef() const { return *this; } int _rows() const { return m_matrix.rows() - 1; } int _cols() const { return m_matrix.cols() - 1; } @@ -74,10 +74,10 @@ template class EiMinor }; template -EiMinor -EiObject::minor(int row, int col) +Minor +Object::minor(int row, int col) { - return EiMinor(static_cast(this)->ref(), row, col); + return Minor(static_cast(this)->ref(), row, col); } #endif // EI_MINOR_H diff --git a/src/Core/Numeric.h b/src/Core/Numeric.h index 23a6c03e6..264c7a549 100644 --- a/src/Core/Numeric.h +++ b/src/Core/Numeric.h @@ -1,20 +1,20 @@ -// This file is part of Eigen, a lightweight C++ template library -// for linear algebra. Eigen itself is part of the KDE project. +// This file is part of gen, a lightweight C++ template library +// for linear algebra. gen itself is part of the KDE project. // // Copyright (C) 2006-2007 Benoit Jacob // -// Eigen is free software; you can redistribute it and/or modify it under the +// gen 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 +// gen 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 +// with gen; 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 @@ -27,9 +27,9 @@ #ifndef EI_NUMERIC_H #define EI_NUMERIC_H -template struct EiNumTraits; +template struct NumTraits; -template<> struct EiNumTraits +template<> struct NumTraits { typedef int Real; typedef double FloatingPoint; @@ -54,7 +54,7 @@ template<> struct EiNumTraits } }; -template<> struct EiNumTraits +template<> struct NumTraits { typedef float Real; typedef float FloatingPoint; @@ -76,7 +76,7 @@ template<> struct EiNumTraits } }; -template<> struct EiNumTraits +template<> struct NumTraits { typedef double Real; typedef double FloatingPoint; @@ -98,17 +98,17 @@ template<> struct EiNumTraits } }; -template struct EiNumTraits > +template struct NumTraits > { typedef _Real Real; typedef std::complex Complex; typedef std::complex FloatingPoint; - typedef typename EiNumTraits::FloatingPoint RealFloatingPoint; + typedef typename NumTraits::FloatingPoint RealFloatingPoint; static const bool IsComplex = true; - static const bool HasFloatingPoint = EiNumTraits::HasFloatingPoint; + static const bool HasFloatingPoint = NumTraits::HasFloatingPoint; - static Real epsilon() { return EiNumTraits::epsilon(); } + static Real epsilon() { return NumTraits::epsilon(); } static Real real(const Complex& x) { return std::real(x); } static Real imag(const Complex& x) { return std::imag(x); } static Complex conj(const Complex& x) { return std::conj(x); } @@ -120,48 +120,48 @@ template struct EiNumTraits > { return std::real(x) * std::real(x) + std::imag(x) * std::imag(x); } static Complex rand() { - return Complex(EiNumTraits::rand(), EiNumTraits::rand()); + return Complex(NumTraits::rand(), NumTraits::rand()); } }; -template typename EiNumTraits::Real EiReal(const T& x) -{ return EiNumTraits::real(x); } +template typename NumTraits::Real Real(const T& x) +{ return NumTraits::real(x); } -template typename EiNumTraits::Real EiImag(const T& x) -{ return EiNumTraits::imag(x); } +template typename NumTraits::Real Imag(const T& x) +{ return NumTraits::imag(x); } -template T EiConj(const T& x) -{ return EiNumTraits::conj(x); } +template T Conj(const T& x) +{ return NumTraits::conj(x); } -template typename EiNumTraits::FloatingPoint EiSqrt(const T& x) -{ return EiNumTraits::sqrt(x); } +template typename NumTraits::FloatingPoint Sqrt(const T& x) +{ return NumTraits::sqrt(x); } -template typename EiNumTraits::RealFloatingPoint EiAbs(const T& x) -{ return EiNumTraits::abs(x); } +template typename NumTraits::RealFloatingPoint Abs(const T& x) +{ return NumTraits::abs(x); } -template typename EiNumTraits::Real EiAbs2(const T& x) -{ return EiNumTraits::abs2(x); } +template typename NumTraits::Real Abs2(const T& x) +{ return NumTraits::abs2(x); } -template T EiRand() -{ return EiNumTraits::rand(); } +template T Rand() +{ return NumTraits::rand(); } -template bool EiNegligible(const T& a, const T& b) +template bool Negligible(const T& a, const T& b) { - return(EiAbs(a) <= EiAbs(b) * EiNumTraits::epsilon()); + return(Abs(a) <= Abs(b) * NumTraits::epsilon()); } -template bool EiApprox(const T& a, const T& b) +template bool Approx(const T& a, const T& b) { - if(EiNumTraits::IsFloat) - return(EiAbs(a - b) <= std::min(EiAbs(a), EiAbs(b)) * EiNumTraits::epsilon()); + if(NumTraits::IsFloat) + return(Abs(a - b) <= std::min(Abs(a), Abs(b)) * NumTraits::epsilon()); else return(a == b); } -template bool EiLessThanOrApprox(const T& a, const T& b) +template bool LessThanOrApprox(const T& a, const T& b) { - if(EiNumTraits::IsFloat) - return(a < b || EiApprox(a, b)); + if(NumTraits::IsFloat) + return(a < b || Approx(a, b)); else return(a <= b); } diff --git a/src/Core/Object.h b/src/Core/Object.h index d1a310a20..f8d1cb174 100644 --- a/src/Core/Object.h +++ b/src/Core/Object.h @@ -1,19 +1,19 @@ -// This file is part of Eigen, a lightweight C++ template library -// for linear algebra. Eigen itself is part of the KDE project. +// This file is part of gen, a lightweight C++ template library +// for linear algebra. gen itself is part of the KDE project. // // Copyright (C) 2006-2007 Benoit Jacob // -// Eigen is free software; you can redistribute it and/or modify it under the +// gen 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 +// gen 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 +// with gen; 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 @@ -26,23 +26,23 @@ #ifndef EI_OBJECT_H #define EI_OBJECT_H -template class EiObject +template class Object { static const int RowsAtCompileTime = Derived::RowsAtCompileTime, ColsAtCompileTime = Derived::ColsAtCompileTime; template - void _copy_helper(const EiObject& other); + void _copy_helper(const Object& other); public: static const int SizeAtCompileTime - = RowsAtCompileTime == EiDynamic || ColsAtCompileTime == EiDynamic - ? EiDynamic : RowsAtCompileTime * ColsAtCompileTime; + = RowsAtCompileTime == Dynamic || ColsAtCompileTime == Dynamic + ? Dynamic : RowsAtCompileTime * ColsAtCompileTime; static const bool IsVector = RowsAtCompileTime == 1 || ColsAtCompileTime == 1; - typedef typename EiForwardDecl::Ref Ref; - typedef typename EiForwardDecl::ConstRef ConstRef; - typedef typename EiNumTraits::Real RealScalar; + typedef typename ForwardDecl::Ref Ref; + typedef typename ForwardDecl::ConstRef ConstRef; + typedef typename NumTraits::Real RealScalar; int rows() const { return static_cast(this)->_rows(); } int cols() const { return static_cast(this)->_cols(); } @@ -65,7 +65,7 @@ template class EiObject } template - Derived& operator=(const EiObject& other) + Derived& operator=(const Object& other) { assert(rows() == other.rows() && cols() == other.cols()); _copy_helper(other); @@ -74,20 +74,20 @@ template class EiObject //special case of the above template operator=. Strangely, g++ 4.1 failed to use //that template when OtherDerived == Derived - Derived& operator=(const EiObject& other) + Derived& operator=(const Object& other) { assert(rows() == other.rows() && cols() == other.cols()); _copy_helper(other); return *static_cast(this); } - EiRow row(int i); - EiColumn col(int i); - EiMinor minor(int row, int col); - EiBlock block(int startRow, int endRow, int startCol, int endCol); - EiTranspose transpose(); - EiConjugate conjugate() const; - EiTranspose > adjoint() const { return conjugate().transpose(); } + Row row(int i); + Column col(int i); + Minor minor(int row, int col); + Block block(int startRow, int endRow, int startCol, int endCol); + Transpose transpose(); + Conjugate conjugate() const; + Transpose > adjoint() const { return conjugate().transpose(); } Scalar trace() const; template @@ -95,9 +95,9 @@ template class EiObject RealScalar norm2() const; RealScalar norm() const; - EiScalarProduct normalized() const; + ScalarProduct normalized() const; - static EiEval > + static Eval > random(int rows = RowsAtCompileTime, int cols = ColsAtCompileTime); template @@ -106,15 +106,15 @@ template class EiObject bool isNegligible(const OtherDerived& other) const; template - EiMatrixProduct - lazyMul(const EiObject& other) const EI_ALWAYS_INLINE; + MatrixProduct + lazyMul(const Object& other) const EI_ALWAYS_INLINE; template - Derived& operator+=(const EiObject& other); + Derived& operator+=(const Object& other); template - Derived& operator-=(const EiObject& other); + Derived& operator-=(const Object& other); template - Derived& operator*=(const EiObject& other); + Derived& operator*=(const Object& other); Derived& operator*=(const int& other); Derived& operator*=(const float& other); @@ -150,13 +150,13 @@ template class EiObject else return write(index, 0); } - EiEval eval() const EI_ALWAYS_INLINE; + Eval eval() const EI_ALWAYS_INLINE; }; template std::ostream & operator << ( std::ostream & s, - const EiObject & m ) + const Object & m ) { for( int i = 0; i < m.rows(); i++ ) { diff --git a/src/Core/Random.h b/src/Core/Random.h index 70485028f..ff3f8b418 100644 --- a/src/Core/Random.h +++ b/src/Core/Random.h @@ -1,19 +1,19 @@ -// This file is part of Eigen, a lightweight C++ template library -// for linear algebra. Eigen itself is part of the KDE project. +// This file is part of gen, a lightweight C++ template library +// for linear algebra. gen itself is part of the KDE project. // // Copyright (C) 2006-2007 Benoit Jacob // -// Eigen is free software; you can redistribute it and/or modify it under the +// gen 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 +// gen 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 +// with gen; 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 @@ -26,24 +26,24 @@ #ifndef EI_RANDOM_H #define EI_RANDOM_H -template class EiRandom - : public EiObject > +template class Random + : public Object > { public: typedef typename MatrixType::Scalar Scalar; - friend class EiObject >; + friend class Object >; static const int RowsAtCompileTime = MatrixType::RowsAtCompileTime, ColsAtCompileTime = MatrixType::ColsAtCompileTime; - EiRandom(int rows, int cols) : m_rows(rows), m_cols(cols) + Random(int rows, int cols) : m_rows(rows), m_cols(cols) { assert(rows > 0 && cols > 0); } private: - EiRandom& _ref() { return *this; } - const EiRandom& _constRef() const { return *this; } + Random& _ref() { return *this; } + const Random& _constRef() const { return *this; } int _rows() const { return m_rows; } int _cols() const { return m_cols; } @@ -51,7 +51,7 @@ template class EiRandom { EI_UNUSED(row); EI_UNUSED(col); - return EiRand(); + return Rand(); } protected: @@ -59,9 +59,9 @@ template class EiRandom }; template -EiEval > EiObject::random(int rows, int cols) +Eval > Object::random(int rows, int cols) { - return EiRandom(rows, cols).eval(); + return Random(rows, cols).eval(); } #endif // EI_RANDOM_H diff --git a/src/Core/Row.h b/src/Core/Row.h index 39efc0b2b..1fe1cf7ca 100644 --- a/src/Core/Row.h +++ b/src/Core/Row.h @@ -1,19 +1,19 @@ -// This file is part of Eigen, a lightweight C++ template library -// for linear algebra. Eigen itself is part of the KDE project. +// This file is part of gen, a lightweight C++ template library +// for linear algebra. gen itself is part of the KDE project. // // Copyright (C) 2006-2007 Benoit Jacob // -// Eigen is free software; you can redistribute it and/or modify it under the +// gen 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 +// gen 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 +// with gen; 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 @@ -26,37 +26,37 @@ #ifndef EI_ROW_H #define EI_ROW_H -template class EiRow - : public EiObject > +template class Row + : public Object > { public: typedef typename MatrixType::Scalar Scalar; typedef typename MatrixType::Ref MatRef; - friend class EiObject >; + friend class Object >; static const int RowsAtCompileTime = 1, ColsAtCompileTime = MatrixType::ColsAtCompileTime; - EiRow(const MatRef& matrix, int row) + Row(const MatRef& matrix, int row) : m_matrix(matrix), m_row(row) { EI_CHECK_ROW_RANGE(matrix, row); } - EiRow(const EiRow& other) + Row(const Row& other) : m_matrix(other.m_matrix), m_row(other.m_row) {} template - EiRow& operator=(const EiObject& other) + Row& operator=(const Object& other) { - return EiObject >::operator=(other); + return Object >::operator=(other); } - EI_INHERIT_ASSIGNMENT_OPERATORS(EiRow) + EI_INHERIT_ASSIGNMENT_OPERATORS(Row) private: - EiRow& _ref() { return *this; } - const EiRow& _constRef() const { return *this; } + Row& _ref() { return *this; } + const Row& _constRef() const { return *this; } int _rows() const { return 1; } int _cols() const { return m_matrix.cols(); } @@ -79,10 +79,10 @@ template class EiRow }; template -EiRow -EiObject::row(int i) +Row +Object::row(int i) { - return EiRow(static_cast(this)->ref(), i); + return Row(static_cast(this)->ref(), i); } #endif // EI_ROW_H diff --git a/src/Core/ScalarOps.h b/src/Core/ScalarOps.h index c058978e6..dc0709687 100644 --- a/src/Core/ScalarOps.h +++ b/src/Core/ScalarOps.h @@ -1,19 +1,19 @@ -// This file is part of Eigen, a lightweight C++ template library -// for linear algebra. Eigen itself is part of the KDE project. +// This file is part of gen, a lightweight C++ template library +// for linear algebra. gen itself is part of the KDE project. // // Copyright (C) 2006-2007 Benoit Jacob // -// Eigen is free software; you can redistribute it and/or modify it under the +// gen 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 +// gen 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 +// with gen; 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 @@ -26,28 +26,28 @@ #ifndef EI_SCALAROPS_H #define EI_SCALAROPS_H -template class EiScalarProduct - : public EiObject > +template class ScalarProduct + : public Object > { public: typedef typename MatrixType::Scalar Scalar; typedef typename MatrixType::ConstRef MatRef; - friend class EiObject >; + friend class Object >; static const int RowsAtCompileTime = MatrixType::RowsAtCompileTime, ColsAtCompileTime = MatrixType::ColsAtCompileTime; - EiScalarProduct(const MatRef& matrix, Scalar scalar) + ScalarProduct(const MatRef& matrix, Scalar scalar) : m_matrix(matrix), m_scalar(scalar) {} - EiScalarProduct(const EiScalarProduct& other) + ScalarProduct(const ScalarProduct& other) : m_matrix(other.m_matrix), m_scalar(other.m_scalar) {} - EI_INHERIT_ASSIGNMENT_OPERATORS(EiScalarProduct) + EI_INHERIT_ASSIGNMENT_OPERATORS(ScalarProduct) private: - const EiScalarProduct& _ref() const { return *this; } - const EiScalarProduct& _constRef() const { return *this; } + const ScalarProduct& _ref() const { return *this; } + const ScalarProduct& _constRef() const { return *this; } int _rows() const { return m_matrix.rows(); } int _cols() const { return m_matrix.cols(); } @@ -63,40 +63,40 @@ template class EiScalarProduct #define EI_MAKE_SCALAR_OPS(OtherScalar) \ template \ -EiScalarProduct \ -operator*(const EiObject& matrix, \ +ScalarProduct \ +operator*(const Object& matrix, \ OtherScalar scalar) \ { \ - return EiScalarProduct(matrix.constRef(), scalar); \ + return ScalarProduct(matrix.constRef(), scalar); \ } \ \ template \ -EiScalarProduct \ +ScalarProduct \ operator*(OtherScalar scalar, \ - const EiObject& matrix) \ + const Object& matrix) \ { \ - return EiScalarProduct(matrix.constRef(), scalar); \ + return ScalarProduct(matrix.constRef(), scalar); \ } \ \ template \ -EiScalarProduct \ -operator/(const EiObject& matrix, \ +ScalarProduct \ +operator/(const Object& matrix, \ OtherScalar scalar) \ { \ - assert(EiNumTraits::HasFloatingPoint); \ + assert(NumTraits::HasFloatingPoint); \ return matrix * (static_cast(1) / scalar); \ } \ \ template \ Derived & \ -EiObject::operator*=(const OtherScalar &other) \ +Object::operator*=(const OtherScalar &other) \ { \ return *this = *this * other; \ } \ \ template \ Derived & \ -EiObject::operator/=(const OtherScalar &other) \ +Object::operator/=(const OtherScalar &other) \ { \ return *this = *this / other; \ } diff --git a/src/Core/Trace.h b/src/Core/Trace.h index 80c5dbed1..41394cffa 100644 --- a/src/Core/Trace.h +++ b/src/Core/Trace.h @@ -1,19 +1,19 @@ -// This file is part of Eigen, a lightweight C++ template library -// for linear algebra. Eigen itself is part of the KDE project. +// This file is part of gen, a lightweight C++ template library +// for linear algebra. gen itself is part of the KDE project. // // Copyright (C) 2006-2007 Benoit Jacob // -// Eigen is free software; you can redistribute it and/or modify it under the +// gen 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 +// gen 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 +// with gen; 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 @@ -26,16 +26,16 @@ #ifndef EI_TRACE_H #define EI_TRACE_H -template struct EiTraceUnroller +template struct TraceUnroller { static void run(const Derived &mat, typename Derived::Scalar &trace) { - EiTraceUnroller::run(mat, trace); + TraceUnroller::run(mat, trace); trace += mat(Index, Index); } }; -template struct EiTraceUnroller<0, Rows, Derived> +template struct TraceUnroller<0, Rows, Derived> { static void run(const Derived &mat, typename Derived::Scalar &trace) { @@ -43,7 +43,7 @@ template struct EiTraceUnroller<0, Rows, Derived> } }; -template struct EiTraceUnroller +template struct TraceUnroller { static void run(const Derived &mat, typename Derived::Scalar &trace) { @@ -53,12 +53,12 @@ template struct EiTraceUnroller -Scalar EiObject::trace() const +Scalar Object::trace() const { assert(rows() == cols()); Scalar res; - if(RowsAtCompileTime != EiDynamic && RowsAtCompileTime <= 16) - EiTraceUnroller + if(RowsAtCompileTime != Dynamic && RowsAtCompileTime <= 16) + TraceUnroller ::run(*static_cast(this), res); else { diff --git a/src/Core/Transpose.h b/src/Core/Transpose.h index 90a9b727c..81f1090dd 100644 --- a/src/Core/Transpose.h +++ b/src/Core/Transpose.h @@ -1,19 +1,19 @@ -// This file is part of Eigen, a lightweight C++ template library -// for linear algebra. Eigen itself is part of the KDE project. +// This file is part of gen, a lightweight C++ template library +// for linear algebra. gen itself is part of the KDE project. // // Copyright (C) 2006-2007 Benoit Jacob // -// Eigen is free software; you can redistribute it and/or modify it under the +// gen 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 +// gen 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 +// with gen; 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 @@ -26,27 +26,27 @@ #ifndef EI_TRANSPOSE_H #define EI_TRANSPOSE_H -template class EiTranspose - : public EiObject > +template class Transpose + : public Object > { public: typedef typename MatrixType::Scalar Scalar; typedef typename MatrixType::Ref MatRef; - friend class EiObject >; + friend class Object >; static const int RowsAtCompileTime = MatrixType::ColsAtCompileTime, ColsAtCompileTime = MatrixType::RowsAtCompileTime; - EiTranspose(const MatRef& matrix) : m_matrix(matrix) {} + Transpose(const MatRef& matrix) : m_matrix(matrix) {} - EiTranspose(const EiTranspose& other) + Transpose(const Transpose& other) : m_matrix(other.m_matrix) {} - EI_INHERIT_ASSIGNMENT_OPERATORS(EiTranspose) + EI_INHERIT_ASSIGNMENT_OPERATORS(Transpose) private: - EiTranspose& _ref() { return *this; } - const EiTranspose& _constRef() const { return *this; } + Transpose& _ref() { return *this; } + const Transpose& _constRef() const { return *this; } int _rows() const { return m_matrix.cols(); } int _cols() const { return m_matrix.rows(); } @@ -65,10 +65,10 @@ template class EiTranspose }; template -EiTranspose -EiObject::transpose() +Transpose +Object::transpose() { - return EiTranspose(static_cast(this)->ref()); + return Transpose(static_cast(this)->ref()); } #endif // EI_TRANSPOSE_H diff --git a/src/Core/Util.h b/src/Core/Util.h index 460eecb1a..6871758c2 100644 --- a/src/Core/Util.h +++ b/src/Core/Util.h @@ -1,19 +1,19 @@ -// This file is part of Eigen, a lightweight C++ template library -// for linear algebra. Eigen itself is part of the KDE project. +// This file is part of gen, a lightweight C++ template library +// for linear algebra. gen itself is part of the KDE project. // // Copyright (C) 2006-2007 Benoit Jacob // -// Eigen is free software; you can redistribute it and/or modify it under the +// gen 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 +// gen 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 +// with gen; 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 @@ -26,12 +26,12 @@ #ifndef EI_UTIL_H #define EI_UTIL_H -#include -#include -#include - #undef minor +#define USING_EIGEN_DATA_TYPES \ +EI_USING_MATRIX_TYPEDEFS \ +using Eigen::Matrix; + #define EI_UNUSED(x) (void)x #define EI_CHECK_RANGES(matrix, row, col) \ assert(row >= 0 && row < (matrix).rows() && col >= 0 && col < (matrix).cols()) @@ -41,36 +41,36 @@ assert(col >= 0 && col < (matrix).cols()) //forward declarations -template class EiMatrix; -template class EiMatrixRef; -template class EiMatrixConstRef; -template class EiRow; -template class EiColumn; -template class EiMinor; -template class EiBlock; -template class EiTranspose; -template class EiConjugate; -template class EiSum; -template class EiDifference; -template class EiMatrixProduct; -template class EiScalarProduct; -template class EiRandom; -template class EiEval; +template class Matrix; +template class MatrixRef; +template class MatrixConstRef; +template class Row; +template class Column; +template class Minor; +template class Block; +template class Transpose; +template class Conjugate; +template class Sum; +template class Difference; +template class MatrixProduct; +template class ScalarProduct; +template class Random; +template class Eval; -template struct EiForwardDecl +template struct ForwardDecl { typedef T Ref; typedef T ConstRef; }; template -struct EiForwardDecl > +struct ForwardDecl > { - typedef EiMatrixRef > Ref; - typedef EiMatrixConstRef > ConstRef; + typedef MatrixRef > Ref; + typedef MatrixConstRef > ConstRef; }; -const int EiDynamic = -1; +const int Dynamic = -1; #define EI_LOOP_UNROLLING_LIMIT 25 @@ -86,20 +86,20 @@ const int EiDynamic = -1; #define EI_INHERIT_ASSIGNMENT_OPERATOR(Derived, Op) \ template \ -Derived& operator Op(const EiObject& other) \ +Derived& operator Op(const Object& other) \ { \ - return EiObject::operator Op(other); \ + return Object::operator Op(other); \ } \ Derived& operator Op(const Derived& other) \ { \ - return EiObject::operator Op(other); \ + return Object::operator Op(other); \ } #define EI_INHERIT_SCALAR_ASSIGNMENT_OPERATOR(Derived, Op) \ template \ Derived& operator Op(const Other& scalar) \ { \ - return EiObject::operator Op(scalar); \ + return Object::operator Op(scalar); \ } #define EI_INHERIT_ASSIGNMENT_OPERATORS(Derived) \ diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 352daa291..58a088eb3 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -15,6 +15,6 @@ QT4_AUTOMOC(${test_SRCS}) ADD_EXECUTABLE(test ${test_SRCS}) TARGET_LINK_LIBRARIES(test ${QT_QTCORE_LIBRARY} ${QT_QTTEST_LIBRARY}) -ADD_TEST(Eigen test) +ADD_TEST(gen test) ENDIF(BUILD_TESTS) diff --git a/test/main.cpp b/test/main.cpp index f5c758961..fa0348002 100644 --- a/test/main.cpp +++ b/test/main.cpp @@ -1,19 +1,19 @@ -// This file is part of Eigen, a lightweight C++ template library -// for linear algebra. Eigen itself is part of the KDE project. +// This file is part of gen, a lightweight C++ template library +// for linear algebra. gen itself is part of the KDE project. // // Copyright (C) 2006-2007 Benoit Jacob // -// Eigen is free software; you can redistribute it and/or modify it under the +// gen 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 +// gen 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 +// with gen; 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 @@ -25,7 +25,7 @@ #include "main.h" -EigenTest::EigenTest() +genTest::genTest() { unsigned int t = (unsigned int) time( NULL ); qDebug() << "Initializing random number generator with seed" @@ -33,5 +33,5 @@ EigenTest::EigenTest() srand(t); } -QTEST_APPLESS_MAIN( EigenTest ) +QTEST_APPLESS_MAIN( genTest ) #include "main.moc" diff --git a/test/main.h b/test/main.h index 05853481c..c5aa3c085 100644 --- a/test/main.h +++ b/test/main.h @@ -1,19 +1,19 @@ -// This file is part of Eigen, a lightweight C++ template library -// for linear algebra. Eigen itself is part of the KDE project. +// This file is part of gen, a lightweight C++ template library +// for linear algebra. gen itself is part of the KDE project. // // Copyright (C) 2006-2007 Benoit Jacob // -// Eigen is free software; you can redistribute it and/or modify it under the +// gen 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 +// gen 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 +// with gen; 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 @@ -29,17 +29,19 @@ #include #include "../src/Core.h" +USING_EIGEN_DATA_TYPES + #include #include using namespace std; -class EigenTest : public QObject +class genTest : public QObject { Q_OBJECT public: - EigenTest(); + genTest(); private slots: void testVectorOps(); @@ -47,7 +49,7 @@ class EigenTest : public QObject void testMatrixManip(); }; -template inline typename EiNumTraits::Real TestEpsilon(); +template inline typename Eigen::NumTraits::Real TestEpsilon(); template<> inline int TestEpsilon() { return 0; } template<> inline float TestEpsilon() { return 1e-2f; } template<> inline double TestEpsilon() { return 1e-4; } @@ -57,21 +59,21 @@ template<> inline double TestEpsilon >() { return TestEpsil template bool TestNegligible(const T& a, const T& b) { - return(EiAbs(a) <= EiAbs(b) * TestEpsilon()); + return(Abs(a) <= Abs(b) * TestEpsilon()); } template bool TestApprox(const T& a, const T& b) { - if(EiNumTraits::IsFloat) - return(EiAbs(a - b) <= std::min(EiAbs(a), EiAbs(b)) * TestEpsilon()); + if(Eigen::NumTraits::IsFloat) + return(Abs(a - b) <= std::min(Abs(a), Abs(b)) * TestEpsilon()); else return(a == b); } template bool TestLessThanOrApprox(const T& a, const T& b) { - if(EiNumTraits::IsFloat) - return(a < b || EiApprox(a, b)); + if(Eigen::NumTraits::IsFloat) + return(a < b || Approx(a, b)); else return(a <= b); } diff --git a/test/matrixmanip.cpp b/test/matrixmanip.cpp index dd1887c87..c8863d183 100644 --- a/test/matrixmanip.cpp +++ b/test/matrixmanip.cpp @@ -1,19 +1,19 @@ -// This file is part of Eigen, a lightweight C++ template library -// for linear algebra. Eigen itself is part of the KDE project. +// This file is part of gen, a lightweight C++ template library +// for linear algebra. gen itself is part of the KDE project. // // Copyright (C) 2006-2007 Benoit Jacob // -// Eigen is free software; you can redistribute it and/or modify it under the +// gen 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 +// gen 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 +// with gen; 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 @@ -42,12 +42,12 @@ template void matrixManip(const MatrixType& m) a.minor(i, j) -= a.block(1, rows-1, 1, cols-1).eval(); } -void EigenTest::testMatrixManip() +void genTest::testMatrixManip() { - matrixManip(EiMatrix()); - matrixManip(EiMatrix()); - matrixManip(EiMatrix, 4,3>()); - matrixManip(EiMatrixXi(2, 2)); - matrixManip(EiMatrixXd(3, 5)); - matrixManip(EiMatrixXcf(4, 4)); + matrixManip(Matrix()); + matrixManip(Matrix()); + matrixManip(Matrix, 4,3>()); + matrixManip(MatrixXi(2, 2)); + matrixManip(MatrixXd(3, 5)); + matrixManip(MatrixXcf(4, 4)); } diff --git a/test/matrixops.cpp b/test/matrixops.cpp index 8dc1aad83..100dbeffb 100644 --- a/test/matrixops.cpp +++ b/test/matrixops.cpp @@ -1,19 +1,19 @@ -// This file is part of Eigen, a lightweight C++ template library -// for linear algebra. Eigen itself is part of the KDE project. +// This file is part of gen, a lightweight C++ template library +// for linear algebra. gen itself is part of the KDE project. // // Copyright (C) 2006-2007 Benoit Jacob // -// Eigen is free software; you can redistribute it and/or modify it under the +// gen 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 +// gen 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 +// with gen; 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 @@ -59,16 +59,16 @@ template(), EiMatrix()); - matrixOps(EiMatrix(), EiMatrix()); - matrixOps(EiMatrix(), EiMatrix()); - matrixOps(EiMatrix, 4,3>(), EiMatrix, 3,4>()); - matrixOps(EiMatrixXf(1, 1), EiMatrixXf(1, 3)); - matrixOps(EiMatrixXi(2, 2), EiMatrixXi(2, 2)); - matrixOps(EiMatrixXd(3, 5), EiMatrixXd(5, 1)); - matrixOps(EiMatrixXcf(4, 4), EiMatrixXcf(4, 4)); - matrixOps(EiMatrixXd(3, 5), EiMatrix()); - matrixOps(EiMatrix4cf(), EiMatrixXcf(4, 4)); + matrixOps(Matrix(), Matrix()); + matrixOps(Matrix(), Matrix()); + matrixOps(Matrix(), Matrix()); + matrixOps(Matrix, 4,3>(), Matrix, 3,4>()); + matrixOps(MatrixXf(1, 1), MatrixXf(1, 3)); + matrixOps(MatrixXi(2, 2), MatrixXi(2, 2)); + matrixOps(MatrixXd(3, 5), MatrixXd(5, 1)); + matrixOps(MatrixXcf(4, 4), MatrixXcf(4, 4)); + matrixOps(MatrixXd(3, 5), Matrix()); + matrixOps(Matrix4cf(), MatrixXcf(4, 4)); } diff --git a/test/vectorops.cpp b/test/vectorops.cpp index 659e9b5c8..87195ac36 100644 --- a/test/vectorops.cpp +++ b/test/vectorops.cpp @@ -1,19 +1,19 @@ -// This file is part of Eigen, a lightweight C++ template library -// for linear algebra. Eigen itself is part of the KDE project. +// This file is part of gen, a lightweight C++ template library +// for linear algebra. gen itself is part of the KDE project. // // Copyright (C) 2006-2007 Benoit Jacob // -// Eigen is free software; you can redistribute it and/or modify it under the +// gen 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 +// gen 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 +// with gen; 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 @@ -50,13 +50,13 @@ template void vectorOps(const VectorType& v) a += (a + a).eval(); } -void EigenTest::testVectorOps() +void genTest::testVectorOps() { - vectorOps(EiVector2i()); - vectorOps(EiVector3d()); - vectorOps(EiVector4cf()); - vectorOps(EiVectorXf(1)); - vectorOps(EiVectorXi(2)); - vectorOps(EiVectorXd(3)); - vectorOps(EiVectorXcf(4)); + vectorOps(Vector2i()); + vectorOps(Vector3d()); + vectorOps(Vector4cf()); + vectorOps(VectorXf(1)); + vectorOps(VectorXi(2)); + vectorOps(VectorXd(3)); + vectorOps(VectorXcf(4)); }