|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectvec_math.LinearPrediction
public class LinearPrediction
A class based on the linear prediction code given in
Numerical Recipes in C, p568ff.It allows the calculating of the LP coefficients based on routine memcof and the prediction of values with these coefficients based on predic. This simple version is taylored for a first glimpse on the capabilities of linear prediction, therefore no root-adjusting algorithm is implemented.
The normal use of this class is as follows:
setData(double[]) it takes a double array,
the length of the array must be equal to the data set length.calculateCoefficients(int),
supplying the number of coefficients in the method call. Returned is the
means square discrepancy. This method is a timely one.predict(int). This method takes
the number of values to predict as an argument and returns a double array of
predicted values.
| Nested Class Summary | |
|---|---|
static class |
LinearPrediction.Debug
A debugging class. |
| Field Summary | |
|---|---|
private double |
average
The mean of the data. |
private double[] |
data
The data array. |
private double[] |
lp
The coefficients to the linear prediction. |
private boolean |
unbias
Whether to subtract the mean prior to coefficient calculation. |
private double |
xms
The mean square discrepancy on calculation of the ceofficients. |
| Constructor Summary | |
|---|---|
LinearPrediction()
Constructs a new linear prediction object with no bias removing. |
|
LinearPrediction(boolean subtract)
Constructs a new linear prediction object. |
|
| Method Summary | |
|---|---|
double |
calculateCoefficients(int m)
Calculates the linear prediction coefficients. |
double[] |
getCoefficients()
Returns the linear prediction coefficients. |
double[] |
getData()
Returns the data set. |
double |
getDiscrepancy()
Returns the mean square discrepancy as stored after a calculation of the coefficients using calculateCoefficients(int) or NaN if
no calculation has been done. |
double[] |
predict(int fut)
Predict the stated number of data points. |
void |
setData(double[] newdata)
Sets the data. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
private boolean unbias
private double average
private double[] data
private double[] lp
private double xms
| Constructor Detail |
|---|
public LinearPrediction()
public LinearPrediction(boolean subtract)
subtract - Whether to subtract the mean.| Method Detail |
|---|
public void setData(double[] newdata)
newdata - Data set where linear prediction should be applied to.public double[] getData()
public double[] getCoefficients()
calculateCoefficients(int).
public double getDiscrepancy()
calculateCoefficients(int) or NaN if
no calculation has been done.
public double calculateCoefficients(int m)
m - The number of LP coefficients to calculate.
public double[] predict(int fut)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||