Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F74437966
contracted_tensor_check.py
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Sat, Jul 27, 20:18
Size
967 B
Mime Type
text/x-python
Expires
Mon, Jul 29, 20:18 (2 d)
Engine
blob
Format
Raw Data
Handle
19394095
Attached To
rTENSCONT Tensor Contractor
contracted_tensor_check.py
View Options
from
os
import
listdir
,
linesep
from
os.path
import
isfile
,
join
CTcsv
=
'/home/sernst/tensor_contractor/bin/contracted_tensors.csv'
CTcsv_ref
=
'/home/sernst/tensor_contractor/bin/tests/contracted_tensors_mathematica.csv'
refs
=
{};
with
open
(
CTcsv_ref
,
'r'
)
as
file
:
for
line
in
file
.
readlines
():
splited
=
line
.
split
(
','
)
p
=
splited
[
0
]
u
=
splited
[
1
]
pp
=
splited
[
2
]
val
=
float
(
splited
[
3
])
refs
[(
p
,
u
,
pp
)]
=
val
;
max_error
=
0
;
count
=
0
;
with
open
(
CTcsv
,
'r'
)
as
file
:
for
line
in
file
.
readlines
():
splited
=
line
.
split
(
','
)
p
=
splited
[
0
]
u
=
splited
[
1
]
pp
=
splited
[
2
]
val
=
float
(
splited
[
3
])
error
=
abs
(
val
-
refs
[(
p
,
u
,
pp
)]);
count
+=
1
max_error
=
max
(
max_error
,
error
)
#print('Error: %e' % error)
print
(
'Max error:'
,
max_error
);
print
(
len
(
refs
),
'in CTcsv_ref'
)
print
(
count
,
'in CTcsv'
)
Event Timeline
Log In to Comment