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()
Vector3 Point3
Definition: Point3.h:38
static shared_ptr Sigma(size_t dim, double sigma, bool smart=true)
Definition: NoiseModel.cpp:594


gtsam
Author(s):
autogenerated on Tue Jul 4 2023 02:37:45