24 package org.lightjason.agentspeak.action.builtin.math.blas;
26 import cern.colt.function.tdouble.DoubleDoubleFunction;
27 import cern.colt.matrix.tdouble.DoubleMatrix1D;
28 import cern.colt.matrix.tdouble.DoubleMatrix2D;
29 import cern.jet.math.tdouble.DoubleFunctions;
30 import com.codepoetics.protonpack.StreamUtils;
39 import javax.annotation.Nonnegative;
40 import javax.annotation.Nonnull;
41 import java.util.List;
42 import java.util.function.BiFunction;
79 @Nonnull
final List<ITerm> p_argument, @Nonnull
final List<ITerm> p_return )
89 switch ( i.get( 1 ).<String>raw().trim() )
92 return CElementWise.
apply( i.get( 0 ), i.get( 2 ), DoubleFunctions.plus, ( n, m ) -> n + m, p_return );
95 return CElementWise.
apply( i.get( 0 ), i.get( 2 ), DoubleFunctions.plusAbs, ( n, m ) -> Math.abs( n + m ), p_return );
98 return CElementWise.
apply( i.get( 0 ), i.get( 2 ), DoubleFunctions.minus, ( n, m ) -> n - m, p_return );
101 return CElementWise.
apply( i.get( 0 ), i.get( 2 ), DoubleFunctions.mult, ( n, m ) -> n * m, p_return );
104 return CElementWise.
apply( i.get( 0 ), i.get( 2 ), DoubleFunctions.div, ( n, m ) -> n / m, p_return );
129 final DoubleDoubleFunction p_matrixfunction,
final BiFunction<Double, Double, Double> p_scalarfunction,
130 final List<ITerm> p_return )
135 final DoubleMatrix2D l_assign = p_left.<DoubleMatrix2D>raw().copy();
139 l_assign.assign( p_right.<DoubleMatrix2D>raw(), p_matrixfunction );
146 l_assign.assign( i -> p_scalarfunction.apply( i, p_right.<Number>raw().doubleValue() ) );
155 final DoubleMatrix1D l_assign = p_left.<DoubleMatrix1D>raw().copy();
159 l_assign.assign( p_right.<DoubleMatrix1D>raw(), p_matrixfunction );
166 l_assign.assign( i -> p_scalarfunction.apply( i, p_right.<Number>raw().doubleValue() ) );
base class of build-in actions for setting name by package/classname (without prefix character) ...
static boolean apply(final ITerm p_left, final ITerm p_right, final DoubleDoubleFunction p_matrixfunction, final BiFunction< Double, Double, Double > p_scalarfunction, final List< ITerm > p_return)
elementwise assign
static< N > IFuzzyValue< N > from( @Nonnull final N p_value)
factory
common structure for execution definition
final int minimalArgumentNumber()
minimum number of arguments
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
static final long serialVersionUID
serial id
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
static< T > boolean rawvalueAssignableTo( @Nonnull final T p_value, @Nonnull final Class<?>... p_class)
checks a term value for assignable class
result for an immutable fuzzy value
elementweise vector / matrix operation.
static< N > CRawTerm< N > from(final N p_value)
factory for a raw term
term structure for simple datatypes