Return the jacobian of the expressions
543468
def get_jac(self):
        
        if self._jac is True:
            if self.band is None:
                f = self.be.Matrix(self.nf, 1, self.exprs)
                _x = self.be.Matrix(self.nx, 1, self.x)
                return f.jacobian(_x)
            else:
                # Banded
                return self.be.Matrix(banded_jacobian(
                    self.exprs, self.x, *self.band))
        elif self._jac is False:
            return False
        else:
            return self._jac
1364948
def hessian(self, x, y, theta_E, s, q):
        
        alpha_ra, alpha_dec = self.derivatives(x, y, theta_E, s, q)
        diff = self._diff
        alpha_ra_dx, alpha_dec_dx = self.derivatives(x + diff, y, theta_E, s, q)
        alpha_ra_dy, alpha_dec_dy = self.derivatives(x, y + diff, theta_E, s, q)

        f_xx = (alpha_ra_dx - alpha_ra) / diff
        f_xy = (alpha_ra_dy - alpha_ra) / diff
        # f_yx = (alpha_dec_dx - alpha_dec)/diff
        f_yy = (alpha_dec_dy - alpha_dec) / diff
        return f_xx, f_yy, f_xy
164921
def double(self):
        
        X1, Y1, Z1 = self.X, self.Y, self.Z

        if Y1 == 0:
            return POINT_AT_INFINITY
        S = (4 * X1 * Y1 ** 2) % self.P
        M = (3 * X1 ** 2 + self.a * Z1 ** 4) % self.P
        X3 = (M ** 2 - 2 * S) % self.P
        Y3 = (M * (S - X3) - 8 * Y1 ** 4) % self.P
        Z3 = (2 * Y1 * Z1) % self.P
        return JacobianPoint(X3, Y3, Z3)
431467
JCExpression term2() {
        JCExpression t = term3();
        if ((mode & EXPR) != 0 && prec(token.kind) >= TreeInfo.orPrec) {
            mode = EXPR;
            return term2Rest(t, TreeInfo.orPrec);
        } else {
            return t;
        }
    }
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)
949926
def adjoint(self):
        """"""
        if not self.is_linear:
            raise ValueError('operator with nonzero pad_const ({}) is not'
                             ' linear and has no adjoint'
                             ''.format(self.pad_const))

        return -PartialDerivative(self.range, self.axis, self.domain,
                                  _ADJ_METHOD[self.method],
                                  _ADJ_PADDING[self.pad_mode],
                                  self.pad_const)
1336151
def getRect(self):
		
		return (self.x, self.y, self.w, self.h)
1161673
def jacobian(f, x, param):
    

    N = len(x)
    M = len(param)
    J = np.zeros((N, M))
    for i, x_i in enumerate(x):
        for j in range(M):
            parameters=[]
            for k, p_k in enumerate(param):
                    parameters.append(AdFloat(p_k, k == j))
            # parameters = [AdFloat(p_k, k == j) for k, p_k in enumerate(param)]
            val = f(AdFloat(x_i,0), parameters)
            J[i, j] = val.dx

    return J
647726
def eval_jacobian(self, *args, **kwargs):
        
        Ans = variabletuple('Ans', self)
        return Ans(*self.finite_difference(*args, **kwargs))
152239
def get_support_variables(polynomial):
    
    support = []
    if is_number_type(polynomial):
        return support
    for monomial in polynomial.expand().as_coefficients_dict():
        mon, _ = __separate_scalar_factor(monomial)
        symbolic_support = flatten(split_commutative_parts(mon))
        for s in symbolic_support:
            if isinstance(s, Pow):
                base = s.base
                if is_adjoint(base):
                    base = base.adjoint()
                support.append(base)
            elif is_adjoint(s):
                support.append(s.adjoint())
            elif isinstance(s, Operator):
                support.append(s)
    return support
