Class PolynomialApproximation

  • All Implemented Interfaces:
    java.io.Externalizable, java.io.Serializable

    public class PolynomialApproximation
    extends java.lang.Object
    implements java.io.Externalizable
    Provides an polynomial approximation bo + b1*k + b2*k^2 + ... + bp*k^p for knn-distances consisting of parameters b0, ..., bp.
    Since:
    0.1
    Author:
    Elke Achtert
    See Also:
    Serialized Form
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private double[] b
      The parameters b0, ..., bp.
      private static long serialVersionUID  
    • Constructor Summary

      Constructors 
      Constructor Description
      PolynomialApproximation()
      Empty constructor for serialization purposes.
      PolynomialApproximation​(double[] b)
      Provides an polynomial approximation bo + b1*k + b2*k^2 + ... + bp*k^p for knn-distances consisting of parameters b0, ..., bp.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      double getB​(int p)
      Returns the parameter bp at the specified index p.
      double[] getCoefficients()
      Returns a copy of the the array of coefficients b0, ..., bp.
      int getPolynomialOrder()
      Returns the order of the polynom.
      double getValueAt​(int k)
      Returns the function value of the polynomial approximation at the specified k.
      void readExternal​(java.io.ObjectInput in)
      The object implements the readExternal method to restore its contents by calling the methods of DataInput for primitive types and readObject for objects, strings and arrays.
      java.lang.String toString()
      Returns a string representation of the object.
      void writeExternal​(java.io.ObjectOutput out)
      The object implements the writeExternal method to save its contents by calling the methods of DataOutput for its primitive values or calling the writeObject method of ObjectOutput for objects, strings, and arrays.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Field Detail

      • b

        private double[] b
        The parameters b0, ..., bp.
    • Constructor Detail

      • PolynomialApproximation

        public PolynomialApproximation()
        Empty constructor for serialization purposes.
      • PolynomialApproximation

        public PolynomialApproximation​(double[] b)
        Provides an polynomial approximation bo + b1*k + b2*k^2 + ... + bp*k^p for knn-distances consisting of parameters b0, ..., bp.
        Parameters:
        b - the parameters b0, ..., bi
    • Method Detail

      • getB

        public double getB​(int p)
        Returns the parameter bp at the specified index p.
        Parameters:
        p - the index
        Returns:
        the parameter bp at the specified index p
      • getCoefficients

        public double[] getCoefficients()
        Returns a copy of the the array of coefficients b0, ..., bp.
        Returns:
        the a copy of the array of coefficients b0, ..., bp
      • getPolynomialOrder

        public int getPolynomialOrder()
        Returns the order of the polynom.
        Returns:
        the order of the polynom
      • getValueAt

        public double getValueAt​(int k)
        Returns the function value of the polynomial approximation at the specified k.
        Parameters:
        k - the value for which the polynomial approximation should be returned
        Returns:
        the function value of the polynomial approximation at the specified k
      • writeExternal

        public void writeExternal​(java.io.ObjectOutput out)
                           throws java.io.IOException
        The object implements the writeExternal method to save its contents by calling the methods of DataOutput for its primitive values or calling the writeObject method of ObjectOutput for objects, strings, and arrays.
        Specified by:
        writeExternal in interface java.io.Externalizable
        Parameters:
        out - the stream to write the object to
        Throws:
        java.io.IOException
      • readExternal

        public void readExternal​(java.io.ObjectInput in)
                          throws java.io.IOException
        The object implements the readExternal method to restore its contents by calling the methods of DataInput for primitive types and readObject for objects, strings and arrays. The readExternal method must read the values in the same sequence and with the same types as were written by writeExternal.
        Specified by:
        readExternal in interface java.io.Externalizable
        Parameters:
        in - the stream to read data from in order to restore the object
        Throws:
        java.io.IOException
      • toString

        public java.lang.String toString()
        Returns a string representation of the object.
        Overrides:
        toString in class java.lang.Object
        Returns:
        a string representation of the object.