From 64015bacb3e5fee0f7af77e34a82397b7c03a1c2 Mon Sep 17 00:00:00 2001 From: epapoutsellis Date: Thu, 29 Jan 2026 15:34:22 +0000 Subject: [PATCH 1/3] add adjoint operator doc --- docs/source/optimisation.rst | 3 +++ 1 file changed, 3 insertions(+) diff --git a/docs/source/optimisation.rst b/docs/source/optimisation.rst index ac747779dd..6f3c6b3336 100644 --- a/docs/source/optimisation.rst +++ b/docs/source/optimisation.rst @@ -331,6 +331,9 @@ A :code:`ScaledOperator` represents the multiplication of any operator with a sc .. autoclass:: cil.optimisation.operators.SumOperator :members: +.. autoclass:: cil.optimisation.operators.AdjointOperator + :members: + Trivial operators ----------------- From 2cd7fbe8f5d8ae338bec47134591b13350822090 Mon Sep 17 00:00:00 2001 From: epapoutsellis Date: Thu, 29 Jan 2026 16:04:11 +0000 Subject: [PATCH 2/3] fix docs --- .../cil/optimisation/operators/Operator.py | 47 +++++++++++-------- 1 file changed, 28 insertions(+), 19 deletions(-) diff --git a/Wrappers/Python/cil/optimisation/operators/Operator.py b/Wrappers/Python/cil/optimisation/operators/Operator.py index 2e758ec827..cd60709425 100644 --- a/Wrappers/Python/cil/optimisation/operators/Operator.py +++ b/Wrappers/Python/cil/optimisation/operators/Operator.py @@ -425,29 +425,38 @@ def dot_test(operator, domain_init=None, range_init=None, tolerance=1e-6, **kwar return False class AdjointOperator(LinearOperator): + + r""" + Adjoint of a linear operator. - """ - The Adjoint operator :math:`A^{*}: Y^{*}\rightarrow X^{*}` of a linear operator :math:`A: X\rightarrow Y` defined as - - .. math:: = + Given a linear operator :math:`A: X \to Y` between inner-product spaces + :math:`(X,\langle\cdot,\cdot\rangle_X)` and :math:`(Y,\langle\cdot,\cdot\rangle_Y)`, + its adjoint :math:`A^{*}: Y \to X` is defined by + \[ + \langle Ax,\, y\rangle_Y \;=\; \langle x,\, A^{*}y\rangle_X, + \qquad \forall x\in X,\; y\in Y. + \] - Parameters - ---------- + Parameters + ---------- + operator : LinearOperator + The operator :math:`A` whose adjoint is constructed. - operator : A linear operator + Examples + -------- + Verify the adjointness relation for the gradient operator :math:`G` and its adjoint + (the negative divergence in many discretisations): + >>> ig = ImageGeometry(2, 3) + >>> G = GradientOperator(ig) + >>> div = AdjointOperator(G) # represents G* + >>> x = G.domain.allocate("random_int") + >>> y = G.range.allocate("random_int") + >>> lhs = G.direct(x).dot(y) # _Y + >>> rhs = x.dot(div.direct(y)) # _X + >>> lhs == rhs + True + """ - Examples - -------- - This example demonstrates that :math:` LHS:= ==:RHS`, where :math:`G` is the gradient operator. - >>> ig = ImageGeometry(2,3) - >>> G = GradientOperator(ig) - >>> div = AdjointOperator(G) - >>> x = G.domain.allocate("random_int") - >>> y = G.range.allocate("random_int") - >>> lhs = G.direct(x).dot(y) - >>> rhs = x.dot(div.direct(y)) - >>> lhs == rhs # returns True - """ def __init__(self, operator): super(AdjointOperator, self).__init__(domain_geometry=operator.range_geometry(), From 745e1b33289312c7ce6d01ef703c5816c4d75197 Mon Sep 17 00:00:00 2001 From: Laura Murgatroyd Date: Fri, 5 Jun 2026 13:33:05 +0100 Subject: [PATCH 3/3] Fix rendering of AdjointOperator docs --- .../Python/cil/optimisation/operators/Operator.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/Wrappers/Python/cil/optimisation/operators/Operator.py b/Wrappers/Python/cil/optimisation/operators/Operator.py index cd60709425..0c6656d4cd 100644 --- a/Wrappers/Python/cil/optimisation/operators/Operator.py +++ b/Wrappers/Python/cil/optimisation/operators/Operator.py @@ -431,11 +431,11 @@ class AdjointOperator(LinearOperator): Given a linear operator :math:`A: X \to Y` between inner-product spaces :math:`(X,\langle\cdot,\cdot\rangle_X)` and :math:`(Y,\langle\cdot,\cdot\rangle_Y)`, - its adjoint :math:`A^{*}: Y \to X` is defined by - \[ - \langle Ax,\, y\rangle_Y \;=\; \langle x,\, A^{*}y\rangle_X, - \qquad \forall x\in X,\; y\in Y. - \] + its adjoint :math:`A^{*}: Y \to X` is defined by: + + .. math:: + \langle Ax,\, y\rangle_Y \;=\; \langle x,\, A^{*}y\rangle_X, + \qquad \forall x\in X,\; y\in Y. Parameters ---------- @@ -446,6 +446,7 @@ class AdjointOperator(LinearOperator): -------- Verify the adjointness relation for the gradient operator :math:`G` and its adjoint (the negative divergence in many discretisations): + >>> ig = ImageGeometry(2, 3) >>> G = GradientOperator(ig) >>> div = AdjointOperator(G) # represents G*