Main Page
+
Namespaces
Namespace List
+
Namespace Members
+
All
_
a
b
c
d
e
f
g
i
l
m
n
p
q
r
s
t
u
v
w
x
y
+
Functions
_
a
c
d
e
f
g
i
m
n
p
r
s
t
u
+
Variables
_
a
b
c
d
e
i
l
m
n
p
q
r
s
t
v
w
x
y
+
Classes
Class List
Class Hierarchy
+
Class Members
+
All
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
v
w
x
y
~
+
Functions
_
a
b
c
d
e
f
g
h
i
l
m
n
o
p
r
s
t
v
w
~
+
Variables
b
c
d
e
f
i
j
l
m
n
o
p
s
t
v
w
x
y
+
Typedefs
_
a
b
c
d
e
f
i
k
l
m
n
p
q
r
s
t
v
Enumerator
Related Functions
+
Files
File List
+
File Members
+
All
_
a
b
c
d
e
f
g
h
i
k
l
m
n
o
p
r
s
t
u
v
z
+
Functions
a
b
c
e
f
g
i
l
m
n
p
r
s
t
v
z
+
Variables
a
b
c
d
e
f
g
h
i
k
l
m
o
p
r
s
t
u
v
+
Macros
_
b
e
n
p
unittest
python
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