test_switch.py
Go to the documentation of this file.
1 from __future__ import print_function
2 
3 import eigenpy
4 import numpy as np
5 
6 eigenpy.switchToNumpyMatrix()
7 quat = eigenpy.Quaternion()
8 # By default, we convert as numpy.matrix
9 coeffs_vector = quat.coeffs()
10 print(type(coeffs_vector))
11 
12 assert isinstance(coeffs_vector,np.matrixlib.defmatrix.matrix)
13 assert eigenpy.getNumpyType() == np.matrix
14 
15 # Switch to numpy.array
16 eigenpy.switchToNumpyArray()
17 coeffs_array = quat.coeffs()
18 print(type(coeffs_array))
19 
20 assert isinstance(coeffs_vector,np.ndarray)
21 assert eigenpy.getNumpyType() == np.ndarray


eigenpy
Author(s): Justin Carpentier, Nicolas Mansard
autogenerated on Sat Apr 17 2021 02:37:59