Skip to content

Commit

Permalink
Merge branch 'master' into leastsquares-doc
Browse files Browse the repository at this point in the history
Signed-off-by: Margaret Duff <43645617+MargaretDuff@users.noreply.github.com>
  • Loading branch information
MargaretDuff authored Nov 22, 2023
2 parents 853c2e0 + 0418ed2 commit 4e61f8a
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 14 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
- Allow reduction methods on the DataContainer class to accept axis argument as string which matches values in dimension_labels
- Added the functions `set_norms` and `get_norms` to the `BlockOperator` class
- Fixed formatting errors in the L2NormSquared and LeastSquares documentation
- Internal variable name change in BlockOperator to aid understanding


* 23.1.0
- Fix bug in IndicatorBox proximal_conjugate
Expand Down
30 changes: 16 additions & 14 deletions Wrappers/Python/cil/optimisation/operators/BlockOperator.py
Original file line number Diff line number Diff line change
Expand Up @@ -212,17 +212,18 @@ def direct(self, x, out=None):

tmp = self.range_geometry().allocate()
for row in range(self.shape[0]):
for col in range(self.shape[1]):
if col == 0:
self.get_item(row, col).direct(
x_b.get_item(col),
out=out.get_item(row))
for col in range(self.shape[1]):
if col == 0:
self.get_item(row,col).direct(
x_b.get_item(col),
out=out.get_item(row))
else:
a = out.get_item(row)
self.get_item(row, col).direct(
x_b.get_item(col),
out=tmp.get_item(row))
a += tmp.get_item(row)
temp_out_row = out.get_item(row) # temp_out_row points to the element in out that we are adding to
self.get_item(row,col).direct(
x_b.get_item(col),
out=tmp.get_item(row))
temp_out_row += tmp.get_item(row)


def adjoint(self, x, out=None):
'''Adjoint operation for the BlockOperator
Expand Down Expand Up @@ -282,10 +283,11 @@ def adjoint(self, x, out=None):
out += self.get_item(row, col).adjoint(
x_b.get_item(row))
else:
a = out.get_item(col)
a += self.get_item(row, col).adjoint(
x_b.get_item(row),
)

temp_out_col = out.get_item(col) # out_col_operator points to the column in out that we are updating
temp_out_col += self.get_item(row,col).adjoint(
x_b.get_item(row),
)

def is_linear(self):
'''Returns whether all the elements of the BlockOperator are linear'''
Expand Down

0 comments on commit 4e61f8a

Please sign in to comment.