2010-10-14 12:54:38 +08:00
|
|
|
/* ----------------------------------------------------------------------------
|
|
|
|
|
|
|
|
|
|
* GTSAM Copyright 2010, Georgia Tech Research Corporation,
|
|
|
|
|
* Atlanta, Georgia 30332-0415
|
|
|
|
|
* All Rights Reserved
|
|
|
|
|
* Authors: Frank Dellaert, et al. (see THANKS for the full author list)
|
|
|
|
|
|
|
|
|
|
* See LICENSE for the license information
|
|
|
|
|
|
|
|
|
|
* -------------------------------------------------------------------------- */
|
|
|
|
|
|
2011-10-14 11:23:14 +08:00
|
|
|
/**
|
|
|
|
|
* @file testErrors.cpp
|
|
|
|
|
* @date Feb 20, 2010
|
|
|
|
|
* @author Frank Dellaert
|
2010-02-21 08:01:43 +08:00
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
#include <boost/assign/std/list.hpp> // for +=
|
|
|
|
|
using namespace boost::assign;
|
|
|
|
|
|
2010-10-26 04:10:33 +08:00
|
|
|
#include <CppUnitLite/TestHarness.h>
|
2011-10-20 10:11:28 +08:00
|
|
|
#include <gtsam/base/Testable.h>
|
2010-08-20 01:23:19 +08:00
|
|
|
#include <gtsam/linear/Errors.h>
|
2010-02-21 08:01:43 +08:00
|
|
|
|
|
|
|
|
using namespace std;
|
|
|
|
|
using namespace gtsam;
|
|
|
|
|
|
|
|
|
|
/* ************************************************************************* */
|
|
|
|
|
TEST( Errors, arithmetic )
|
|
|
|
|
{
|
2012-10-02 22:40:07 +08:00
|
|
|
Errors e;
|
2014-11-23 08:35:27 +08:00
|
|
|
e += (Vector(2) << 1.0,2.0).finished(), (Vector(3) << 3.0,4.0,5.0).finished();
|
2012-10-02 22:40:07 +08:00
|
|
|
DOUBLES_EQUAL(1+4+9+16+25,dot(e,e),1e-9);
|
|
|
|
|
|
|
|
|
|
axpy(2.0,e,e);
|
|
|
|
|
Errors expected;
|
2014-11-23 08:35:27 +08:00
|
|
|
expected += (Vector(2) << 3.0,6.0).finished(), (Vector(3) << 9.0,12.0,15.0).finished();
|
2012-10-02 22:40:07 +08:00
|
|
|
CHECK(assert_equal(expected,e));
|
2010-02-21 08:01:43 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* ************************************************************************* */
|
|
|
|
|
int main() {
|
2012-10-02 22:40:07 +08:00
|
|
|
TestResult tr;
|
|
|
|
|
return TestRegistry::runAllTests(tr);
|
2010-02-21 08:01:43 +08:00
|
|
|
}
|
|
|
|
|
/* ************************************************************************* */
|