/* Inverse equations
-----------------
165773
function inverse$22(p) {
        p.x -= this.x0;
        p.y = this.rh - p.y + this.y0;
        var con, rh1, lat, lon;
        if (this.ns >= 0) {
            rh1 = Math.sqrt(p.x * p.x + p.y * p.y);
            con = 1;
        }
        else {
            rh1 = -Math.sqrt(p.x * p.x + p.y * p.y);
            con = -1;
        }
        var theta = 0;
        if (rh1 !== 0) {
            theta = Math.atan2(con * p.x, con * p.y);
        }

        if (this.sphere) {
            lon = adjust_lon(this.long0 + theta / this.ns);
            lat = adjust_lat(this.g - rh1 / this.a);
            p.x = lon;
            p.y = lat;
            return p;
        }
        else {
            var ml = this.g - rh1 / this.a;
            lat = imlfn(ml, this.e0, this.e1, this.e2, this.e3);
            lon = adjust_lon(this.long0 + theta / this.ns);
            p.x = lon;
            p.y = lat;
            return p;
        }

    }
166792
def inverse(self):
        """"""
        result = self.__class__()
        result.forward = copy.copy(self.reverse)
        result.reverse = copy.copy(self.forward)
        return result
584561
public function inverse($p)
    {
        $x = $p->x;
        $y = $p->y;

        $p->x = Common::adjust_lon( $this->long0 + (($x - $this->x0) / ($this->a * $this->rc)) );
        $p->y = Common::adjust_lat( $this->lat0 + (($y - $this->y0) / ($this->a )) );

        return $p;
    }
1165685
private void solveInternalL() {
        // This takes advantage of the diagonal elements always being real numbers

        // solve L*y=b storing y in x
        TriangularSolver_ZDRM.solveL_diagReal(t, vv, n);

        // solve L^T*x=y
        TriangularSolver_ZDRM.solveConjTranL_diagReal(t, vv, n);
    }
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)
434265
public function inverse($p)
    {
        $p->x -= $this->x0;
        $p->y = $this->rh - $p->y + $this->y0;

        if ($this->ns >= 0) {
            $rh1 = sqrt( $p->x * $p->x + $p->y * $p->y );
            $con = 1.0;
        } else {
            $rh1 = -sqrt( $p->x * $p->x + $p->y * $p->y );
            $con = -1.0;
        }

        $theta = 0.0;

        if ($rh1 != 0.0) {
            $theta = atan2($con * $p->x, $con * $p->y);
        }

        $ml = $this->g - $rh1 / $this->a;

        $lat = $this->phi3z( $ml, $this->e0, $this->e1, $this->e2, $this->e3 );
        $lon = Common::adjust_lon( $this->long0 + $theta / $this->ns );

        $p->x = $lon;
        $p->y = $lat;

        return $p;
    }
1008022
def inverse(x, operator)
      if x.num?
        x = x.to_numeric
        if operator == :+
          _(- x)
        else
          _(Rational(1, x))
        end
      elsif x.is_a?(Inverse) && x.operator == operator
        x.x
      else
        Inverse.new(x, operator)
      end
    end
765969
function inverseMod(x, n) {
  var ans=expand(x, n.length);
  var s;
  s=inverseMod_(ans, n);
  return s ? trim(ans, 1) : null;
}
452160
public function inverse($p)
    {
        /*
        $rh;  // height above ellipsoid	
        $z;  // angle
        $sinz;
        $cosz; // sin of z and cos of z	
        $temp;
        $con;
        $lon;
        $lat;
        */

        $p->x -= $this->x0;
        $p->y -= $this->y0;
        $rh = sqrt($p->x * $p->x + $p->y * $p->y);

        if($rh > $this->a + 0.0000001) {
            Proj4php::reportError("orthoInvDataError");
        }

        $z = Common::asinz($rh / $this->a);

        $sinz = sin($z);
        $cosz = cos($z);

        $lon = $this->long0;

        if (abs($rh) <= Common::EPSLN) {
            $lat = $this->lat0;
        }

        $lat = Common::asinz($cosz * $this->sin_p14 + ($p->y * $sinz * $this->cos_p14) / $rh);
        $con = abs($this->lat0) - Common::HALF_PI;

        if (abs(con) <= Common::EPSLN) {
            if ($this->lat0 >= 0) {
                $lon = Common::adjust_lon($this->long0 + atan2($p->x, -$p->y));
            } else {
                $lon = Common::adjust_lon($this->long0 - atan2(-$p->x, $p->y));
            }
        }
        $con = $cosz - $this->sin_p14 * sin($lat);

        $p->x = $lon;
        $p->y = $lat;

        return $p;
    }
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;
	}
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);
}
74701
function forward$12(p) {

        /* Forward equations
         -----------------*/
        var x, y, coslam, sinlam, sinphi, q, sinb, cosb, b, cosphi;
        var lam = p.x;
        var phi = p.y;

        lam = adjust_lon(lam - this.long0);
        if (this.sphere) {
            sinphi = Math.sin(phi);
            cosphi = Math.cos(phi);
            coslam = Math.cos(lam);
            if (this.mode === this.OBLIQ || this.mode === this.EQUIT) {
                y = (this.mode === this.EQUIT) ? 1 + cosphi * coslam : 1 + this.sinph0 * sinphi + this.cosph0 * cosphi * coslam;
                if (y <= EPSLN) {
                    return null;
                }
                y = Math.sqrt(2 / y);
                x = y * cosphi * Math.sin(lam);
                y *= (this.mode === this.EQUIT) ? sinphi : this.cosph0 * sinphi - this.sinph0 * cosphi * coslam;
            }
            else if (this.mode === this.N_POLE || this.mode === this.S_POLE) {
                if (this.mode === this.N_POLE) {
                    coslam = -coslam;
                }
                if (Math.abs(phi + this.phi0) < EPSLN) {
                    return null;
                }
                y = FORTPI - phi * 0.5;
                y = 2 * ((this.mode === this.S_POLE) ? Math.cos(y) : Math.sin(y));
                x = y * Math.sin(lam);
                y *= coslam;
            }
        }
        else {
            sinb = 0;
            cosb = 0;
            b = 0;
            coslam = Math.cos(lam);
            sinlam = Math.sin(lam);
            sinphi = Math.sin(phi);
            q = qsfnz(this.e, sinphi);
            if (this.mode === this.OBLIQ || this.mode === this.EQUIT) {
                sinb = q / this.qp;
                cosb = Math.sqrt(1 - sinb * sinb);
            }
            switch (this.mode) {
                case this.OBLIQ:
                    b = 1 + this.sinb1 * sinb + this.cosb1 * cosb * coslam;
                    break;
                case this.EQUIT:
                    b = 1 + cosb * coslam;
                    break;
                case this.N_POLE:
                    b = HALF_PI + phi;
                    q = this.qp - q;
                    break;
                case this.S_POLE:
                    b = phi - HALF_PI;
                    q = this.qp + q;
                    break;
            }
            if (Math.abs(b) < EPSLN) {
                return null;
            }
            switch (this.mode) {
                case this.OBLIQ:
                case this.EQUIT:
                    b = Math.sqrt(2 / b);
                    if (this.mode === this.OBLIQ) {
                        y = this.ymf * b * (this.cosb1 * sinb - this.sinb1 * cosb * coslam);
                    }
                    else {
                        y = (b = Math.sqrt(2 / (1 + cosb * coslam))) * sinb * this.ymf;
                    }
                    x = this.xmf * b * cosb * sinlam;
                    break;
                case this.N_POLE:
                case this.S_POLE:
                    if (q >= 0) {
                        x = (b = Math.sqrt(q)) * sinlam;
                        y = coslam * ((this.mode === this.S_POLE) ? b : -b);
                    }
                    else {
                        x = y = 0;
                    }
                    break;
            }
        }

        p.x = this.a * x + this.x0;
        p.y = this.a * y + this.y0;
        return p;
    }
