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
bad97bba
Commit
bad97bba
authored
Jul 02, 2018
by
Martin Reinecke
Browse files
improve MPI behaviour
parent
ee930b45
Changes
2
Hide whitespace changes
Inline
Side-by-side
nifty5/operators/qht_operator.py
View file @
bad97bba
...
...
@@ -35,13 +35,19 @@ class QHTOperator(LinearOperator):
x
=
x
.
val
*
self
.
domain
[
0
].
scalar_dvol
()
n
=
len
(
self
.
domain
[
0
].
shape
)
rng
=
range
(
n
)
if
mode
==
self
.
TIMES
else
reversed
(
range
(
n
))
# MR FIXME: this needs to be fixed properly for MPI
x
=
dobj
.
to_global_data
(
x
)
for
i
in
rng
:
sl
=
(
slice
(
None
),)
*
i
+
(
slice
(
1
,
None
),)
x
[
sl
]
=
hartley
(
x
[
sl
],
axes
=
(
i
,))
return
Field
.
from_global_data
(
self
.
_tgt
(
mode
),
x
)
if
i
==
dobj
.
distaxis
(
x
):
x
=
dobj
.
redistribute
(
x
,
nodist
=
(
i
,))
ax
=
dobj
.
distaxis
(
x
)
x
=
dobj
.
local_data
(
x
)
x
[
sl
]
=
hartley
(
x
[
sl
],
axes
=
(
i
,))
x
=
dobj
.
from_local_data
(
x
.
shape
,
x
,
distaxis
=
ax
)
x
=
dobj
.
redistribute
(
x
,
dist
=
i
)
else
:
x
[
sl
]
=
hartley
(
x
[
sl
],
axes
=
(
i
,))
return
Field
(
self
.
_tgt
(
mode
),
val
=
x
)
@
property
def
capability
(
self
):
...
...
nifty5/operators/slope_operator.py
View file @
bad97bba
...
...
@@ -29,10 +29,6 @@ class SlopeOperator(LinearOperator):
lst_dims
=
(
1
,)
*
(
self
.
ndim
-
i
-
1
)
self
.
pos
[
i
]
+=
tmp
.
reshape
(
fst_dims
+
(
shape
[
i
],)
+
lst_dims
)
@
property
def
sigmas
(
self
):
return
self
.
_sigmas
@
property
def
domain
(
self
):
return
self
.
_domain
...
...
@@ -47,17 +43,17 @@ class SlopeOperator(LinearOperator):
# Times
if
mode
==
self
.
TIMES
:
inp
=
x
.
to_global_data
()
res
=
self
.
sigmas
[
-
1
]
*
inp
[
-
1
]
res
=
self
.
_
sigmas
[
-
1
]
*
inp
[
-
1
]
for
i
in
range
(
self
.
ndim
):
res
+=
self
.
sigmas
[
i
]
*
inp
[
i
]
*
self
.
pos
[
i
]
res
+=
self
.
_
sigmas
[
i
]
*
inp
[
i
]
*
self
.
pos
[
i
]
return
Field
.
from_global_data
(
self
.
target
,
res
)
# Adjoint times
res
=
np
.
zeros
(
self
.
domain
[
0
].
shape
)
xglob
=
x
.
to_global_data
()
res
[
-
1
]
=
np
.
sum
(
xglob
)
*
self
.
sigmas
[
-
1
]
res
[
-
1
]
=
np
.
sum
(
xglob
)
*
self
.
_
sigmas
[
-
1
]
for
i
in
range
(
self
.
ndim
):
res
[
i
]
=
np
.
sum
(
self
.
pos
[
i
]
*
xglob
)
*
self
.
sigmas
[
i
]
res
[
i
]
=
np
.
sum
(
self
.
pos
[
i
]
*
xglob
)
*
self
.
_
sigmas
[
i
]
return
Field
.
from_global_data
(
self
.
domain
,
res
)
@
property
...
...
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