/** {@inheritDoc} */ public double end() { return FastMath.sqrt(sum); } });
/** * @param i which eigenvalue to find the norm of * @return the norm of ith (complex) eigenvalue. */ private double eigenvalueNorm(int i) { final double re = realEigenvalues[i]; final double im = imagEigenvalues[i]; return FastMath.sqrt(re * re + im * im); }
/** * @return Returns the standard deviation */ public double getStandardDeviation() { return FastMath.sqrt(variance); }
/** {@inheritDoc} */ public double getNorm() { // there are no cancellation problems here, so we use the straightforward formula return FastMath.sqrt (x * x + y * y + z * z); }
/** * Computes the norm of the quaternion. * * @return the norm. */ public double getNorm() { return FastMath.sqrt(q0 * q0 + q1 * q1 + q2 * q2 + q3 * q3); }
/** {@inheritDoc} */ @Override public double getNorm() { double sum = 0; for (double a : data) { sum += a * a; } return FastMath.sqrt(sum); }
/** {@inheritDoc} */ public double distance(Point<Euclidean3D> v) { final Vector3D v3 = (Vector3D) v; final double dx = v3.x - x; final double dy = v3.y - y; final double dz = v3.z - z; return FastMath.sqrt(dx * dx + dy * dy + dz * dz); }
/** Compute the inverse hyperbolic cosine of a number. * @param a number on which evaluation is done * @return inverse hyperbolic cosine of a */ public static double acosh(final double a) { return FastMath.log(a + FastMath.sqrt(a * a - 1)); }
/** * Estimates the standard error of the regression. * * @return regression standard error * @since 2.2 */ public double estimateRegressionStandardError() { return FastMath.sqrt(estimateErrorVariance()); }
/** {@inheritDoc} */ public SparseGradient sqrt() { final double sqrt = FastMath.sqrt(value); return new SparseGradient(sqrt, 0.5 / sqrt, derivatives); }
/** * Returns the quadratic mean, a.k.a. * <a href="http://mathworld.wolfram.com/Root-Mean-Square.html"> * root-mean-square</a> of the available values * @return The quadratic mean or {@code Double.NaN} if no values * have been added. */ public double getQuadraticMean() { final long size = getN(); return size > 0 ? FastMath.sqrt(getSumsq() / size) : Double.NaN; }
public static final double fastDistance(Coordinate from, Coordinate to, double cosLat) { double dLat = toRadians(from.y - to.y); double dLon = toRadians(from.x - to.x) * cosLat; return RADIUS_OF_EARTH_IN_M * sqrt(dLat * dLat + dLon * dLon); }
/** * Returns the quadratic mean, a.k.a. * <a href="http://mathworld.wolfram.com/Root-Mean-Square.html"> * root-mean-square</a> of the available values * @return The quadratic mean or {@code Double.NaN} if no values * have been added. */ public double getQuadraticMean() { final long n = getN(); return n > 0 ? FastMath.sqrt(getSumsq() / n) : Double.NaN; }
/** {@inheritDoc} */ public double getCost() { final ArrayRealVector r = new ArrayRealVector(this.getResiduals()); return FastMath.sqrt(r.dotProduct(r)); }
@Override public INDArray doCreate(long[] shape, INDArray paramsView) { return Nd4j.randn(order(), shape).divi(FastMath.sqrt(fanOut)); }
@Override public INDArray doCreate(long[] shape, INDArray paramsView) { return Nd4j.randn(order(), shape).divi(FastMath.sqrt(fanIn)); }
@Override public INDArray doCreate(long[] shape, INDArray paramsView) { return Nd4j.randn(order(), shape).divi(FastMath.sqrt((fanIn + fanOut) / 2)); }
/** {@inheritDoc} */ public ConfidenceInterval createInterval(int numberOfTrials, int numberOfSuccesses, double confidenceLevel) { IntervalUtils.checkParameters(numberOfTrials, numberOfSuccesses, confidenceLevel); final double mean = (double) numberOfSuccesses / (double) numberOfTrials; final double alpha = (1.0 - confidenceLevel) / 2; final NormalDistribution normalDistribution = new NormalDistribution(); final double difference = normalDistribution.inverseCumulativeProbability(1 - alpha) * FastMath.sqrt(1.0 / numberOfTrials * mean * (1 - mean)); return new ConfidenceInterval(mean - difference, mean + difference, confidenceLevel); }
/** * Computes the cost. * * @param residuals Residuals. * @return the cost. * @see #computeResiduals(double[]) */ protected double computeCost(double[] residuals) { final ArrayRealVector r = new ArrayRealVector(residuals); return FastMath.sqrt(r.dotProduct(getWeight().operate(r))); }
@Override public IComplexNumber log() { IComplexNumber result = dup(); double real = (double) result.realComponent(); double imaginary = (double) result.imaginaryComponent(); double modulus = FastMath.sqrt(real * real + imaginary * imaginary); double arg = FastMath.atan2(imaginary, real); return result.set(FastMath.log(modulus), arg); }