128386
public function inverse($p) {
        $p->x -= $this->x0;
        $p->y -= $this->y0;
        $x = $p->x / $this->a;
        $y = $p->y / $this->a;

        if( $this->sphere ) {
            $cosz = 0.0;
            #$rh;
            $sinz = 0.0;

            $rh = sqrt(($x * $x) + ($y * $y));
            $phi = $rh * 0.5;

            if ($phi > 1.0) {
                Proj4php::reportError('laea:Inv:DataError');
                return null;
            }

            $phi = 2. * asin( $phi );

            if ($this->mode == $this->OBLIQ || $this->mode == $this->EQUIT) {
                $sinz = sin($phi);
                $cosz = cos($phi);
            }
            switch( $this->mode ) {
                case $this->EQUIT:
                    $phi = (abs( $rh ) <= Common::EPSLN) ? 0. : asin( $y * $sinz / $rh );
                    $x *= $sinz;
                    $y = $cosz * $rh;
                    break;
                case $this->OBLIQ:
                    $phi = (abs( $rh ) <= Common::EPSLN) ? $this->phi0 : asin( $cosz * $this->sinph0 + $y * $sinz * $this->cosph0 / $rh );
                    $x *= $sinz * $this->cosph0;
                    $y = ($cosz - sin( $phi ) * $this->sinph0) * $rh;
                    break;
                case $this->N_POLE:
                    $y = -$y;
                    $phi = Common::HALF_PI - $phi;
                    break;
                case $this->S_POLE:
                    $phi -= Common::HALF_PI;
                    break;
            }

            $lam = ($y == 0.0 && ($this->mode == $this->EQUIT || $this->mode == $this->OBLIQ)) ? 0. : atan2($x, $y);
        } else {
            /*
            $cCe;
            $sCe;
            $q;
            $rho;
            */
            $ab = 0.0;

            switch($this->mode) {
                case $this->EQUIT:
                case $this->OBLIQ:
                    $x /= $this->dd;
                    $y *= $this->dd;
                    $rho = sqrt( $x * $x + $y * $y );

                    if ($rho < Common::EPSLN) {
                        $p->x = 0.;
                        $p->y = $this->phi0;
                        return $p;
                    }

                    $sCe = 2. * asin( .5 * $rho / $this->rq );
                    $cCe = cos( $sCe );
                    $x *= ($sCe = sin($sCe));

                    if ($this->mode == $this->OBLIQ) {
                        $ab = $cCe * $this->sinb1 + $y * $sCe * $this->cosb1 / $rho;
                        $q = $this->qp * $ab;
                        $y = $rho * $this->cosb1 * $cCe - $y * $this->sinb1 * $sCe;
                    } else {
                        $ab = $y * $sCe / $rho;
                        $q = $this->qp * $ab;
                        $y = $rho * $cCe;
                    }
                    break;
                case $this->N_POLE:
                    $y = -$y;
                case $this->S_POLE:
                    $q = ($x * $x + $y * $y);

                    if ( ! $q) {
                        $p->x = 0.;
                        $p->y = $this->phi0;
                        return $p;
                    }
                    /*
                      q = $this->qp - q;
                     */
                    $ab = 1.0 - $q / $this->qp;

                    if ($this->mode == $this->S_POLE) {
                        $ab = - $ab;
                    }
                    break;
            }
            $lam = atan2($x, $y);
            $phi = $this->authlat(asin($ab), $this->apa);
        }

        /*
          $Rh = sqrt($p->x *$p->x +$p->y * $p->y);
          $temp = Rh / (2.0 * $this->a);

          if (temp > 1) {
          Proj4php::reportError("laea:Inv:DataError");
          return null;
          }

          $z = 2.0 * Common::asinz(temp);
          $sin_z=sin(z);
          $cos_z=cos(z);

          $lon =$this->long0;
          if (abs(Rh) > Common::EPSLN) {
          $lat = Common::asinz($this->sin_lat_o * cos_z +$this-> cos_lat_o * sin_z *$p->y / Rh);
          $temp =abs($this->lat0) - Common::HALF_PI;
          if (abs(temp) > Common::EPSLN) {
          temp = cos_z -$this->sin_lat_o * sin(lat);
          if(temp!=0.0) lon=Common::adjust_lon($this->long0+atan2($p->x*sin_z*$this->cos_lat_o,temp*Rh));
          } else if ($this->lat0 < 0.0) {
          lon = Common::adjust_lon($this->long0 - atan2(-$p->x,$p->y));
          } else {
          lon = Common::adjust_lon($this->long0 + atan2($p->x, -$p->y));
          }
          } else {
          lat = $this->lat0;
          }
         */
        //return(OK);
        $p->x = Common::adjust_lon($this->long0 + $lam);
        $p->y = $phi;
        return $p;
    }
