Skip to content

Commit

Permalink
Docstrings for zero operator
Browse files Browse the repository at this point in the history
  • Loading branch information
MargaretDuff committed Oct 21, 2024
1 parent 844c73c commit a4f2604
Showing 1 changed file with 29 additions and 2 deletions.
31 changes: 29 additions & 2 deletions Wrappers/Python/cil/optimisation/operators/ZeroOperator.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,15 +45,42 @@ def __init__(self, domain_geometry, range_geometry=None):
range_geometry=range_geometry)

def direct(self,x,out=None):
r'''Returns :math:`\mathrm{O}(x)`'''
r'''Returns :math:`\mathrm{O}(x)`
Parameters
----------
x : DataContainer or BlockDataContainer
Input data
out : DataContainer or BlockDataContainer, optional
If out is not None the output of the Operator will be filled in out, otherwise a new object is instantiated and returned. The default is None.
Returns
-------
DataContainer
:math:`\mathrm{O}(x)`
'''
if out is None:
return self.range_geometry().allocate(value=0)
else:
out.fill(self.range_geometry().allocate(value=0))
return out

def adjoint(self,x, out=None):
r'''Returns :math:`\mathrm{O}^{*}(y)` '''
r'''Returns :math:`\mathrm{O}^{*}(y)`
Parameters
----------
x : DataContainer or BlockDataContainer
Input data
out : DataContainer or BlockDataContainer, optional
If out is not None the output of the Operator will be filled in out, otherwise a new object is instantiated and returned. The default is None.
Returns
-------
DataContainer
:math:`\mathrm{O}^{*}(y)`
'''
if out is None:
return self.domain_geometry().allocate(value=0)
else:
Expand Down

0 comments on commit a4f2604

Please sign in to comment.