The inverse operator.
2024
def inverse(self):
        """"""
        op = self

        class ShearlabOperatorInverse(odl.Operator):

            """Inverse of the shearlet transform.

            See Also
            --------
            odl.contrib.shearlab.ShearlabOperator
            """

            def __init__(self):
                """Initialize a new instance."""
                self.mutex = op.mutex
                self.shearlet_system = op.shearlet_system
                super(ShearlabOperatorInverse, self).__init__(
                    op.range, op.domain, True)

            def _call(self, x):
                """``self(x)``."""
                with op.mutex:
                    x = np.moveaxis(x, 0, -1)
                    return shearrec2D(x, op.shearlet_system)

            @property
            def adjoint(self):
                """"""
                op = self

                class ShearlabOperatorInverseAdjoint(odl.Operator):

                    """
                    Adjoint of the inverse/Inverse of the adjoint
                    of shearlet transform.

                    See Also
                    --------
                    odl.contrib.shearlab.ShearlabOperator
                    """

                    def __init__(self):
                        """Initialize a new instance."""

                        self.mutex = op.mutex
                        self.shearlet_system = op.shearlet_system
                        super(ShearlabOperatorInverseAdjoint, self).__init__(
                            op.range, op.domain, True)

                    def _call(self, x):
                        """``self(x)``."""
                        with op.mutex:
                            result = shearrecadjoint2D(x, op.shearlet_system)
                            return np.moveaxis(result, -1, 0)

                    @property
                    def adjoint(self):
                        """The adjoint operator."""
                        return op

                    @property
                    def inverse(self):
                        """"""
                        return op.inverse.adjoint

                return ShearlabOperatorInverseAdjoint()

            @property
            def inverse(self):
                """"""
                return op

        return ShearlabOperatorInverse()
393543
def inverse(self):
        """"""
        sign = '-' if self.sign == '+' else '+'
        return DiscreteFourierTransform(
            domain=self.range, range=self.domain, axes=self.axes,
            halfcomplex=self.halfcomplex, sign=sign)
1260961
def inverse(self):
        
        new = self.conjugate()
        tmp = self.norm()**2
        new.w /= tmp
        new.x /= tmp
        new.y /= tmp
        new.z /= tmp
        return new
700385
public void inverse(Transformation2D inverse) {
		double det = xx * yy - xy * yx;

		if (det == 0) {
			inverse.setZero();
			return;
		}

		det = 1 / det;

		inverse.xd = (xy * yd - xd * yy) * det;
		inverse.yd = (xd * yx - xx * yd) * det;
		inverse.xx = yy * det;
		inverse.xy = -xy * det;
		inverse.yx = -yx * det;
		inverse.yy = xx * det;
	}
925481
def inverse(self):
        """"""
        sign = '+' if self.sign == '-' else '-'
        return FourierTransform(
            domain=self.range, range=self.domain, impl=self.impl,
            axes=self.axes, halfcomplex=self.halfcomplex, shift=self.shifts,
            sign=sign, tmp_r=self._tmp_r, tmp_f=self._tmp_f)
309976
function inverse$$1(matrix, useSVD = false) {
              matrix = WrapperMatrix2D$1.checkMatrix(matrix);
              if (useSVD) {
                return new SingularValueDecomposition$$1(matrix).inverse();
              } else {
                return solve$$1(matrix, Matrix$1.eye(matrix.rows));
              }
            }
773191
function performTermOperationOnEquation(equation, op, term, changeType) {
  const oldEquation = equation.clone();

  const leftTerm = clone(term);
  const rightTerm = clone(term);
  const leftNode = performTermOperationOnExpression(
    equation.leftNode, op, leftTerm);
  const rightNode = performTermOperationOnExpression(
    equation.rightNode, op, rightTerm);

  let comparator = equation.comparator;
  if (Negative.isNegative(term) && (op === '*' || op === '/')) {
    comparator = COMPARATOR_TO_INVERSE[comparator];
  }

  const newEquation = new Equation(leftNode, rightNode, comparator);
  return new EquationStatus(changeType, oldEquation, newEquation);
}
20912
def adjoint(self):
        """"""
        if not self.is_linear:
            raise NotImplementedError('this operator is not linear and '
                                      'thus has no adjoint')

        forward_op = self

        class ResizingOperatorAdjoint(ResizingOperatorBase):

            """Adjoint of `ResizingOperator`.

            See `the online documentation
            <https://odlgroup.github.io/odl/math/resizing_ops.html>`_
            on resizing operators for mathematical details.
            """

            def _call(self, x, out):
                """Implement ``self(x, out)``."""
                with writable_array(out) as out_arr:
                    resize_array(x.asarray(), self.range.shape,
                                 offset=self.offset, pad_mode=self.pad_mode,
                                 pad_const=0, direction='adjoint',
                                 out=out_arr)

            @property
            def adjoint(self):
                """Adjoint of the adjoint, i.e. the original operator."""
                return forward_op

            @property
            def inverse(self):
                """(Pseudo-)Inverse of this operator.

                Note that in axes where ``self`` extends, the returned operator
                acts as a proper inverse, while in restriction axes, the
                operation is not invertible.
                """
                return ResizingOperatorAdjoint(
                    domain=self.range, range=self.domain,
                    pad_mode=self.pad_mode)

        return ResizingOperatorAdjoint(domain=self.range, range=self.domain,
                                       pad_mode=self.pad_mode)
