24 package org.lightjason.agentspeak.action.builtin.math.blas.matrix;
26 import cern.colt.matrix.tdouble.DoubleMatrix1D;
27 import cern.colt.matrix.tdouble.DoubleMatrix2D;
28 import cern.colt.matrix.tdouble.impl.DenseDoubleMatrix1D;
29 import cern.colt.matrix.tdouble.impl.SparseDoubleMatrix1D;
39 import javax.annotation.Nonnegative;
40 import javax.annotation.Nonnull;
41 import java.util.List;
42 import java.util.stream.IntStream;
73 @Nonnull
final List<ITerm> p_argument, @Nonnull
final List<ITerm> p_return )
79 .map(
ITerm::<String>raw )
85 .map(
ITerm::<DoubleMatrix2D>raw )
86 .map( i -> IntStream.range( 0, i.rows() ).boxed().map( i::viewRow ).mapToDouble( DoubleMatrix1D::zSum ).toArray() )
89 .forEach( p_return::add );
102 private static DoubleMatrix1D
generate( @Nonnull
final double[] p_value, @Nonnull
final EType p_type )
106 case SPARSE:
return new SparseDoubleMatrix1D( p_value );
107 default :
return new DenseDoubleMatrix1D( p_value );
static< N > IFuzzyValue< N > from( @Nonnull final N p_value)
factory
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
common structure for execution definition
static final long serialVersionUID
serial id
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
returns the row-sum of a matrix.
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
static EType from(final String p_name)
additional factory
static< N > CRawTerm< N > from(final N p_value)
factory for a raw term
blas algebra operations e.g.
final int minimalArgumentNumber()
minimum number of arguments
static DoubleMatrix1D generate( @Nonnull final double[] p_value, @Nonnull final EType p_type)
generates a vector
term structure for simple datatypes