Interface Math<T>

  • Type Parameters:
    T - the type of the elements that can be handled by the math class.
    All Known Implementing Classes:
    DoubleMath

    public interface Math<T>
    Implementations of this interface have to provide all the mathematical methods which will be required for numerical calculations. The idea is, that there exists a default implementation, which only takes basic field operations to perform all the calculations. Thus, the only required structure will be a field. Clearly, this might be not well performing in many case. Thus it is possible to hook in dedicated implementations instead.

    The general idea is to mimic the methods of Math.

    Ideas might also be taken from apache.commons.math and the FastMath class existing there.

    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      T pow​(T base, T exponent)
      Has to return the first argument raised to the power of the second argument.
      T root​(T base, T exponent)  
    • Method Detail

      • pow

        T pow​(T base,
              T exponent)
        Has to return the first argument raised to the power of the second argument. This has to work for positive and negative exponents.
        Parameters:
        base - the number which should be raised to the power.
        exponent - the exponent which shall be applied to the base.
        Returns:
        base^exponent
      • root

        T root​(T base,
               T exponent)