975286
def _call(self, x):
        """"""
        if self.operator is None:
            return self.vector.inner(x) + self.constant
        elif self.vector is None:
            return x.inner(self.operator(x)) + self.constant
        else:
            tmp = self.operator(x)
            tmp += self.vector
            return x.inner(tmp) + self.constant
944362
function inverseModInt(x, n) {
  var a=1, b=0, t;
  for (;;) {
    if (x==1) return a;
    if (x==0) return 0;
    b-=a*Math.floor(n/x);
    n%=x;

    if (n==1) return b; //to avoid negatives, change this b to n-b, and each -= to +=
    if (n==0) return 0;
    a-=b*Math.floor(x/n);
    x%=n;
  }
}
1232252
def operator_complement(self):
        
        # is projection the zero operator? --> complement is identity
        if self.V.shape[1] == 0:
            N = self.V.shape[0]
            return IdentityLinearOperator((N, N))
        return self._get_operator(self.apply_complement,
                                  self.apply_complement_adj)
663170
def p_static_scalar_unary_op(p):
    ''''''
    p[0] = ast.UnaryOp(p[1], p[2], lineno=p.lineno(1))
159838
def _call(self, x, out=None):
        """"""
        if out is None:
            return self.operator(x) * self.vector
        else:
            self.operator(x, out=out)
            out *= self.vector
1139284
def _call(self, x, out=None):
        """"""
        if out is None:
            return self.operator(self.scalar * x)
        else:
            if self.__tmp is not None:
                tmp = self.__tmp
            else:
                tmp = self.domain.element()
            tmp.lincomb(self.scalar, x)
            self.operator(tmp, out=out)
324352
function inverseMod_(x, n) {
  var k=1+2*Math.max(x.length, n.length);

  if (!(x[0]&1)  && !(n[0]&1)) {  //if both inputs are even, then inverse doesn't exist
    copyInt_(x, 0);
    return 0;
  }

  if (eg_u.length!=k) {
    eg_u=new Array(k);
    eg_v=new Array(k);
    eg_A=new Array(k);
    eg_B=new Array(k);
    eg_C=new Array(k);
    eg_D=new Array(k);
  }

  copy_(eg_u, x);
  copy_(eg_v, n);
  copyInt_(eg_A, 1);
  copyInt_(eg_B, 0);
  copyInt_(eg_C, 0);
  copyInt_(eg_D, 1);
  for (;;) {
    while (!(eg_u[0]&1)) {  //while eg_u is even
      halve_(eg_u);
      if (!(eg_A[0]&1) && !(eg_B[0]&1)) { //if eg_A==eg_B==0 mod 2
        halve_(eg_A);
        halve_(eg_B);
      } else {
        add_(eg_A, n);  halve_(eg_A);
        sub_(eg_B, x);  halve_(eg_B);
      }
    }

    while (!(eg_v[0]&1)) {  //while eg_v is even
      halve_(eg_v);
      if (!(eg_C[0]&1) && !(eg_D[0]&1)) { //if eg_C==eg_D==0 mod 2
        halve_(eg_C);
        halve_(eg_D);
      } else {
        add_(eg_C, n);  halve_(eg_C);
        sub_(eg_D, x);  halve_(eg_D);
      }
    }

    if (!greater(eg_v, eg_u)) { //eg_v <= eg_u
      sub_(eg_u, eg_v);
      sub_(eg_A, eg_C);
      sub_(eg_B, eg_D);
    } else {                   //eg_v > eg_u
      sub_(eg_v, eg_u);
      sub_(eg_C, eg_A);
      sub_(eg_D, eg_B);
    }

    if (equalsInt(eg_u, 0)) {
      while (negative(eg_C)) //make sure answer is nonnegative
        add_(eg_C, n);
      copy_(x, eg_C);

      if (!equalsInt(eg_v, 1)) { //if GCD_(x,n)!=1, then there is no inverse
        copyInt_(x, 0);
        return 0;
      }
      return 1;
    }
  }
}
637792
def _transform_i(self, x, i):
        """"""
        x = self._shift_or_mirror_into_invertible_i(x, i)
        lb = self._lb[self._index(i)]
        ub = self._ub[self._index(i)]
        al = self._al[self._index(i)]
        au = self._au[self._index(i)]
        if x < lb + al:
            return lb + (x - (lb - al))**2 / 4 / al
        elif x < ub - au:
            return x
        elif x < ub + 3 * au:
            return ub - (x - (ub + au))**2 / 4 / au
        else:
            assert False  # shift removes this case
            return ub + au - (x - (ub + au))
733624
def inverse(self):
        
        result = G1Element()
        librelic.g1_neg_abi(byref(result), byref(self))
        return result