825973
@Override
    public void backward() {
        Tensor x = modInX.getOutput();
        Tensor w = modInW.getOutput();
        {
            Tensor tmp = new Tensor(yAdj); // copy
            tmp.elemDivide(w);
            correctForZeros(tmp);
            modInX.getOutputAdj().elemAdd(tmp);
        }
        {
            Tensor tmp = new Tensor(w); // copy
            tmp.fill(s.one());
            tmp.elemDivide(w);
            tmp.elemDivide(w);
            tmp.multiply(s.fromReal(-1));
            tmp.elemMultiply(yAdj);
            tmp.elemMultiply(x); 
            correctForZeros(tmp);
            modInW.getOutputAdj().elemAdd(tmp);
        }
    }
1340502
public void inverse (double data[], int i0, int stride) {
    backtransform(data, i0, stride);

  /* normalize inverse fft with 1/n */
    double norm = normalization();
    for (int i = 0; i < n; i++) {
      data[i0+stride*i]   *= norm;
      data[i0+stride*i+1] *= norm; }}
624757
function inverse$2(p) {
        var con, phi;
        var lat, lon;
        var x = (p.x - this.x0) * (1 / this.a);
        var y = (p.y - this.y0) * (1 / this.a);

        if (!this.es) {
            var f = Math.exp(x / this.k0);
            var g = 0.5 * (f - 1 / f);
            var temp = this.lat0 + y / this.k0;
            var h = Math.cos(temp);
            con = Math.sqrt((1 - Math.pow(h, 2)) / (1 + Math.pow(g, 2)));
            lat = Math.asin(con);

            if (y < 0) {
                lat = -lat;
            }

            if ((g === 0) && (h === 0)) {
                lon = 0;
            }
            else {
                lon = adjust_lon(Math.atan2(g, h) + this.long0);
            }
        }
        else { // ellipsoidal form
            con = this.ml0 + y / this.k0;
            phi = pj_inv_mlfn(con, this.es, this.en);

            if (Math.abs(phi) < HALF_PI) {
                var sin_phi = Math.sin(phi);
                var cos_phi = Math.cos(phi);
                var tan_phi = Math.abs(cos_phi) > EPSLN ? Math.tan(phi) : 0;
                var c = this.ep2 * Math.pow(cos_phi, 2);
                var cs = Math.pow(c, 2);
                var t = Math.pow(tan_phi, 2);
                var ts = Math.pow(t, 2);
                con = 1 - this.es * Math.pow(sin_phi, 2);
                var d = x * Math.sqrt(con) / this.k0;
                var ds = Math.pow(d, 2);
                con = con * tan_phi;

                lat = phi - (con * ds / (1 - this.es)) * 0.5 * (1 -
                    ds / 12 * (5 + 3 * t - 9 * c * t + c - 4 * cs -
                    ds / 30 * (61 + 90 * t - 252 * c * t + 45 * ts + 46 * c -
                    ds / 56 * (1385 + 3633 * t + 4095 * ts + 1574 * ts * t))));

                lon = adjust_lon(this.long0 + (d * (1 -
                    ds / 6 * (1 + 2 * t + c -
                    ds / 20 * (5 + 28 * t + 24 * ts + 8 * c * t + 6 * c -
                    ds / 42 * (61 + 662 * t + 1320 * ts + 720 * ts * t)))) / cos_phi));
            }
            else {
                lat = HALF_PI * sign(y);
                lon = 0;
            }
        }

        p.x = lon;
        p.y = lat;

        return p;
    }
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));
              }
            }