mirror of
https://gitlab.com/libeigen/eigen.git
synced 2026-04-10 11:34:33 +08:00
Removed Column and Row in favor of Block
This commit is contained in:
@@ -5,12 +5,12 @@
|
||||
//
|
||||
// Eigen is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU Lesser General Public
|
||||
// License as published by the Free Software Foundation; either
|
||||
// License as published by the Free Software Foundation; either
|
||||
// version 3 of the License, or (at your option) any later version.
|
||||
//
|
||||
// Alternatively, you can redistribute it and/or
|
||||
// modify it under the terms of the GNU General Public License as
|
||||
// published by the Free Software Foundation; either version 2 of
|
||||
// published by the Free Software Foundation; either version 2 of
|
||||
// the License, or (at your option) any later version.
|
||||
//
|
||||
// Eigen is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
@@ -18,7 +18,7 @@
|
||||
// FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License or the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Lesser General Public
|
||||
// You should have received a copy of the GNU Lesser General Public
|
||||
// License and a copy of the GNU General Public License along with
|
||||
// Eigen. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
@@ -27,13 +27,13 @@
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
QCoreApplication app(argc, argv);
|
||||
|
||||
|
||||
bool has_set_repeat = false;
|
||||
bool has_set_seed = false;
|
||||
bool need_help = false;
|
||||
unsigned int seed;
|
||||
int repeat;
|
||||
|
||||
|
||||
QStringList args = QCoreApplication::instance()->arguments();
|
||||
args.takeFirst(); // throw away the first argument (path to executable)
|
||||
foreach(QString arg, args)
|
||||
@@ -74,7 +74,7 @@ int main(int argc, char *argv[])
|
||||
need_help = true;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if(need_help)
|
||||
{
|
||||
qDebug() << "This test application takes the following optional arguments:";
|
||||
@@ -82,10 +82,10 @@ int main(int argc, char *argv[])
|
||||
qDebug() << " sN Use N as seed for random numbers (default: based on current time)";
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
if(!has_set_seed) seed = (unsigned int) time(NULL);
|
||||
if(!has_set_repeat) repeat = DEFAULT_REPEAT;
|
||||
|
||||
|
||||
qDebug() << "Initializing random number generator with seed" << seed;
|
||||
srand(seed);
|
||||
qDebug() << "Repeating each test" << repeat << "times";
|
||||
|
||||
19
test/main.h
19
test/main.h
@@ -29,6 +29,7 @@
|
||||
|
||||
#include <cstdlib>
|
||||
#include <ctime>
|
||||
#include <iostream>
|
||||
|
||||
#define DEFAULT_REPEAT 50
|
||||
|
||||
@@ -36,9 +37,14 @@
|
||||
|
||||
namespace Eigen
|
||||
{
|
||||
struct ei_assert_exception
|
||||
{};
|
||||
static const bool should_raise_an_assert = false;
|
||||
|
||||
// Used to avoid to raise two exceptions at the time in which
|
||||
// case the exception is not properly catched.
|
||||
// This may happen when a second exceptions is raise in a destructor.
|
||||
static bool no_more_assert = false;
|
||||
|
||||
struct ei_assert_exception {};
|
||||
}
|
||||
|
||||
#define EI_PP_MAKE_STRING2(S) #S
|
||||
@@ -64,7 +70,7 @@
|
||||
}
|
||||
|
||||
#define assert(a) if (!(a)) { throw Eigen::ei_assert_exception();} \
|
||||
else if (Eigen::ei_push_assert) {ei_assert_list.push_back( std::string(EI_PP_MAKE_STRING(__FILE__)) + " (" + EI_PP_MAKE_STRING(__LINE__) + ") : " + #a );}
|
||||
else if (Eigen::ei_push_assert) {ei_assert_list.push_back( std::string(EI_PP_MAKE_STRING(__FILE__)" ("EI_PP_MAKE_STRING(__LINE__)") : "#a) );}
|
||||
|
||||
#define VERIFY_RAISES_ASSERT(a) {\
|
||||
try { \
|
||||
@@ -80,10 +86,13 @@
|
||||
|
||||
#else // EIGEN_DEBUG_ASSERTS
|
||||
|
||||
#define assert(a) if (!(a)) { throw Eigen::ei_assert_exception();}
|
||||
#define assert(a) if( (!(a)) && (!no_more_assert) ) { \
|
||||
Eigen::no_more_assert = true; \
|
||||
throw Eigen::ei_assert_exception(); \
|
||||
}
|
||||
|
||||
#define VERIFY_RAISES_ASSERT(a) {\
|
||||
try {a; QVERIFY(Eigen::should_raise_an_assert && # a); } \
|
||||
try { a; QVERIFY(Eigen::should_raise_an_assert && # a); } \
|
||||
catch (Eigen::ei_assert_exception e) { QVERIFY(true);} }
|
||||
|
||||
#endif // EIGEN_DEBUG_ASSERTS
|
||||
|
||||
Reference in New Issue
Block a user