/** {@inheritDoc} */ @Override public double logDensity(double x) { final double n = degreesOfFreedom; final double nPlus1Over2 = (n + 1) / 2; return factor - nPlus1Over2 * FastMath.log(1 + x * x / n); }
/** Base 10 logarithm. * @return base 10 logarithm of the instance */ public SparseGradient log10() { return new SparseGradient(FastMath.log10(value), 1.0 / (FastMath.log(10.0) * value), derivatives); }
/** * {@inheritDoc} */ @Override public void increment(final double d) { value += FastMath.log(d); n++; }
/** * Natural logarithm. * * @param x a double * @return log(x) */ public static double log(final double x) { return log(x, null); }
/** {@inheritDoc} */ public double value(double x) { return FastMath.log(x); }
/** {@inheritDoc} */ public double boundedToUnbounded(final double x) { return FastMath.log(x - lower); }
/** {@inheritDoc} * * See documentation of {@link #density(double)} for computation details. */ @Override public double logDensity(double x) { if (x < mu) { return Double.NaN; } final double delta = x - mu; final double f = halfC / delta; return 0.5 * FastMath.log(f / FastMath.PI) - f - FastMath.log(delta); }
/** {@inheritDoc} */ public double boundedToUnbounded(final double x) { return -FastMath.log(upper - x); }
/** {@inheritDoc} */ public double boundedToUnbounded(final double x) { return FastMath.log(x - lower); }
/** {@inheritDoc} */ public double boundedToUnbounded(final double x) { return -FastMath.log(upper - x); }
/** {@inheritDoc} */ @Override public double inverseCumulativeProbability(double p) throws OutOfRangeException { if (p < 0.0 || p > 1.0) { throw new OutOfRangeException(p, 0.0, 1.0); } else if (p == 0) { return Double.NEGATIVE_INFINITY; } else if (p == 1) { return Double.POSITIVE_INFINITY; } return mu - FastMath.log(-FastMath.log(p)) * beta; }
/** 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)); }
/** {@inheritDoc} * @since 3.2 */ public Decimal64 log() { return new Decimal64(FastMath.log(value)); }
/** * {@code h(x) := 1/x^exponent} * * @param x free parameter * @return h(x) */ private double h(final double x) { return FastMath.exp(-exponent * FastMath.log(x)); }
/** {@inheritDoc} */ public SparseGradient log() { return new SparseGradient(FastMath.log(value), 1.0 / value, derivatives); }
@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); }
/** * @param m Input matrix * @return Matrix representing the element-wise logarithm of m. */ private static RealMatrix log(final RealMatrix m) { final double[][] d = new double[m.getRowDimension()][m.getColumnDimension()]; for (int r = 0; r < m.getRowDimension(); r++) { for (int c = 0; c < m.getColumnDimension(); c++) { d[r][c] = FastMath.log(m.getEntry(r, c)); } } return new Array2DRowRealMatrix(d, false); }
/** * @param m Input matrix * @return Matrix representing the element-wise logarithm of m. */ private static RealMatrix log(final RealMatrix m) { final double[][] d = new double[m.getRowDimension()][m.getColumnDimension()]; for (int r = 0; r < m.getRowDimension(); r++) { for (int c = 0; c < m.getColumnDimension(); c++) { d[r][c] = FastMath.log(m.getEntry(r, c)); } } return new Array2DRowRealMatrix(d, false); }