24 package org.lightjason.agentspeak.action.builtin.math.blas.vector;
26 import cern.colt.matrix.tdouble.DoubleMatrix1D;
27 import com.codepoetics.protonpack.StreamUtils;
36 import javax.annotation.Nonnegative;
37 import javax.annotation.Nonnull;
38 import java.util.List;
39 import java.util.stream.Collectors;
76 @Nonnull
final List<ITerm> p_argument, @Nonnull
final List<ITerm> p_return )
78 final List<DoubleMatrix1D> l_arguments =
CCommon.
flatten( p_argument ).map(
ITerm::<DoubleMatrix1D>raw ).collect( Collectors.toList() );
79 if ( l_arguments.size() % 2 == 1 )
82 StreamUtils.windowed( l_arguments.stream(), 2 )
83 .map( i -> i.get( 0 ).zDotProduct( i.get( 1 ) ) )
85 .forEach( p_return::add );
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
final int minimalArgumentNumber()
minimum number of arguments
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
static final long serialVersionUID
serial id
result for an immutable fuzzy value
static< N > CRawTerm< N > from(final N p_value)
factory for a raw term
returns dot-product of vectors.
term structure for simple datatypes