### Question:
BasisFunctionGenerator { public List<Function<Double, Double>> generateSet(BasisFunctionKnots knots) { ArgChecker.notNull(knots, "knots"); double[] k = knots.getKnots(); List<Function<Double, Double>> set = null; for (int d = 0; d <= knots.getDegree(); d++) { set = generateSet(k, d, set); } return set; }  List<Function<Double, Double>> generateSet(BasisFunctionKnots knots); List<Function<double[], Double>> generateSet(BasisFunctionKnots[] knots);  }### Answer:
@Test public void testTwoD() { BasisFunctionKnots knots1 = BasisFunctionKnots.fromInternalKnots(KNOTS, 2); BasisFunctionKnots knots2 = BasisFunctionKnots.fromInternalKnots(KNOTS, 3); List<Function<double[], Double>> set = GENERATOR.generateSet(new BasisFunctionKnots[] {knots1, knots2}); int index = FunctionUtils.toTensorIndex(new int[] {3, 3}, new int[] {knots1.getNumSplines(), knots2.getNumSplines()}); Function<double[], Double> func = set.get(index); assertThat(func.apply(new double[] {2.0, 2.0})).isEqualTo(1d / 3d); assertThat(func.apply(new double[] {2.5, 2.0})).isEqualTo(1d / 2d); assertThat(func.apply(new double[] {1.5, 3.5})).isEqualTo(1d / 8d / 48d); assertThat(func.apply(new double[] {4.0, 2.5})).isEqualTo(0); }
@Test public void testThreeD() { BasisFunctionKnots knots1 = BasisFunctionKnots.fromInternalKnots(KNOTS, 2); BasisFunctionKnots knots2 = BasisFunctionKnots.fromInternalKnots(KNOTS, 3); BasisFunctionKnots knots3 = BasisFunctionKnots.fromInternalKnots(KNOTS, 1); List<Function<double[], Double>> set = GENERATOR.generateSet(new BasisFunctionKnots[] {knots1, knots2, knots3}); int index = FunctionUtils.toTensorIndex(new int[] {3, 3, 3}, new int[] {knots1.getNumSplines(), knots2.getNumSplines(), knots3.getNumSplines()}); Function<double[], Double> func = set.get(index); assertThat(func.apply(new double[] {2.0, 2.0, 3.0})).isEqualTo(1d / 3d); }