Module net.finmath.lib
Class Partition
- java.lang.Object
-
- net.finmath.marketdata.model.curves.locallinearregression.Partition
-
public class Partition extends Object
This class represents a set of discrete points in time with weighted interval reference points.- Version:
- 1.0
- Author:
- Moritz Scherrmann
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description double
d(double x)
If a given x is into an interval of the partition, this method returns the reference point of the corresponding interval.double
getIntervalLength(int intervalIndex)
int
getIntervalNumber(double x)
Returns for a given x the number of the interval where x is included.double
getIntervalReferencePoint(int intervalIndex)
int
getLength()
int
getNumberOfIntervals()
double
getPoint(int pointIndex)
double[]
getPoints()
double[]
getReferencePoints()
double
getWeight()
-
-
-
Constructor Detail
-
Partition
public Partition(double[] points, double weight)
Creates a partition.- Parameters:
points
- The points of the partition. It should be kept in mind that no point should be included twice. There is no need to take care of the order of the points.weight
- The weight if the partition as double. It is needed to compute the reference points.
-
Partition
public Partition(double[] points)
Creates a partition with fixed weight=0.5.- Parameters:
points
- The points of the partition. It should be kept in mind that no point should be included twice. There is no need to take care of the order of the points.
-
-
Method Detail
-
getIntervalNumber
public int getIntervalNumber(double x)
Returns for a given x the number of the interval where x is included. Note that the intervals are of the type [x_i,x_{i+1}). The first interval has number 1, the second number 2 and so on. If x is smaller than the minimum of the partition, the method return 0. If x is greater or equal the maximum of the partition, it returns the length of the partition.- Parameters:
x
- The point of interest.- Returns:
- The number of the intervals which contains x.
-
d
public double d(double x)
If a given x is into an interval of the partition, this method returns the reference point of the corresponding interval. If the given x is not contained in any interval of the partition, this method returns x.- Parameters:
x
- The point of interest.- Returns:
- The discretized value.
-
getReferencePoints
public double[] getReferencePoints()
-
getIntervalReferencePoint
public double getIntervalReferencePoint(int intervalIndex)
-
getPoints
public double[] getPoints()
-
getPoint
public double getPoint(int pointIndex)
-
getLength
public int getLength()
-
getNumberOfIntervals
public int getNumberOfIntervals()
-
getIntervalLength
public double getIntervalLength(int intervalIndex)
-
getWeight
public double getWeight()
-
-