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
10
Issues
10
List
Boards
Labels
Service Desk
Milestones
Merge Requests
8
Merge Requests
8
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
e69914c0
Commit
e69914c0
authored
Jul 07, 2018
by
Martin Reinecke
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fixes
parent
d07a537e
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
4 additions
and
4 deletions
+4
-4
nifty5/multi/block_diagonal_operator.py
nifty5/multi/block_diagonal_operator.py
+2
-2
test/test_multi_field.py
test/test_multi_field.py
+2
-2
No files found.
nifty5/multi/block_diagonal_operator.py
View file @
e69914c0
...
...
@@ -45,7 +45,7 @@ class BlockDiagonalOperator(EndomorphicOperator):
if
self
.
_domain
is
not
op
.
_domain
:
raise
ValueError
(
"domain mismatch"
)
res
=
{
key
:
v1
*
v2
for
key
,
v1
,
v2
in
zip
(
self
.
_domain
.
keys
(),
self
.
_ops
,
op
.
_ops
)}
return
BlockDiagonalOperator
(
res
)
return
BlockDiagonalOperator
(
self
.
_domain
,
res
)
def
_combine_sum
(
self
,
op
,
selfneg
,
opneg
):
from
..operators.sum_operator
import
SumOperator
...
...
@@ -54,4 +54,4 @@ class BlockDiagonalOperator(EndomorphicOperator):
res
=
{}
for
key
,
v1
,
v2
in
zip
(
self
.
_domain
.
keys
(),
self
.
_ops
,
op
.
_ops
):
res
[
key
]
=
SumOperator
.
make
([
v1
,
v2
],
[
selfneg
,
opneg
])
return
BlockDiagonalOperator
(
res
)
return
BlockDiagonalOperator
(
self
.
_domain
,
res
)
test/test_multi_field.py
View file @
e69914c0
...
...
@@ -39,8 +39,8 @@ class Test_Functionality(unittest.TestCase):
assert_equal
(
val
.
local_data
,
f2
[
key
].
local_data
)
def
test_blockdiagonal
(
self
):
op
=
ift
.
BlockDiagonalOperator
(
{
"d1"
:
ift
.
ScalingOperator
(
20.
,
dom
[
"d1"
])})
op
=
ift
.
BlockDiagonalOperator
(
dom
,
{
"d1"
:
ift
.
ScalingOperator
(
20.
,
dom
[
"d1"
])})
op2
=
op
*
op
ift
.
extra
.
consistency_check
(
op2
)
assert_equal
(
type
(
op2
),
ift
.
BlockDiagonalOperator
)
...
...
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