python
gtsam
tests
test_HybridValues.py
Go to the documentation of this file.
1
"""
2
GTSAM Copyright 2010-2022, 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 Hybrid Values.
9
Author: Shangjie Xue
10
"""
11
# pylint: disable=invalid-name, no-name-in-module, no-member
12
13
from
__future__
import
print_function
14
15
import
unittest
16
17
import
gtsam
18
import
numpy
as
np
19
from
gtsam.symbol_shorthand
import
C, X
20
from
gtsam.utils.test_case
import
GtsamTestCase
21
22
23
class
TestHybridValues
(
GtsamTestCase
):
24
"""Unit tests for HybridValues."""
25
26
def
test_basic
(self):
27
"""Test construction and basic methods of hybrid values."""
28
29
hv1 =
gtsam.HybridValues
()
30
hv1.insert(
X
(0), np.ones((3, 1)))
31
hv1.insert(
C
(0), 2)
32
33
hv2 =
gtsam.HybridValues
()
34
hv2.insert(
C
(0), 2)
35
hv2.insert(
X
(0), np.ones((3, 1)))
36
37
self.assertEqual(hv1.atDiscrete(
C
(0)), 2)
38
self.assertEqual(hv1.at(
X
(0))[0], np.ones((3, 1))[0])
39
40
41
if
__name__ ==
"__main__"
:
42
unittest.main()
gtsam::HybridValues
Definition:
HybridValues.h:38
test_HybridValues.TestHybridValues.test_basic
def test_basic(self)
Definition:
test_HybridValues.py:26
test_HybridValues.TestHybridValues
Definition:
test_HybridValues.py:23
gtsam::utils.test_case
Definition:
test_case.py:1
gtsam::symbol_shorthand
Definition:
inference/Symbol.h:147
C
Matrix< Scalar, Dynamic, Dynamic > C
Definition:
bench_gemm.cpp:50
gtsam::utils.test_case.GtsamTestCase
Definition:
test_case.py:15
X
#define X
Definition:
icosphere.cpp:20
gtsam
Author(s):
autogenerated on Tue Jul 4 2023 02:37:45