testErrors.cpp
Go to the documentation of this file.
1 /* ----------------------------------------------------------------------------
2 
3  * GTSAM Copyright 2010, Georgia Tech Research Corporation,
4  * Atlanta, Georgia 30332-0415
5  * All Rights Reserved
6  * Authors: Frank Dellaert, et al. (see THANKS for the full author list)
7 
8  * See LICENSE for the license information
9 
10  * -------------------------------------------------------------------------- */
11 
18 #include <boost/assign/std/list.hpp> // for +=
19 using namespace boost::assign;
20 
22 #include <gtsam/base/Testable.h>
23 #include <gtsam/linear/Errors.h>
24 
25 using namespace std;
26 using namespace gtsam;
27 
28 /* ************************************************************************* */
30 {
31  Errors e;
32  e += Vector2(1.0,2.0), Vector3(3.0,4.0,5.0);
33  DOUBLES_EQUAL(1+4+9+16+25,dot(e,e),1e-9);
34 
35  axpy(2.0,e,e);
37  expected += Vector2(3.0,6.0), Vector3(9.0,12.0,15.0);
38  CHECK(assert_equal(expected,e));
39 }
40 
41 /* ************************************************************************* */
42 int main() {
43  TestResult tr;
44  return TestRegistry::runAllTests(tr);
45 }
46 /* ************************************************************************* */
#define CHECK(condition)
Definition: Test.h:109
vector of errors
Concept check for values that can be used in unit tests.
static int runAllTests(TestResult &result)
Eigen::Vector3d Vector3
Definition: Vector.h:43
Matrix expected
Definition: testMatrix.cpp:974
#define DOUBLES_EQUAL(expected, actual, threshold)
Definition: Test.h:142
Definition: Half.h:150
Scalar EIGEN_BLAS_FUNC() dot(int *n, RealScalar *px, int *incx, RealScalar *py, int *incy)
Array< double, 1, 3 > e(1./3., 0.5, 2.)
TEST(Errors, arithmetic)
Definition: testErrors.cpp:29
traits
Definition: chartTesting.h:28
bool assert_equal(const Matrix &expected, const Matrix &actual, double tol)
Definition: Matrix.cpp:42
Annotation to mark enums as an arithmetic type.
Definition: attr.h:75
Eigen::Vector2d Vector2
Definition: Vector.h:42
int EIGEN_BLAS_FUNC() axpy(const int *n, const RealScalar *palpha, const RealScalar *px, const int *incx, RealScalar *py, const int *incy)
Definition: level1_impl.h:12
int main()
Definition: testErrors.cpp:42


gtsam
Author(s):
autogenerated on Sat May 8 2021 02:46:28