test_tensor.py
Go to the documentation of this file.
1 from __future__ import print_function
2 
3 import numpy as np
4 import tensor
5 
6 dim = np.array([10, 20, 30], dtype=np.int32)
7 t = tensor.TensorContainer3(dim)
8 r = t.get_ref()
9 r[:] = 0.0
10 c = t.get_copy()
11 r2 = tensor.ref(r)
12 cr = tensor.const_ref(r)
13 c2 = tensor.copy(cr)
14 
15 assert np.all(c == r)
16 assert np.all(r2 == r)
17 assert np.all(cr == r)
18 assert np.all(c2 == r)
19 
20 tensor.print_base(cr)
21 tensor.print_ref(cr)
22 tensor.print(cr)
23 
24 r2[:] = 100.0
25 assert not np.all(c == r)
26 assert not np.all(c2 == r)
27 assert np.all(r2 == r)
28 assert np.all(cr == r)
29 
30 tensor.print_base(cr)
31 tensor.print_ref(cr)
32 tensor.print(cr)


eigenpy
Author(s): Justin Carpentier, Nicolas Mansard
autogenerated on Fri Jun 2 2023 02:10:26