Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
ift
NIFTy
Commits
edc2ed5e
Commit
edc2ed5e
authored
Jul 23, 2018
by
Martin Reinecke
Browse files
even more cosmetics
parent
a2af7344
Changes
2
Hide whitespace changes
Inline
Side-by-side
nifty5/operators/exp_transform.py
View file @
edc2ed5e
...
...
@@ -27,13 +27,13 @@ from ..domains.power_space import PowerSpace
from
..domains.rg_space
import
RGSpace
from
..field
import
Field
from
.linear_operator
import
LinearOperator
from
..
import
utilities
from
..utilities
import
infer_space
,
special_add_at
class
ExpTransform
(
LinearOperator
):
def
__init__
(
self
,
target
,
dof
,
space
=
0
):
self
.
_target
=
DomainTuple
.
make
(
target
)
self
.
_space
=
utilities
.
infer_space
(
self
.
_target
,
space
)
self
.
_space
=
infer_space
(
self
.
_target
,
space
)
tgt
=
self
.
_target
[
self
.
_space
]
if
not
((
isinstance
(
tgt
,
RGSpace
)
and
tgt
.
harmonic
)
or
isinstance
(
tgt
,
PowerSpace
)):
...
...
@@ -112,10 +112,8 @@ class ExpTransform(LinearOperator):
shp
=
list
(
x
.
shape
)
shp
[
d
]
=
self
.
_tgt
(
mode
).
shape
[
d
]
xnew
=
np
.
zeros
(
shp
,
dtype
=
x
.
dtype
)
xnew
=
utilities
.
special_add_at
(
xnew
,
d
,
self
.
_bindex
[
d
-
d0
],
x
*
(
1.
-
wgt
))
xnew
=
utilities
.
special_add_at
(
xnew
,
d
,
self
.
_bindex
[
d
-
d0
]
+
1
,
x
*
wgt
)
xnew
=
special_add_at
(
xnew
,
d
,
self
.
_bindex
[
d
-
d0
],
x
*
(
1.
-
wgt
))
xnew
=
special_add_at
(
xnew
,
d
,
self
.
_bindex
[
d
-
d0
]
+
1
,
x
*
wgt
)
else
:
# TIMES
xnew
=
x
[
idx
+
(
self
.
_bindex
[
d
-
d0
],)]
*
(
1.
-
wgt
)
xnew
+=
x
[
idx
+
(
self
.
_bindex
[
d
-
d0
]
+
1
,)]
*
wgt
...
...
nifty5/utilities.py
View file @
edc2ed5e
...
...
@@ -81,7 +81,7 @@ def get_slice_list(shape, axes):
if
axes
:
if
not
all
(
axis
<
len
(
shape
)
for
axis
in
axes
):
raise
ValueError
(
"axes(axis) does not match shape."
)
axes_select
=
[
0
if
x
in
axes
else
1
for
x
,
y
in
enumerate
(
shape
)]
axes_select
=
[
0
if
x
in
axes
else
1
for
x
in
range
(
len
(
shape
)
)
]
axes_iterables
=
\
[
list
(
range
(
y
))
for
x
,
y
in
enumerate
(
shape
)
if
x
not
in
axes
]
for
index
in
product
(
*
axes_iterables
):
...
...
Write
Preview
Supports
Markdown
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