List of usage examples for org.apache.commons.math3.analysis FunctionUtils sample
public static double[] sample(UnivariateFunction f, double min, double max, int n)
From source file:experiment.FastCosineTransformer_bug.java
/** * {@inheritDoc}//from w w w. j av a 2 s . co m * * @throws org.apache.commons.math3.exception.NonMonotonicSequenceException * if the lower bound is greater than, or equal to the upper bound * @throws org.apache.commons.math3.exception.NotStrictlyPositiveException * if the number of sample points is negative * @throws MathIllegalArgumentException if the number of sample points is * not a power of two plus one */ public double[] transform(final UnivariateFunction f, final double min, final double max, final int n, final TransformType type) throws MathIllegalArgumentException { final double[] data = FunctionUtils.sample(f, min, max, n); return transform(data, type); }
From source file:experiment.FastSineTransformer_bug.java
/** * {@inheritDoc}// w ww . ja va2 s . co m * * This implementation enforces {@code f(x) = 0.0} at {@code x = 0.0}. * * @throws org.apache.commons.math3.exception.NonMonotonicSequenceException * if the lower bound is greater than, or equal to the upper bound * @throws org.apache.commons.math3.exception.NotStrictlyPositiveException * if the number of sample points is negative * @throws MathIllegalArgumentException if the number of sample points is not a power of two */ public double[] transform(final UnivariateFunction f, final double min, final double max, final int n, final TransformType type) { final double[] data = FunctionUtils.sample(f, min, max, n); data[0] = 0.0; return transform(data, type); }