/** {@inheritDoc} */ @Override public RealVector mapSqrtToSelf() { for (int i = 0; i < data.length; i++) { data[i] = FastMath.sqrt(data[i]); } return this; }
/** * Computes t test statistic for 1-sample t-test. * * @param m sample mean * @param mu constant to test against * @param v sample variance * @param n sample n * @return t test statistic */ protected double t(double m, double mu, double v, double n) { return (m - mu) / FastMath.sqrt(v / n); }
/** {@inheritDoc} */ @Override public double getNorm() { double sum = 0; for (double a : data) { sum += a * a; } return FastMath.sqrt(sum); }
/** {@inheritDoc} */ @Override public double value(double d) { return FastMath.sqrt(d); } };
/** Get the L<sub>2</sub> norm for the vector. * @return euclidian norm for the vector */ public double getNorm() { return FastMath.sqrt (x * x + y * y + z * z); }
/** Reset internal state to dummy values. */ protected void resetInternalState() { stepStart = Double.NaN; stepSize = FastMath.sqrt(minStep * maxStep); }
/** {@inheritDoc} */ public double end() { return FastMath.sqrt(sum); }
/** {@inheritDoc} */ @Override public double getFrobeniusNorm() { double sum2 = 0; for (int blockIndex = 0; blockIndex < blocks.length; ++blockIndex) { for (final double entry : blocks[blockIndex]) { sum2 += entry * entry; } } return FastMath.sqrt(sum2); }
/** * @return Returns the standard deviation */ public double getStandardDeviation() { return FastMath.sqrt(variance); }
/** Compute the distance between two vectors according to the L<sub>2</sub> norm. * <p>Calling this method is equivalent to calling: * <code>v1.subtract(v2).getNorm()</code> except that no intermediate * vector is built</p> * @param v1 first vector * @param v2 second vector * @return the distance between v1 and v2 according to the L<sub>2</sub> norm */ public static double distance(Vector3D v1, Vector3D v2) { final double dx = v2.x - v1.x; final double dy = v2.y - v1.y; final double dz = v2.z - v1.z; return FastMath.sqrt(dx * dx + dy * dy + dz * dz); }
/** {@inheritDoc} */ @Override public double getDistance(double[] v) throws IllegalArgumentException { checkVectorDimensions(v.length); double sum = 0; for (int i = 0; i < data.length; ++i) { final double delta = data[i] - v[i]; sum += delta * delta; } return FastMath.sqrt(sum); }
/** 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)); }
/** * Get the Root Mean Square value. * Get the Root Mean Square value, i.e. the root of the arithmetic * mean of the square of all weighted residuals. This is related to the * criterion that is minimized by the optimizer as follows: if * <em>c</em> if the criterion, and <em>n</em> is the number of * measurements, then the RMS is <em>sqrt (c/n)</em>. * * @return RMS value */ public double getRMS() { return FastMath.sqrt(getChiSquare() / rows); }
/** * {@inheritDoc} */ @Override public double getResult() { return FastMath.sqrt(variance.getResult()); }
/** {@inheritDoc} */ public double getNorm() { double sum = 0; Iterator<Entry> it = sparseIterator(); Entry e; while (it.hasNext() && (e = it.next()) != null) { final double value = e.getValue(); sum += value * value; } return FastMath.sqrt(sum); }
/** {@inheritDoc} */ @Override public double getDistance(double[] v) throws IllegalArgumentException { checkVectorDimensions(v.length); double res = 0; for (int i = 0; i < v.length; i++) { double delta = entries.get(i) - v[i]; res += delta * delta; } return FastMath.sqrt(res); }
/** * {@inheritDoc} */ public double[] estimateRegressionParametersStandardErrors() { double[][] betaVariance = estimateRegressionParametersVariance(); double sigma = calculateErrorVariance(); int length = betaVariance[0].length; double[] result = new double[length]; for (int i = 0; i < length; i++) { result[i] = FastMath.sqrt(sigma * betaVariance[i][i]); } return result; }
/** * Transform the given real data set. * <p> * The formula is F<sub>n</sub> = √(2/N) ∑<sub>k=0</sub><sup>N-1</sup> f<sub>k</sub> sin(π nk/N) * </p> * * @param f the real data array to be transformed * @return the real transformed array * @throws IllegalArgumentException if any parameters are invalid */ public double[] transform2(double f[]) throws IllegalArgumentException { double scaling_coefficient = FastMath.sqrt(2.0 / f.length); return FastFourierTransformer.scaleArray(fst(f), scaling_coefficient); }
/** {@inheritDoc} */ public double getDistance(RealVector v) throws IllegalArgumentException { checkVectorDimensions(v); double d = 0; Iterator<Entry> it = iterator(); Entry e; while (it.hasNext() && (e = it.next()) != null) { final double diff = e.getValue() - v.getEntry(e.getIndex()); d += diff * diff; } return FastMath.sqrt(d); }
/** Get the angle of the rotation. * @return angle of the rotation (between 0 and π) * @see #Rotation(Vector3D, double) */ public double getAngle() { if ((q0 < -0.1) || (q0 > 0.1)) { return 2 * FastMath.asin(FastMath.sqrt(q1 * q1 + q2 * q2 + q3 * q3)); } else if (q0 < 0) { return 2 * FastMath.acos(-q0); } return 2 * FastMath.acos(q0); }