Commit 30accef1 authored by Theo Steininger's avatar Theo Steininger
Browse files

Small fixes and optimizations for DiagonalOperator and LinearOperator.

parent b8b3c138
...@@ -154,9 +154,7 @@ class DiagonalOperator(EndomorphicOperator): ...@@ -154,9 +154,7 @@ class DiagonalOperator(EndomorphicOperator):
# the one of x, reshape the local data of self and apply it directly # the one of x, reshape the local data of self and apply it directly
active_axes = [] active_axes = []
if spaces is None: if spaces is None:
if self.domain != (): active_axes = range(len(x.shape))
for axes in x.domain_axes:
active_axes += axes
else: else:
for space_index in spaces: for space_index in spaces:
active_axes += x.domain_axes[space_index] active_axes += x.domain_axes[space_index]
...@@ -167,6 +165,8 @@ class DiagonalOperator(EndomorphicOperator): ...@@ -167,6 +165,8 @@ class DiagonalOperator(EndomorphicOperator):
local_diagonal = self._diagonal.val.get_local_data(copy=False) local_diagonal = self._diagonal.val.get_local_data(copy=False)
else: else:
# create an array that is sub-slice compatible # create an array that is sub-slice compatible
self.logger.warn("The input field is not sub-slice compatible to "
"the distribution strategy of the operator.")
redistr_diagonal_val = self._diagonal.val.copy( redistr_diagonal_val = self._diagonal.val.copy(
distribution_strategy=axes_local_distribution_strategy) distribution_strategy=axes_local_distribution_strategy)
local_diagonal = redistr_diagonal_val.get_local_data(copy=False) local_diagonal = redistr_diagonal_val.get_local_data(copy=False)
......
...@@ -127,7 +127,7 @@ class LinearOperator(Loggable, object): ...@@ -127,7 +127,7 @@ class LinearOperator(Loggable, object):
self_domain = self.target self_domain = self.target
if spaces is None: if spaces is None:
if self_domain != () and self_domain != x.domain: if self_domain != x.domain:
raise ValueError( raise ValueError(
"The operator's and and field's domains don't " "The operator's and and field's domains don't "
"match.") "match.")
......
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