aboutsummaryrefslogtreecommitdiffhomepage
path: root/test
diff options
context:
space:
mode:
authorGravatar Benoit Jacob <jacob.benoit.1@gmail.com>2007-10-11 20:14:01 +0000
committerGravatar Benoit Jacob <jacob.benoit.1@gmail.com>2007-10-11 20:14:01 +0000
commit61de15f3610d11e0bbd2eccc02c21e7abb343ac1 (patch)
treed33eb0fae1fdd6e938df60a068bc79c53b4d0197 /test
parent3c98677376fb33f11fe2f786a49bc97b07743711 (diff)
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 :)
Diffstat (limited to 'test')
-rw-r--r--test/CMakeLists.txt2
-rw-r--r--test/main.cpp14
-rw-r--r--test/main.h28
-rw-r--r--test/matrixmanip.cpp24
-rw-r--r--test/matrixops.cpp32
-rw-r--r--test/vectorops.cpp26
6 files changed, 64 insertions, 62 deletions
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 <jacob@math.jussieu.fr>
//
-// 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 <jacob@math.jussieu.fr>
//
-// 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 <QtTest/QtTest>
#include "../src/Core.h"
+USING_EIGEN_DATA_TYPES
+
#include <cstdlib>
#include <ctime>
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<typename T> inline typename EiNumTraits<T>::Real TestEpsilon();
+template<typename T> inline typename Eigen::NumTraits<T>::Real TestEpsilon();
template<> inline int TestEpsilon<int>() { return 0; }
template<> inline float TestEpsilon<float>() { return 1e-2f; }
template<> inline double TestEpsilon<double>() { return 1e-4; }
@@ -57,21 +59,21 @@ template<> inline double TestEpsilon<std::complex<double> >() { return TestEpsil
template<typename T> bool TestNegligible(const T& a, const T& b)
{
- return(EiAbs(a) <= EiAbs(b) * TestEpsilon<T>());
+ return(Abs(a) <= Abs(b) * TestEpsilon<T>());
}
template<typename T> bool TestApprox(const T& a, const T& b)
{
- if(EiNumTraits<T>::IsFloat)
- return(EiAbs(a - b) <= std::min(EiAbs(a), EiAbs(b)) * TestEpsilon<T>());
+ if(Eigen::NumTraits<T>::IsFloat)
+ return(Abs(a - b) <= std::min(Abs(a), Abs(b)) * TestEpsilon<T>());
else
return(a == b);
}
template<typename T> bool TestLessThanOrApprox(const T& a, const T& b)
{
- if(EiNumTraits<T>::IsFloat)
- return(a < b || EiApprox(a, b));
+ if(Eigen::NumTraits<T>::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 <jacob@math.jussieu.fr>
//
-// 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<typename MatrixType> 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<int, 2, 3>());
- matrixManip(EiMatrix<double, 3, 3>());
- matrixManip(EiMatrix<complex<float>, 4,3>());
- matrixManip(EiMatrixXi(2, 2));
- matrixManip(EiMatrixXd(3, 5));
- matrixManip(EiMatrixXcf(4, 4));
+ matrixManip(Matrix<int, 2, 3>());
+ matrixManip(Matrix<double, 3, 3>());
+ matrixManip(Matrix<complex<float>, 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 <jacob@math.jussieu.fr>
//
-// 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<typename MatrixType1,
QVERIFY( (d * e).rows() == rows1 && (d * e).cols() == cols2 );
}
-void EigenTest::testMatrixOps()
+void genTest::testMatrixOps()
{
- matrixOps(EiMatrix<float, 1, 1>(), EiMatrix<float, 1, 1>());
- matrixOps(EiMatrix<int, 2, 3>(), EiMatrix<int, 3, 1>());
- matrixOps(EiMatrix<double, 3, 3>(), EiMatrix<double, 3, 3>());
- matrixOps(EiMatrix<complex<float>, 4,3>(), EiMatrix<complex<float>, 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<double, 5, 1>());
- matrixOps(EiMatrix4cf(), EiMatrixXcf(4, 4));
+ matrixOps(Matrix<float, 1, 1>(), Matrix<float, 1, 1>());
+ matrixOps(Matrix<int, 2, 3>(), Matrix<int, 3, 1>());
+ matrixOps(Matrix<double, 3, 3>(), Matrix<double, 3, 3>());
+ matrixOps(Matrix<complex<float>, 4,3>(), Matrix<complex<float>, 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<double, 5, 1>());
+ 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 <jacob@math.jussieu.fr>
//
-// 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<typename VectorType> 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));
}