24 package org.lightjason.agentspeak.action.builtin.math.interpolate;
26 import org.apache.commons.math3.analysis.UnivariateFunction;
27 import org.apache.commons.math3.analysis.interpolation.AkimaSplineInterpolator;
28 import org.apache.commons.math3.analysis.interpolation.DividedDifferenceInterpolator;
29 import org.apache.commons.math3.analysis.interpolation.LinearInterpolator;
30 import org.apache.commons.math3.analysis.interpolation.LoessInterpolator;
31 import org.apache.commons.math3.analysis.interpolation.NevilleInterpolator;
41 import javax.annotation.Nonnegative;
42 import javax.annotation.Nonnull;
43 import java.util.List;
44 import java.util.Locale;
45 import java.util.stream.Collectors;
89 @Nonnull
final List<ITerm> p_argument, @Nonnull
final List<ITerm> p_return )
91 final List<ITerm> l_arguments =
CCommon.
flatten( p_argument ).collect( Collectors.toList() );
92 if ( l_arguments.size() % 2 == 0 )
95 final int l_datasize = ( l_arguments.size() - 1 ) / 2;
98 EType.
from( l_arguments.get( 0 ).<String>raw() )
104 .map(
ITerm::<Number>raw )
105 .mapToDouble( Number::doubleValue )
109 .skip( l_datasize + 1 )
110 .map(
ITerm::<Number>raw )
111 .mapToDouble( Number::doubleValue )
141 return EType.valueOf( p_value.trim().toUpperCase( Locale.ROOT ) );
151 public final UnivariateFunction
get(
final double[] p_xvalues,
final double[] p_yvalues )
156 return new AkimaSplineInterpolator().interpolate( p_xvalues, p_yvalues );
158 case DIVIDEDDIFFERENCE:
159 return new DividedDifferenceInterpolator().interpolate( p_xvalues, p_yvalues );
162 return new LinearInterpolator().interpolate( p_xvalues, p_yvalues );
165 return new LoessInterpolator().interpolate( p_xvalues, p_yvalues );
168 return new NevilleInterpolator().interpolate( p_xvalues, p_yvalues );
base class of build-in actions for setting name by package/classname (without prefix character) ...
static< N > IFuzzyValue< N > from( @Nonnull final N p_value)
factory
common structure for execution definition
static< T > String languagestring(final T p_source, final String p_label, final Object... p_parameter)
returns the language depend string on any object
final IFuzzyValue< Boolean > execute(final boolean p_parallel, @Nonnull final IContext p_context, @Nonnull final List< ITerm > p_argument, @Nonnull final List< ITerm > p_return)
defines a plan-body operation
execution context with local data
static Stream< ITerm > flatten( @Nonnull final Collection<? extends ITerm > p_terms)
flat term-in-term collection into a straight term list
enum type of interpolating definitions
action to create a spline interpolation.
result for an immutable fuzzy value
final int minimalArgumentNumber()
minimum number of arguments
static EType from(final String p_value)
additional factory
static< N > CRawTerm< N > from(final N p_value)
factory for a raw term
class for any helper calls
static final long serialVersionUID
serial id
term structure for simple datatypes