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 
19 #include <gtsam/base/Testable.h>
20 #include <gtsam/linear/Errors.h>
21 
22 using namespace std;
23 using namespace gtsam;
24 
25 /* ************************************************************************* */
27  Errors e = {Vector2(1.0, 2.0), Vector3(3.0, 4.0, 5.0)};
28  DOUBLES_EQUAL(1 + 4 + 9 + 16 + 25, dot(e, e), 1e-9);
29 
30  axpy(2.0, e, e);
31  const Errors expected = {Vector2(3.0, 6.0), Vector3(9.0, 12.0, 15.0)};
32  CHECK(assert_equal(expected, e));
33 }
34 
35 /* ************************************************************************* */
36 int main() {
37  TestResult tr;
38  return TestRegistry::runAllTests(tr);
39 }
40 /* ************************************************************************* */
#define CHECK(condition)
Definition: Test.h:108
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:971
#define DOUBLES_EQUAL(expected, actual, threshold)
Definition: Test.h:141
bool assert_equal(const Matrix &expected, const Matrix &actual, double tol)
Definition: Matrix.cpp:40
Definition: BFloat16.h:88
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:26
traits
Definition: chartTesting.h:28
Annotation to mark enums as an arithmetic type.
Definition: attr.h:116
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:36


gtsam
Author(s):
autogenerated on Tue Jul 4 2023 02:38:03