|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.spaceroots.mantissa.functions.scalar.ComputableFunctionSampler
This class is a wrapper allowing to sample a
ComputableFunction.
The sample produced is a regular sample. It can be specified by several means :
The sample points are computed on demand, they are not stored. This allow to use this method for very large sample with little memory overhead. The drawback is that if the same sample points are going to be requested several times, they will be recomputed each time. In this case, the user should consider storing the points by some other means.
ComputableFunction,
Serialized Form| Constructor Summary | |
ComputableFunctionSampler(ComputableFunction function,
double[] range,
double step,
boolean adjustStep)
Constructor. |
|
ComputableFunctionSampler(ComputableFunction function,
double[] range,
int n)
Constructor. |
|
ComputableFunctionSampler(ComputableFunction function,
double begin,
double step,
int n)
Constructor. |
|
| Method Summary | |
ScalarValuedPair |
samplePointAt(int index)
Get the abscissa and value of the sample at the specified index. |
int |
size()
Get the number of points in the sample. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
public ComputableFunctionSampler(ComputableFunction function,
double begin,
double step,
int n)
ComputableFunction. Beware of the
classical off-by-one problem ! If you want to have a sample like
this : 0.0, 0.1, 0.2 ..., 1.0, then you should specify step = 0.1
and n = 11 (not n = 10).
begin - beginning of the range (will be the abscissa of the
first point)step - step between pointsn - number of points
public ComputableFunctionSampler(ComputableFunction function,
double[] range,
int n)
ComputableFunction.
range - abscissa range (from range [0] to
range [1])n - number of points
public ComputableFunctionSampler(ComputableFunction function,
double[] range,
double step,
boolean adjustStep)
ComputableFunction.
range - abscissa range (from range [0] to
range [1])step - step between pointsadjustStep - if true, the step is reduced in order to have
the last point of the sample exactly at range [1],
if false the last point will be between range [1] -
step and range [1]| Method Detail |
public int size()
SampledFunction
size in interface SampledFunction
public ScalarValuedPair samplePointAt(int index)
throws ArrayIndexOutOfBoundsException,
FunctionException
SampledFunction
samplePointAt in interface SampledFunctionindex - index in the sample, should be between 0 and
SampledFunction.size() - 1
ArrayIndexOutOfBoundsException - if the index is wrong
FunctionException - if an eventual underlying function
throws one
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||