## Interface WeightingFunction

• All Superinterfaces:
Named

public interface WeightingFunction
extends Named
A function to allow a smooth weighing between two functions.

If two functions f(x) and g(x) fit the data set (x_i,y_i) at the points x_a and x_b (i.e. f(x_a) = g(x_a) = y_a and f(x_b) = g(x_b) = y_b), then a weighted function h(x) = w(x)f(x) + (1-w(x))*g(x) with 0 <= w(x) <= 1 will also fit the points a and b

• ### Method Summary

All Methods
Modifier and Type Method Description
double getWeight​(double y)
Gets the weight.
default double getWeight​(double[] xs, int index, double x)
Gets the function weight for point x, based on the lower bound index.
static WeightingFunction of​(String uniqueName)
Obtains an instance from the specified unique name.
• ### Methods inherited from interface com.opengamma.strata.collect.named.Named

getName
• ### Method Detail

• #### of

static WeightingFunction of​(String uniqueName)
Obtains an instance from the specified unique name.
Parameters:
uniqueName - the unique name
Returns:
the index
Throws:
IllegalArgumentException - if the name is not known
• #### getWeight

default double getWeight​(double[] xs,
int index,
double x)
Gets the function weight for point x, based on the lower bound index.
Parameters:
xs - the independent data points
index - the index of the data point below x
x - the x-point to find the weight for
Returns:
the weight
• #### getWeight

double getWeight​(double y)
Gets the weight.

The condition that must be satisfied by all weight functions is that w(1) = 1, w(0) = 0 and dw(y)/dy <= 0 - i.e. w(y) is monotonically decreasing.

Parameters:
y - a value between 0 and 1
Returns:
the weight