645205
def _pdf(self, **kwargs):
        
        for p in self._params:
            if p not in kwargs.keys():
                raise ValueError('Missing parameter {} to construct pdf.'
                                 .format(p))
        if kwargs in self:
            # transform into the kde space
            jacobian = 1.
            for param, tparam in self._tparams.items():
                t = self._transforms[tparam]
                try:
                    samples = t.transform({param: kwargs[param]})
                except ValueError as e:
                    # can get a value error if the value is exactly == to
                    # the bounds, in which case, just return 0.
                    if kwargs[param] in self.bounds[param]:
                        return 0.
                    else:
                        raise ValueError(e)
                kwargs[param] = samples[tparam]
                # update the jacobian for the transform; if p is the pdf
                # in the params frame (the one we want) and p' is the pdf
                # in the transformed frame (the one that's calculated) then:
                # p = J * p', where J is the Jacobian of going from p to p'
                jacobian *= t.jacobian(samples)
            # for scipy < 0.15.0, gaussian_kde.pdf = gaussian_kde.evaluate
            this_pdf = jacobian * self._kde.evaluate([kwargs[p]
                                                      for p in self._params])
            if len(this_pdf) == 1:
                return float(this_pdf)
            else:
                return this_pdf
        else:
            return 0.
947357
protected void computeNumericalJacobian( DMatrixRMaj param ,
                                             DMatrixRMaj jacobian )
    {
        double invDelta = 1.0/DELTA;

        function.compute(param, temp0);

        // compute the jacobian by perturbing the parameters slightly
        // then seeing how it effects the results.
        for( int i = 0; i < param.getNumElements(); i++ ) {
            param.data[i] += DELTA;
            function.compute(param, temp1);
            // compute the difference between the two parameters and divide by the delta
            // temp1 = (temp1 - temp0)/delta
            CommonOps_DDRM.add(invDelta,temp1,-invDelta,temp0,temp1);

            // copy the results into the jacobian matrix
            // J(i,:) = temp1
            CommonOps_DDRM.insert(temp1,jacobian,0,i);

            param.data[i] -= DELTA;
        }
    }
1028465
def get_scalar_product(self, other):
        """"""
        return self.x*other.x+self.y*other.y
379549
def inverse_jacobian(self, maps):
        
        m1 = maps[parameters.mass1]
        m2 = maps[parameters.mass2]
        mchirp = conversions.mchirp_from_mass1_mass2(m1, m2)
        eta = conversions.eta_from_mass1_mass2(m1, m2)
        return -1. * mchirp / eta**(6./5)
1178318
def derivativeX(self,*args):
        '''
        
        '''
        if self.n_dims >= 4:
            j = 1
        else:
            j = 0
        if self.i_dim == j:
            return np.ones_like(*args[0])
        else:
            return np.zeros_like(*args[0])
668343
def rpy(self):
    

    x, y, z, w = self.x, self.y, self.z, self.w
    roll = math.atan2(2*y*w - 2*x*z, 1 - 2*y*y - 2*z*z)
    pitch = math.atan2(2*x*w - 2*y*z, 1 - 2*x*x - 2*z*z)
    yaw = math.asin(2*x*y + 2*z*w)
    return (roll, pitch, yaw)
726891
def hessian(self, x, y, center_x = 0, center_y = 0, **kwargs):
        

        diff = 1e-6
        alpha_ra, alpha_dec = self.derivatives(x, y, center_x = center_x, center_y = center_y,
                                               **kwargs)

        alpha_ra_dx, alpha_dec_dx = self.derivatives(x + diff, y, center_x = center_x, center_y = center_y,
                                               **kwargs)
        alpha_ra_dy, alpha_dec_dy = self.derivatives(x, y + diff, center_x = center_x, center_y = center_y,
                                               **kwargs)

        dalpha_rara = (alpha_ra_dx - alpha_ra) / diff
        dalpha_radec = (alpha_ra_dy - alpha_ra) / diff
        dalpha_decdec = (alpha_dec_dy - alpha_dec) / diff

        f_xx = dalpha_rara
        f_yy = dalpha_decdec
        f_xy = dalpha_radec

        return f_xx, f_yy, f_xy