BasisSplineVolatilityTermStructureProvider implements VolatilitySurfaceProvider { @Override public VolatilitySurface getVolSurface(final DoubleMatrix1D modelParameters) { ArgumentChecker.notNull(modelParameters, "modelParameters"); final Function1D<Double, Double> func = new BasisFunctionAggregation<>(_bSplines, modelParameters.getData()); final Function2D<Double, Double> func2D = new Function2D<Double, Double>() { @Override public Double evaluate(final Double t, final Double k) { return func.evaluate(t); } }; final FunctionalDoublesSurface surface = new FunctionalDoublesSurface(func2D); return new VolatilitySurface(surface); } BasisSplineVolatilityTermStructureProvider(final List<Function1D<Double, Double>> bSlines);  BasisSplineVolatilityTermStructureProvider(final double t1, final double t2, final int nKnots, final int degree); @Override VolatilitySurface getVolSurface(final DoubleMatrix1D modelParameters); @Override Surface<Double, Double, DoubleMatrix1D> getParameterSensitivitySurface(final DoubleMatrix1D modelParameters); @Override Surface<Double, Double, Pair<Double, DoubleMatrix1D>> getVolAndParameterSensitivitySurface(final DoubleMatrix1D modelParameters); @Override int getNumModelParameters();  }
@Test public void altConstructorTest() { final Function1D<Double, Double> f1 = new Function1D<Double, Double>() { @Override public Double evaluate(final Double x) { return 1.0; } }; final Function1D<Double, Double> f2 = new Function1D<Double, Double>() { @Override public Double evaluate(final Double x) { return Math.exp(-0.2 * x); } }; final List<Function1D<Double, Double>> functions = new ArrayList<>(); functions.add(f1); functions.add(f2); final BasisSplineVolatilityTermStructureProvider pro = new BasisSplineVolatilityTermStructureProvider(functions); final DoubleMatrix1D w = new DoubleMatrix1D(0.2, 0.7); final VolatilitySurface volSurface = pro.getVolSurface(w); final double t = 1.3; assertEquals(w.getEntry(0) * f1.evaluate(t) + w.getEntry(1) * f2.evaluate(t), volSurface.getVolatility(t, 0.05)); }