Documentation of 'jsat.math.FastMath' Java class
FastMath
jsat.math

Class FastMath



  • public class FastMath
    extends java.lang.Object
    This class contains fast implementations of many of the methods located in Math and SpecialMath. This speed comes at the cost of correctness, and in general the methods in this class attempt to have a relative error no worse than 10-3 for most inputs.

    Implementation details - and therfore accuracy / speed - may change over time. 10-3 is not a hard guarantee, but a goal. The accuracy near asymptotes and extreme values will never be guaranteed. The handling of special values will never be guaranteed.
    • Constructor Summary

      Constructors 
      Constructor and Description
      FastMath() 
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method and Description
      static double digamma(double x)
      Computes the digamma function of the input
      static double exp(double x)
      Exponentiates the given input value
      static int floor_log2(int x)
      Returns the value floor(log2(x)) for an integer
      static int floor_log2(long x)
      Returns the value floor(log2(x)) for an integer
      static double log(double x)
      Computes the natural logarithm of the input
      static double log2_2pd1(double x)
      Computes log2(x) using a Pade approximation.
      static double log2_c11(double x)
      Computes log2(x) using a cache of 211 values, consuming approximately 17 kilobytes of memory.
      The results are generally accurate to an absolute and relative error of 10-4
      static double log2(double x)
      Computes log2(x)
      static double pow(double a, double b)
      Computes ab.
      static double pow2(double x)
      Computes 2x.
      The results are generally accurate to an relative error of 10-4, but can be as accurate as 10-10
      static double pow2(int x)
      Computes 2x exactly be exploiting the IEEE format
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • FastMath

        public FastMath()
    • Method Detail

      • log

        public static double log(double x)
        Computes the natural logarithm of the input
        Parameters:
        x - the input
        Returns:
        loge(x)
      • log2

        public static double log2(double x)
        Computes log2(x)
        Parameters:
        x - the input
        Returns:
        the log base 2 of x
      • log2_2pd1

        public static double log2_2pd1(double x)
        Computes log2(x) using a Pade approximation. It is slower than log2_c11(double) but dose not use any extra memory.
        The results are generally accurate to an absolute and relative error of 10-4, but relative error can get as high as 10-10
        Parameters:
        x - the input
        Returns:
        the log base 2 of x
      • floor_log2

        public static int floor_log2(int x)
        Returns the value floor(log2(x)) for an integer
        Parameters:
        x - the integer to get the floored logarithm of
        Returns:
        floor(log2(x))
      • floor_log2

        public static int floor_log2(long x)
        Returns the value floor(log2(x)) for an integer
        Parameters:
        x - the integer to get the floored logarithm of
        Returns:
        floor(log2(x))
      • log2_c11

        public static double log2_c11(double x)
        Computes log2(x) using a cache of 211 values, consuming approximately 17 kilobytes of memory.
        The results are generally accurate to an absolute and relative error of 10-4
        Parameters:
        x - the input
        Returns:
        the log base 2 of x
      • pow2

        public static double pow2(int x)
        Computes 2x exactly be exploiting the IEEE format
        Parameters:
        x - the integer power to raise 2 too
        Returns:
        2x
      • pow2

        public static double pow2(double x)
        Computes 2x.
        The results are generally accurate to an relative error of 10-4, but can be as accurate as 10-10
        Parameters:
        x - the power to raise to
        Returns:
      • pow

        public static double pow(double a,
                                 double b)
        Computes ab.
        Parameters:
        a - the base
        b - the power
        Returns:
        ab
      • exp

        public static double exp(double x)
        Exponentiates the given input value
        Parameters:
        x - the input
        Returns:
        ex
      • digamma

        public static double digamma(double x)
        Computes the digamma function of the input
        Parameters:
        x - the input value
        Returns:
        ψ(x)

DataMelt 3.0 © DataMelt by jWork.ORG

You see the box below because you did not login.