Skip to content
GitLab
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
1eb7f754
Commit
1eb7f754
authored
Jan 25, 2016
by
ultimanet
Browse files
Removed the `inject` method as `set_data` is able to handle this task completely.
Extended the d2o docstrings.
parent
800f4e4a
Pipeline
#539
skipped
Changes
4
Pipelines
1
Expand all
Hide whitespace changes
Inline
Side-by-side
nifty_core.py
View file @
1eb7f754
...
...
@@ -1204,7 +1204,9 @@ class point_space(space):
if
to_copy
:
temp
=
x
.
copy_empty
(
dtype
=
dtype
,
distribution_strategy
=
self
.
datamodel
)
temp
.
inject
((
slice
(
None
),),
x
,
(
slice
(
None
),))
temp
.
set_data
(
to_key
=
(
slice
(
None
),),
data
=
x
,
from_key
=
(
slice
(
None
),))
temp
.
hermitian
=
x
.
hermitian
x
=
temp
...
...
nifty_mpi_data.py
View file @
1eb7f754
This diff is collapsed.
Click to expand it.
nifty_utilities.py
View file @
1eb7f754
...
...
@@ -64,8 +64,8 @@ def _hermitianize_inverter(x):
slice_inverter
[
i
]
=
slice
(
None
,
0
,
-
1
)
try
:
y
.
inject
(
to_key
=
slice_picker
,
data
=
y
,
from_key
=
slice_inverter
)
y
.
set_data
(
to_key
=
slice_picker
,
data
=
y
,
from_key
=
slice_inverter
)
except
(
AttributeError
):
y
[
slice_picker
]
=
y
[
slice_inverter
]
return
y
...
...
test/test_nifty_mpi_data.py
View file @
1eb7f754
...
...
@@ -1025,7 +1025,7 @@ class Test_non_local_keys(unittest.TestCase):
###############################################################################
###############################################################################
class
Test_inject
(
unittest
.
TestCase
):
class
Test_
set_data_via_
inject
ion
(
unittest
.
TestCase
):
@
parameterized
.
expand
(
itertools
.
product
([
...
...
@@ -1048,7 +1048,7 @@ class Test_inject(unittest.TestCase):
],
all_distribution_strategies
),
testcase_func_name
=
custom_name_func
)
def
test_inject
(
self
,
(
global_shape_1
,
slice_tuple_1
,
def
test_
set_data_via_
inject
ion
(
self
,
(
global_shape_1
,
slice_tuple_1
,
global_shape_2
,
slice_tuple_2
),
distribution_strategy
):
dtype
=
np
.
dtype
(
'float'
)
...
...
@@ -1058,7 +1058,7 @@ class Test_inject(unittest.TestCase):
(
b
,
p
)
=
generate_data
(
global_shape_2
,
dtype
,
distribution_strategy
)
obj
.
inject
(
to_key
=
slice_tuple_1
,
obj
.
set_data
(
to_key
=
slice_tuple_1
,
data
=
p
,
from_key
=
slice_tuple_2
)
a
[
slice_tuple_1
]
=
b
[
slice_tuple_2
]
...
...
@@ -1272,7 +1272,7 @@ class Test_unary_and_binary_operations(unittest.TestCase):
global_shape
,
np
.
dtype
(
'complex'
),
distribution_strategy
=
stored_distribution_strategy
)
p
.
inject
(
(
slice
(
None
),),
a
,
(
slice
(
None
),))
p
.
set_data
(
from_key
=
(
slice
(
None
),),
data
=
a
,
to_key
=
(
slice
(
None
),))
obj
=
p
assert_equal
(
obj
.
isreal
().
get_full_data
(),
np
.
isreal
(
a
))
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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