Skip to content

Commit 9d8dd7a

Browse files
committed
test: fix when using Array by default
1 parent 9476f88 commit 9d8dd7a

File tree

2 files changed

+9
-9
lines changed

2 files changed

+9
-9
lines changed

unittest/python/test_geometry.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ def isapprox(a,b,epsilon=1e-6):
2727

2828
Rq = q.matrix()
2929
Rr = r.matrix()
30-
assert(isapprox(Rq*Rq.T,np.eye(3)))
30+
assert(isapprox(Rq.dot(Rq.T),np.eye(3)))
3131
assert(isapprox(Rr,Rq))
3232

3333
qR = Quaternion(Rr)
@@ -42,15 +42,15 @@ def isapprox(a,b,epsilon=1e-6):
4242
if verbose: print("As expected, catched exception: ",e)
4343

4444
# --- Angle Vector ------------------------------------------------
45-
r = AngleAxis(.1,np.matrix([1,0,0],np.double).T)
45+
r = AngleAxis(.1,np.array([1,0,0],np.double))
4646
if verbose: print("Rx(.1) = \n\n",r.matrix(),"\n")
4747
assert( isapprox(r.matrix()[2,2],cos(r.angle)))
48-
assert( isapprox(r.axis,np.matrix("1;0;0")) )
48+
assert( isapprox(r.axis,np.array([1.,0,0])) )
4949
assert( isapprox(r.angle,0.1) )
5050
assert(r.isApprox(r))
5151
assert(r.isApprox(r,1e-2))
5252

53-
r.axis = np.matrix([0,1,0],np.double).T
53+
r.axis = np.array([0,1,0],np.double).T
5454
assert( isapprox(r.matrix()[0,0],cos(r.angle)))
5555

5656
ri = r.inverse()

unittest/python/test_matrix.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,11 @@
1111

1212
if verbose: print("===> From empty VectorXd to Py")
1313
v = eigenpy.emptyVector()
14-
assert v.shape == (0,1)
14+
assert v.shape == (0,)
1515

1616
if verbose: print("===> From MatrixXd to Py")
1717
M = eigenpy.naturals(3,3,verbose)
18-
Mcheck = np.reshape(np.matrix(range(9),np.double),[3,3])
18+
Mcheck = np.reshape(np.array(range(9),np.double),[3,3])
1919
assert np.array_equal(Mcheck,M)
2020

2121
if verbose: print("===> From Matrix3d to Py")
@@ -24,13 +24,13 @@
2424

2525
if verbose: print("===> From VectorXd to Py")
2626
v = eigenpy.naturalsX(3,verbose)
27-
vcheck = np.matrix([range(3),],np.double).T
27+
vcheck = np.array(range(3),np.double).T
2828
assert np.array_equal(vcheck ,v)
2929

3030
if verbose: print("===> From Py to Eigen::MatrixXd")
3131
if verbose: print("===> From Py to Eigen::MatrixXd")
3232
if verbose: print("===> From Py to Eigen::MatrixXd")
33-
Mref = np.reshape(np.matrix(range(64),np.double),[8,8])
33+
Mref = np.reshape(np.array(range(64),np.double),[8,8])
3434

3535
# Test base function
3636
Mref_from_base = eigenpy.base(Mref)
@@ -125,4 +125,4 @@
125125

126126
vec1x1 = eigenpy.vector1x1(value)
127127
assert(vec1x1.size == 1)
128-
assert(vec1x1[0,0] == value)
128+
assert(vec1x1[0] == value)

0 commit comments

Comments
 (0)