de.lmu.ifi.dbs.elki.index.tree.metrical.mtreevariants.mktrees.mkapp
Class PolynomialApproximation

java.lang.Object
  extended by de.lmu.ifi.dbs.elki.index.tree.metrical.mtreevariants.mktrees.mkapp.PolynomialApproximation
All Implemented Interfaces:
Externalizable, Serializable

public class PolynomialApproximation
extends Object
implements Externalizable

Provides an polynomial approximation bo + b1*k + b2*k^2 + ... + bp*k^p for knn-distances consisting of parameters b0, ..., bp.

See Also:
Serialized Form

Field Summary
private  double[] b
          The parameters b0, ..., bp.
private static long serialVersionUID
           
 
Constructor Summary
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
 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 polynoial approximation at the specified k.
 void readExternal(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.
 String toString()
          Returns a string representation of the object.
 void writeExternal(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

serialVersionUID

private static final long serialVersionUID
See Also:
Constant Field Values

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 polynoial approximation at the specified k.

Parameters:
k - the value for which the polynoial approximation should be returned
Returns:
the function value of the polynoial approximation at the specified k

writeExternal

public void writeExternal(ObjectOutput out)
                   throws 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 Externalizable
Parameters:
out - the stream to write the object to
Throws:
IOException

readExternal

public void readExternal(ObjectInput in)
                  throws 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 Externalizable
Parameters:
in - the stream to read data from in order to restore the object
Throws:
IOException

toString

public String toString()
Returns a string representation of the object.

Overrides:
toString in class Object
Returns:
a string representation of the object.

Release 0.4.0 (2011-09-20_1324)