5 from std_vector
import copyStdVector, printVectorOf3x3, printVectorOfMatrix
9 rng = np.random.default_rng(0)
11 l1 = [rng.standard_normal(3), rng.standard_normal(2)]
12 l2 = eigenpy.StdVec_VectorXd(l1)
13 l3 = [rng.standard_normal((2, 2)), rng.standard_normal((3, 1))]
14 l3.append(np.asfortranarray(np.eye(2)))
16 l4 = [rng.standard_normal((3, 3)).T
for _
in range(3)]
18 l5 = [rng.standard_normal((2, 2)).T
for _
in range(3)]
22 assert len(li1) == len(li2)
25 assert np.array_equal(li1[i], li2[i])
32 assert np.allclose(l2[0][:2], 0.0)
42 l4_copy = copyStdVector(l4)
43 assert isinstance(l4_copy, eigenpy.StdVec_MatrixXd)
45 assert "StdVec_Mat3d" in printVectorOf3x3.__doc__
48 l4_copy2 = std_vector.copyStdVec_3x3(l4)
49 assert isinstance(l4_copy2, std_vector.StdVec_Mat3d)
54 assert np.allclose(x, 0.0), f
"x = {x}"
57 print(
"Check setZero() works:")
58 std_vector.setZero(l1)
62 print(
"-----------------")
66 std_vector.setZero(l2_py)
69 print(
"-----------------")
71 l3_copy = copyStdVector(l3)
73 std_vector.setZero(l3_copy)
74 pprint.pprint(list(l3_copy))
76 print(
"-----------------")
93 l5_copy = std_vector.StdVec_Mat2d(l5)
94 l5_py = l5_copy.tolist()
100 assert np.allclose(l5[0], 0.0)