def gradient(self):
        """Gradient of the compositon according to the chain rule."""
        func = self.left
        op = self.right

        class FunctionalCompositionGradient(Operator):

            """Gradient of the compositon according to the chain rule."""

            def __init__(self):
                """Initialize a new instance."""
                super(FunctionalCompositionGradient, self).__init__(
                    op.domain, op.domain, linear=False)

            def _call(self, x):
                """Apply the gradient operator to the given point."""
                return op.derivative(x).adjoint(func.gradient(op(x)))

            def derivative(self, x):
                """The derivative in point ``x``.

                This is only defined
                """
                if not op.is_linear:
                    raise NotImplementedError('derivative only implemented '
                                              'for linear opertors.')
                else:
                    return (op.adjoint * func.gradient * op).derivative(x)

        return FunctionalCompositionGradient()
Gradient of the compositon according to the chain rule.