From 61de15f3610d11e0bbd2eccc02c21e7abb343ac1 Mon Sep 17 00:00:00 2001 From: Benoit Jacob Date: Thu, 11 Oct 2007 20:14:01 +0000 Subject: Democracy 1 - 0 Dictatorship After huge thread on eigen mailing list, it appears that i'm the only one in favor of prefix Ei. Everybody else prefers namespace Eigen like we did in Eigen 1. So, revert. Also add a macro USING_EIGEN_DATA_TYPES that application programmers can use to automatically do "using"on the Matrix class and its matrix/vector typedefs: using Eigen::Matrix; using Eigen::Matrix2d; using Eigen::Vector2d; ... (the list of typedefs is really long). thanks to the suffixes, the Vector typedefs aren't really polluting. CCMAIL:eigen@lists.tuxfamily.org P.S. Danny, please skip this one :) I know you already reported the namespace->prefix move, now that one would be too much noise :) --- test/CMakeLists.txt | 2 +- test/main.cpp | 14 +++++++------- test/main.h | 28 +++++++++++++++------------- test/matrixmanip.cpp | 24 ++++++++++++------------ test/matrixops.cpp | 32 ++++++++++++++++---------------- test/vectorops.cpp | 26 +++++++++++++------------- 6 files changed, 64 insertions(+), 62 deletions(-) (limited to 'test') 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)); } -- cgit v1.2.3