Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
ift
NIFTy
Commits
89729ee5
Commit
89729ee5
authored
Jun 20, 2016
by
csongor
Browse files
Fix _axis_list functionality
parent
01f48ddd
Changes
1
Hide whitespace changes
Inline
Side-by-side
nifty_field.py
View file @
89729ee5
...
...
@@ -224,14 +224,20 @@ class field(object):
if
domain
is
None
:
domain
=
self
.
domain
dtype_tuple
=
tuple
(
np
.
dtype
(
space
.
dtype
)
for
space
in
domain
)
dtype
=
reduce
(
lambda
x
,
y
:
np
.
result_type
(
x
,
y
),
dtype_tuple
)
dtype
=
reduce
(
lambda
x
,
y
:
np
.
result_type
(
x
,
y
),
dtype_tuple
)
return
dtype
def
_get_axis_list_from_domain
(
self
,
domain
=
None
):
if
domain
is
None
:
domain
=
self
.
domain
axis_list
=
[
tuple
(
ind
for
i
in
range
(
len
(
space
.
get_shape
())))
for
ind
,
space
in
enumerate
(
domain
)]
i
=
0
axis_list
=
[]
for
space
in
domain
:
l
=
[]
for
j
in
range
(
len
(
space
.
get_shape
())):
l
+=
[
i
]
i
+=
1
axis_list
+=
[
tuple
(
l
)]
return
axis_list
def
_parse_comm
(
self
,
comm
):
...
...
@@ -383,7 +389,7 @@ class field(object):
def
get_shape
(
self
):
if
len
(
self
.
domain
)
>
1
:
shape_tuple
=
tuple
(
space
.
get_shape
()
for
space
in
self
.
domain
)
global_shape
=
reduce
(
lambda
x
,
y
:
x
+
y
,
shape_tuple
)
global_shape
=
reduce
(
lambda
x
,
y
:
x
+
y
,
shape_tuple
)
else
:
global_shape
=
self
.
domain
[
0
].
get_shape
()
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment