Example usage for org.apache.commons.math3.analysis.function StepFunction StepFunction

List of usage examples for org.apache.commons.math3.analysis.function StepFunction StepFunction

Introduction

In this page you can find the example usage for org.apache.commons.math3.analysis.function StepFunction StepFunction.

Prototype

public StepFunction(double[] x, double[] y)
        throws NullArgumentException, NoDataException, DimensionMismatchException 

Source Link

Document

Builds a step function from a list of arguments and the corresponding values.

Usage

From source file:de.bund.bfr.math.InterpolationFactory.java

public UnivariateFunction createInterpolationFunction(double[] x, double[] y) {
    switch (type) {
    case STEP://from   ww  w  .j av a2 s  . c o m
        return new StepFunction(x, y);
    case SPLINE:
        return new SplineInterpolator().interpolate(x, y);
    default:
        throw new RuntimeException("Unknown type of InterpolationFactory: " + type);
    }
}

From source file:eu.crisis_economics.abm.markets.clearing.heterogeneous.StepResponseFunction.java

private void initCommon(final BoundedUnivariateFunction existingResponseFunction,
        final double[] stepCoordinates) {
    double[] stepYCoordinates = new double[stepCoordinates.length];
    for (int i = 0; i < stepYCoordinates.length; ++i)
        stepYCoordinates[i] = 1. - i / (double) stepYCoordinates.length;
    this.stepFunction = new StepFunction(stepCoordinates, stepYCoordinates);
    this.existingResponseFunction = existingResponseFunction;
}