test_Factors.py
Go to the documentation of this file.
1 """
2 GTSAM Copyright 2010-2019, Georgia Tech Research Corporation,
3 Atlanta, Georgia 30332-0415
4 All Rights Reserved
5 
6 See LICENSE for the license information
7 
8 Unit tests for various factors.
9 
10 Author: Varun Agrawal
11 """
12 import unittest
13 
14 import gtsam
15 import numpy as np
16 from gtsam.utils.test_case import GtsamTestCase
17 
18 
20  """
21  Test various instantiations of NonlinearEquality2.
22  """
23 
24  def test_point3(self):
25  """Test for Point3 version."""
26  factor = gtsam.NonlinearEquality2Point3(0, 1)
27  error = factor.evaluateError(gtsam.Point3(0, 0, 0),
28  gtsam.Point3(0, 0, 0))
29 
30  np.testing.assert_allclose(error, np.zeros(3))
31 
32 
34  """Test JacobianFactor"""
35 
37  """Test construction from GaussianFactorGraph."""
39  jf = gtsam.JacobianFactor(gfg)
40  self.assertIsInstance(jf, gtsam.JacobianFactor)
41 
43  nfg.push_back(gtsam.PriorFactorDouble(1, 0.0, gtsam.noiseModel.Isotropic.Sigma(1, 1.0)))
44  values = gtsam.Values()
45  values.insert(1, 0.0)
46  gfg = nfg.linearize(values)
47  jf = gtsam.JacobianFactor(gfg)
48  self.assertIsInstance(jf, gtsam.JacobianFactor)
49 
50 
51 if __name__ == "__main__":
52  unittest.main()
test_Factors.TestNonlinearEquality2Factor
Definition: test_Factors.py:19
gtsam::JacobianFactor
Definition: JacobianFactor.h:91
gtsam::GaussianFactorGraph
Definition: GaussianFactorGraph.h:73
gtsam::NonlinearFactorGraph
Definition: NonlinearFactorGraph.h:55
gtsam::utils.test_case
Definition: test_case.py:1
test_Factors.TestNonlinearEquality2Factor.test_point3
def test_point3(self)
Definition: test_Factors.py:24
test_Factors.TestJacobianFactor.test_gaussian_factor_graph
def test_gaussian_factor_graph(self)
Definition: test_Factors.py:36
gtsam::Values
Definition: Values.h:65
gtsam::utils.test_case.GtsamTestCase
Definition: test_case.py:16
gtsam::Point3
Vector3 Point3
Definition: Point3.h:38
test_Factors.TestJacobianFactor
Definition: test_Factors.py:33
gtsam::noiseModel::Isotropic::Sigma
static shared_ptr Sigma(size_t dim, double sigma, bool smart=true)
Definition: NoiseModel.cpp:625


gtsam
Author(s):
autogenerated on Sun Dec 22 2024 04:15:58