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
f0f63c40
Commit
f0f63c40
authored
Sep 25, 2019
by
Philipp Haim
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
If None is passed as operator, it will be treated as unity
parent
6e515642
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
3 deletions
+6
-3
nifty5/operators/block_diagonal_operator.py
nifty5/operators/block_diagonal_operator.py
+6
-3
No files found.
nifty5/operators/block_diagonal_operator.py
View file @
f0f63c40
...
...
@@ -22,6 +22,7 @@ from ..multi_field import MultiField
from
.endomorphic_operator
import
EndomorphicOperator
class
BlockDiagonalOperator
(
EndomorphicOperator
):
"""
Parameters
...
...
@@ -30,7 +31,7 @@ class BlockDiagonalOperator(EndomorphicOperator):
Domain and target of the operator.
operators : dict
Dictionary with subdomain names as keys and :class:`LinearOperator` s
as items.
as items.
Any item None will be treated as unity operator.
"""
def
__init__
(
self
,
domain
,
operators
):
if
not
isinstance
(
domain
,
MultiDomain
):
...
...
@@ -44,13 +45,15 @@ class BlockDiagonalOperator(EndomorphicOperator):
def
apply
(
self
,
x
,
mode
):
self
.
_check_input
(
x
,
mode
)
val
=
tuple
(
op
.
apply
(
v
,
mode
=
mode
)
if
op
is
not
None
else
None
val
=
tuple
(
op
.
apply
(
v
,
mode
=
mode
)
if
op
is
not
None
else
v
for
op
,
v
in
zip
(
self
.
_ops
,
x
.
values
()))
return
MultiField
(
self
.
_domain
,
val
)
def
draw_sample
(
self
,
from_inverse
=
False
,
dtype
=
np
.
float64
):
from
..sugar
import
from_random
val
=
tuple
(
op
.
draw_sample
(
from_inverse
,
dtype
)
if
op
is
not
None
else
None
for
op
in
self
.
_ops
)
if
op
is
not
None
else
from_random
(
'normal'
,
self
.
_domain
[
key
],
dtype
=
dtype
)
for
op
,
key
in
zip
(
self
.
_ops
,
self
.
_domain
.
keys
()))
return
MultiField
(
self
.
_domain
,
val
)
def
_combine_chain
(
self
,
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