org.spaceroots.mantissa.quadrature.scalar
Class TrapezoidIntegratorSampler
- java.lang.Object
-
- org.spaceroots.mantissa.quadrature.scalar.TrapezoidIntegratorSampler
-
- All Implemented Interfaces:
- SampledFunctionIterator
public class TrapezoidIntegratorSampler extends java.lang.Object implements SampledFunctionIterator
This class implements a trapezoid integrator as a sample.A trapezoid integrator is a very simple one that assumes the function is constant over the integration step. Since it is very simple, this algorithm needs very small steps to achieve high accuracy, and small steps lead to numerical errors and instabilities.
This algorithm is almost never used and has been included in this package only as a simple template for more useful integrators.
- See Also:
TrapezoidIntegrator
-
-
Constructor Summary
Constructors Constructor and Description TrapezoidIntegratorSampler(SampledFunctionIterator iter)Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method and Description booleanhasNext()Check if the iterator can provide another point.ScalarValuedPairnextSamplePoint()Get the next point of a sampled function.
-
-
-
Constructor Detail
-
TrapezoidIntegratorSampler
public TrapezoidIntegratorSampler(SampledFunctionIterator iter) throws ExhaustedSampleException, FunctionException
Constructor. Build an integrator from an underlying sample iterator.- Parameters:
iter- iterator over the base function- Throws:
ExhaustedSampleExceptionFunctionException
-
-
Method Detail
-
hasNext
public boolean hasNext()
Description copied from interface:SampledFunctionIteratorCheck if the iterator can provide another point.- Specified by:
hasNextin interfaceSampledFunctionIterator- Returns:
- true if the iterator can provide another point.
-
nextSamplePoint
public ScalarValuedPair nextSamplePoint() throws ExhaustedSampleException, FunctionException
Description copied from interface:SampledFunctionIteratorGet the next point of a sampled function.- Specified by:
nextSamplePointin interfaceSampledFunctionIterator- Returns:
- the next point of the sampled function
- Throws:
ExhaustedSampleException- if the sample has been exhaustedFunctionException- if the underlying function throws one
-
-
DataMelt 3.0 © DataMelt by jWork.ORG