Main Page
Namespaces
Namespace List
Namespace Members
All
_
a
b
c
d
e
f
g
h
i
l
m
n
p
q
r
s
t
u
v
w
x
y
z
Functions
_
a
b
c
d
e
f
g
i
m
n
p
r
s
t
u
w
Variables
_
a
b
c
d
e
f
h
i
l
m
n
p
q
r
s
t
u
v
w
x
y
z
Typedefs
Enumerations
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
u
v
w
x
y
~
Functions
_
a
b
c
d
e
f
g
h
i
l
m
n
o
p
r
s
t
u
v
w
x
~
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
i
l
m
n
p
r
s
t
v
z
Functions
_
a
b
c
d
e
f
g
i
l
m
n
p
r
s
t
v
z
Macros
_
b
e
n
p
unittest
python
test_tensor.py
Go to the documentation of this file.
1
import
numpy
as
np
2
import
tensor
3
4
dim = np.array([10, 20, 30], dtype=np.int64)
5
t = tensor.TensorContainer3(dim)
6
r = t.get_ref()
7
r[:] = 0.0
8
c = t.get_copy()
9
r2 = tensor.ref(r)
10
cr = tensor.const_ref(r)
11
c2 = tensor.copy(cr)
12
13
assert
np.all(c == r)
14
assert
np.all(r2 == r)
15
assert
np.all(cr == r)
16
assert
np.all(c2 == r)
17
18
tensor.print_base(cr)
19
tensor.print_ref(cr)
20
tensor.print(cr)
21
22
r2[:] = 100.0
23
assert
not
np.all(c == r)
24
assert
not
np.all(c2 == r)
25
assert
np.all(r2 == r)
26
assert
np.all(cr == r)
27
28
tensor.print_base(cr)
29
tensor.print_ref(cr)
30
tensor.print(cr)
eigenpy
Author(s): Justin Carpentier, Nicolas Mansard
autogenerated on Fri Feb 14 2025 03:16:26