Planned maintenance on Wednesday, 2021-01-20, 17:00-18:00. Expect some interruptions during that time

Commit e69914c0 authored by Martin Reinecke's avatar Martin Reinecke

fixes

parent d07a537e
...@@ -45,7 +45,7 @@ class BlockDiagonalOperator(EndomorphicOperator): ...@@ -45,7 +45,7 @@ class BlockDiagonalOperator(EndomorphicOperator):
if self._domain is not op._domain: if self._domain is not op._domain:
raise ValueError("domain mismatch") raise ValueError("domain mismatch")
res = {key : v1*v2 for key, v1, v2 in zip(self._domain.keys(), self._ops, op._ops)} 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): def _combine_sum(self, op, selfneg, opneg):
from ..operators.sum_operator import SumOperator from ..operators.sum_operator import SumOperator
...@@ -54,4 +54,4 @@ class BlockDiagonalOperator(EndomorphicOperator): ...@@ -54,4 +54,4 @@ class BlockDiagonalOperator(EndomorphicOperator):
res = {} res = {}
for key, v1, v2 in zip(self._domain.keys(), self._ops, op._ops): for key, v1, v2 in zip(self._domain.keys(), self._ops, op._ops):
res[key] = SumOperator.make([v1, v2], [selfneg, opneg]) res[key] = SumOperator.make([v1, v2], [selfneg, opneg])
return BlockDiagonalOperator(res) return BlockDiagonalOperator(self._domain, res)
...@@ -39,8 +39,8 @@ class Test_Functionality(unittest.TestCase): ...@@ -39,8 +39,8 @@ class Test_Functionality(unittest.TestCase):
assert_equal(val.local_data, f2[key].local_data) assert_equal(val.local_data, f2[key].local_data)
def test_blockdiagonal(self): def test_blockdiagonal(self):
op = ift.BlockDiagonalOperator({"d1": op = ift.BlockDiagonalOperator(
ift.ScalingOperator(20., dom["d1"])}) dom, {"d1": ift.ScalingOperator(20., dom["d1"])})
op2 = op*op op2 = op*op
ift.extra.consistency_check(op2) ift.extra.consistency_check(op2)
assert_equal(type(op2), ift.BlockDiagonalOperator) assert_equal(type(op2), ift.BlockDiagonalOperator)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment