Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
N
NIFTy
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
13
Issues
13
List
Boards
Labels
Service Desk
Milestones
Merge Requests
13
Merge Requests
13
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
CI / CD
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
ift
NIFTy
Commits
4b54c37b
Commit
4b54c37b
authored
May 20, 2020
by
Philipp Arras
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix Distributor in CorrelatedFields
parent
3c27689a
Pipeline
#75297
passed with stages
in 26 minutes and 11 seconds
Changes
2
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
7 deletions
+13
-7
nifty6/library/correlated_fields.py
nifty6/library/correlated_fields.py
+5
-7
test/test_operators/test_adjoint.py
test/test_operators/test_adjoint.py
+8
-0
No files found.
nifty6/library/correlated_fields.py
View file @
4b54c37b
...
...
@@ -11,7 +11,7 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
# Copyright(C) 2013-20
19
Max-Planck-Society
# Copyright(C) 2013-20
20
Max-Planck-Society
# Authors: Philipp Frank, Philipp Arras, Philipp Haim
#
# NIFTy is being developed at the Max-Planck-Institut fuer Astrophysik.
...
...
@@ -25,7 +25,6 @@ from ..domain_tuple import DomainTuple
from
..domains.power_space
import
PowerSpace
from
..domains.unstructured_domain
import
UnstructuredDomain
from
..field
import
Field
from
..linearization
import
Linearization
from
..logger
import
logger
from
..multi_field
import
MultiField
from
..operators.adder
import
Adder
...
...
@@ -244,10 +243,9 @@ class _SpecialSum(EndomorphicOperator):
class
_Distributor
(
LinearOperator
):
def
__init__
(
self
,
dofdex
,
domain
,
target
):
self
.
_dofdex
=
dofdex
self
.
_target
=
makeDomain
(
target
)
self
.
_domain
=
makeDomain
(
domain
)
self
.
_dofdex
=
np
.
array
(
dofdex
)
self
.
_target
=
DomainTuple
.
make
(
target
)
self
.
_domain
=
DomainTuple
.
make
(
domain
)
self
.
_capability
=
self
.
TIMES
|
self
.
ADJOINT_TIMES
def
apply
(
self
,
x
,
mode
):
...
...
@@ -256,7 +254,7 @@ class _Distributor(LinearOperator):
if
mode
==
self
.
TIMES
:
res
=
x
[
self
.
_dofdex
]
else
:
res
=
np
.
empty
(
self
.
_tgt
(
mode
).
sha
pe
)
res
=
np
.
zeros
(
self
.
_tgt
(
mode
).
shape
,
dtype
=
x
.
dty
pe
)
res
[
self
.
_dofdex
]
=
x
return
makeField
(
self
.
_tgt
(
mode
),
res
)
...
...
test/test_operators/test_adjoint.py
View file @
4b54c37b
...
...
@@ -326,3 +326,11 @@ def testSlowFieldAdapter(seed):
dom
=
{
'a'
:
ift
.
RGSpace
(
1
),
'b'
:
ift
.
RGSpace
(
2
)}
op
=
ift
.
operators
.
simple_linear_operators
.
_SlowFieldAdapter
(
dom
,
'a'
)
ift
.
extra
.
consistency_check
(
op
)
@
pmp
(
'dofdex'
,
[(
0
,),
(
1
,),
(
0
,
1
),
(
1
,
0
)])
def
testCorFldDistr
(
dofdex
):
tgt
=
ift
.
UnstructuredDomain
(
len
(
dofdex
))
dom
=
ift
.
UnstructuredDomain
(
2
)
op
=
ift
.
library
.
correlated_fields
.
_Distributor
(
dofdex
,
dom
,
tgt
)
ift
.
extra
.
consistency_check
(
op
)
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