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)};
33 }
34 
35 /* ************************************************************************* */
36 int main() {
37  TestResult tr;
38  return TestRegistry::runAllTests(tr);
39 }
40 /* ************************************************************************* */
TestRegistry::runAllTests
static int runAllTests(TestResult &result)
Definition: TestRegistry.cpp:27
main
int main()
Definition: testErrors.cpp:36
e
Array< double, 1, 3 > e(1./3., 0.5, 2.)
Testable.h
Concept check for values that can be used in unit tests.
gtsam::Vector2
Eigen::Vector2d Vector2
Definition: Vector.h:42
TestHarness.h
gtsam::Vector3
Eigen::Vector3d Vector3
Definition: Vector.h:43
arithmetic
Annotation to mark enums as an arithmetic type.
Definition: attr.h:119
TEST
TEST(Errors, arithmetic)
Definition: testErrors.cpp:26
dot
Scalar EIGEN_BLAS_FUNC() dot(int *n, RealScalar *px, int *incx, RealScalar *py, int *incy)
Definition: level1_real_impl.h:49
DOUBLES_EQUAL
#define DOUBLES_EQUAL(expected, actual, threshold)
Definition: Test.h:141
axpy
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
cholesky::expected
Matrix expected
Definition: testMatrix.cpp:971
Errors.h
vector of errors
gtsam::FastList< Vector >
TestResult
Definition: TestResult.h:26
gtsam
traits
Definition: SFMdata.h:40
CHECK
#define CHECK(condition)
Definition: Test.h:108
std
Definition: BFloat16.h:88
gtsam::assert_equal
bool assert_equal(const Matrix &expected, const Matrix &actual, double tol)
Definition: Matrix.cpp:40


gtsam
Author(s):
autogenerated on Sat Nov 16 2024 04:07:22