Class BasisFunctionKnots
- java.lang.Object
-
- com.opengamma.strata.math.impl.interpolation.BasisFunctionKnots
-
public final class BasisFunctionKnots extends Object
Helper class to hold the knots and polynomial degree that specify a set of basis functions.
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static BasisFunctionKnots
fromInternalKnots(double[] internalKnots, int degree)
Generate a set of knots capable of supporting the given degree of basis functions.static BasisFunctionKnots
fromKnots(double[] knots, int degree)
Generate a set of knots capable of supporting the given degree of basis functions.static BasisFunctionKnots
fromUniform(double xa, double xb, int nKnots, int degree)
Generate knots uniformly in the range xa and xb and knots outside this range to support the basis functions on the edge of the range.int
getDegree()
the polynomial degree of the basis functions.double[]
getKnots()
Get the full set of knots.int
getNumKnots()
The number of knots.int
getNumSplines()
The number of basis splines of the degree this set of knots will support.
-
-
-
Method Detail
-
fromUniform
public static BasisFunctionKnots fromUniform(double xa, double xb, int nKnots, int degree)
Generate knots uniformly in the range xa and xb and knots outside this range to support the basis functions on the edge of the range.- Parameters:
xa
- start of the rangexb
- end of the rangenKnots
- number of knots in the range (internal knots)degree
- the polynomial degree of the basis functions (this will determine how many external knots are required)- Returns:
- a BasisFunctionKnots instance
-
fromInternalKnots
public static BasisFunctionKnots fromInternalKnots(double[] internalKnots, int degree)
Generate a set of knots capable of supporting the given degree of basis functions. The given knots are used inside the range, with knots generated outside this range to support the basis functions on the edge of the range- Parameters:
internalKnots
- the internal knots. The start of the range is the first knot and the end is the last.degree
- the polynomial degree of the basis functions (this will determine how many external knots are required)- Returns:
- a BasisFunctionKnots instance
-
fromKnots
public static BasisFunctionKnots fromKnots(double[] knots, int degree)
Generate a set of knots capable of supporting the given degree of basis functions. All the knots, including those outside the range must be supplied - the first and last degree knots are outside the range (e.g. for degree = 2, the first and last two knots are out side the range and exist to support the basis functions on the edge of the range.- Parameters:
knots
- The total set of knots - must be strictly accedingdegree
- the polynomial degree of the basis functions- Returns:
- a BasisFunctionKnots instance
-
getKnots
public double[] getKnots()
Get the full set of knots.- Returns:
- the knots
-
getNumKnots
public int getNumKnots()
The number of knots.- Returns:
- number of knots
-
getDegree
public int getDegree()
the polynomial degree of the basis functions.- Returns:
- the degree
-
getNumSplines
public int getNumSplines()
The number of basis splines of the degree this set of knots will support.- Returns:
- number of splines
-
-