ru.sscc.spline.polynomial
Class PSplineWorkspace

java.lang.Object
  |
  +--ru.sscc.spline.SplineWorkspace
        |
        +--ru.sscc.spline.mesh.SimpleMeshWorkspace
              |
              +--ru.sscc.spline.polynomial.PSplineWorkspace

public class PSplineWorkspace
extends SimpleMeshWorkspace

The workspace for 1D polynomial spline having full polynomial representation in mesh nodes.


Field Summary
protected  int derivative
          Derivative to calculate.
protected  int maxDegree
          The maximum degree of polynomials in spline representation.
protected  double scale
          Mesh scale factor.
protected  double[] weight
          Weight vector prepared for derivative calculation (its length should be not less than maxDegree).
 
Fields inherited from class ru.sscc.spline.mesh.SimpleMeshWorkspace
cellIndex, cellPoint
 
Fields inherited from class ru.sscc.spline.SplineWorkspace
data, dataCount, dataIndex
 
Constructor Summary
protected PSplineWorkspace(RealPointer data, double scale)
          Simple constructor with default initialization of internal attributes except scale factor.
protected PSplineWorkspace(RealPointer data, double scale, int maxDegree)
          Constructor.
 
Method Summary
 double calculate()
          Calculates polynomial using prepared internal attributes.
 void setDerivative(int derivative)
          Sets a derivative number for the next spline calculation.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

derivative

protected int derivative
Derivative to calculate.

weight

protected double[] weight
Weight vector prepared for derivative calculation (its length should be not less than maxDegree).

maxDegree

protected int maxDegree
The maximum degree of polynomials in spline representation.

scale

protected double scale
Mesh scale factor.
Constructor Detail

PSplineWorkspace

protected PSplineWorkspace(RealPointer data,
                           double scale)
Simple constructor with default initialization of internal attributes except scale factor.

PSplineWorkspace

protected PSplineWorkspace(RealPointer data,
                           double scale,
                           int maxDegree)
Constructor. Allocates the weight array of maxDegree length.
Parameters:
data - a pointer to spline coefficients container
scale - a mesh scale factor
maxDegree - a maximum spline degree (equals to internal degree)
Method Detail

setDerivative

public void setDerivative(int derivative)
Sets a derivative number for the next spline calculation. If derivative is changed, prepares the weight vector also.

calculate

public double calculate()
Calculates polynomial using prepared internal attributes. They are: the point cellPoint, the pointer data to coefficients, the dataCount containing polynomial degree + 1, the derivative number, and the weight array if a derivative is calculated.