ru.sscc.spline
Interface SplineBody

All Known Implementing Classes:
PSplineBody, GSplineBody

public interface SplineBody
extends java.io.Serializable

An abstract spline body interface. The spline body consists of an information shared between different splines calculated in the same conditions (only interpolated values are different). A spline body methods provide a calculation of a spline value at an arbitrary point. A partial derivatives calculation is possible for some splines. If a calculation is not supported for parameters required IllegalArgumentException should be thrown.


Field Summary
static java.lang.String DERIVATIVE_OUT_OF_RANGE
          An error message generated when a required derivative evaluation isn't supported.
static java.lang.String ONE_D_NONSUPPORTED
          An error message generated in attempt of 1D-type call for multidimensional spline.
static java.lang.String POINT_OUT_OF_RANGE
          An error message generated when a point goes out of domain where a spline is defined.
 
Method Summary
 double calculate(SplineWorkspace workspace)
          Calculates a partial derivative spline value at a required point.
 SplineWorkspace createWorkspace(RealPointer data)
          Creates a workspace required for a spline value and partial derivatives calculation.
 int dimension()
          Returns a spline dimension (a number of independent variables).
 int getVectorLength()
          Returns a full number of coefficients in a spline representation.
 int maxQuote()
          Returns a maximal number of spline coefficients simultaneously needed in a spline value or its partial derivatives calculation.
 void prepareWorkspace(SplineWorkspace workspace, double point, int index, int count)
          Prepares a workspace for an 1D spline derivative calculation at a point required.
 void prepareWorkspace(SplineWorkspace workspace, RealPointer point, int count)
          Prepares a workspace for a spline calculation at a point required.
 

Field Detail

ONE_D_NONSUPPORTED

public static final java.lang.String ONE_D_NONSUPPORTED
An error message generated in attempt of 1D-type call for multidimensional spline.

DERIVATIVE_OUT_OF_RANGE

public static final java.lang.String DERIVATIVE_OUT_OF_RANGE
An error message generated when a required derivative evaluation isn't supported.

POINT_OUT_OF_RANGE

public static final java.lang.String POINT_OUT_OF_RANGE
An error message generated when a point goes out of domain where a spline is defined.
Method Detail

dimension

public int dimension()
Returns a spline dimension (a number of independent variables).

getVectorLength

public int getVectorLength()
Returns a full number of coefficients in a spline representation.

createWorkspace

public SplineWorkspace createWorkspace(RealPointer data)
Creates a workspace required for a spline value and partial derivatives calculation. The workspace will contain all working information for a single spline value or its derivative calculation at any point. The pointer to data vector associated with this workspace is passed in parameters. It should be passed to workspace constructor.
Parameters:
data - a pointer to associated data vector

maxQuote

public int maxQuote()
Returns a maximal number of spline coefficients simultaneously needed in a spline value or its partial derivatives calculation.

prepareWorkspace

public void prepareWorkspace(SplineWorkspace workspace,
                             double point,
                             int index,
                             int count)
Prepares a workspace for an 1D spline derivative calculation at a point required. May be used for 1D splines only. A point is a point on the real axis and an index is a derivative index to be calculated. index=0 means a spline value calculation. A count parameter is an information on how many spline values will be later calculated for these parameters. Using this information a programmer could select an optimal calculation scheme. The method must set at least dataIndex and dataCount attributes of the workspace.
Parameters:
workspace - a spline workspace
point - a point on the real axis
index - a derivative index
count - a number of splines will be calculated later

prepareWorkspace

public void prepareWorkspace(SplineWorkspace workspace,
                             RealPointer point,
                             int count)
Prepares a workspace for a spline calculation at a point required. May be used for any (1D or multi-D) splines. A point vector means a point in the space of independent variables where a calculation should be processed. A count parameter is an information on how many spline values will be later calculated for these parameters. Using this information a programmer could select an optimal calculation scheme. The method must set at least dataIndex and dataCount attributes of the workspace.
Parameters:
workspace - a spline workspace
point - a point in the space of independent variables
count - a number of splines will be calculated later

calculate

public double calculate(SplineWorkspace workspace)
Calculates a partial derivative spline value at a required point. All information on the derivative and the point should be prepared before by one of prepareWorkspace methods. The workspace contains data pointer that points to the beginning of the subvector of all coefficients needed in the calculation. This subvector is set before the calculation via dataIndex and dataCount attributes of the workspace. It is not needed to save this pointer in the initial state.
Parameters:
workspace - a spline workspace
Returns:
the partial derivative spline value