24 package org.lightjason.agentspeak.action.builtin.math.bit.vector;
26 import cern.colt.matrix.tbit.BitVector;
27 import cern.colt.matrix.tdouble.impl.DenseDoubleMatrix1D;
28 import cern.colt.matrix.tdouble.impl.SparseDoubleMatrix1D;
38 import javax.annotation.Nonnegative;
39 import javax.annotation.Nonnull;
40 import java.util.List;
41 import java.util.stream.Collectors;
42 import java.util.stream.IntStream;
79 @Nonnull
final List<ITerm> p_argument, @Nonnull
final List<ITerm> p_return )
81 final List<ITerm> l_arguments =
CCommon.
flatten( p_argument ).collect( Collectors.toList() );
82 final EType l_type = l_arguments.parallelStream()
84 .findFirst().map( i ->
EType.
from( i.<String>raw() ) )
92 .map(
ITerm::<BitVector>raw )
93 .map( i -> IntStream.range( 0, i.size() ).boxed().mapToDouble( j -> i.getQuick( j ) ? 1 : 0 ).toArray() )
94 .map( DenseDoubleMatrix1D::new )
96 .forEach( p_return::add );
104 .map(
ITerm::<BitVector>raw )
105 .map( i -> IntStream.range( 0, i.size() ).boxed().mapToDouble( j -> i.getQuick( j ) ? 1 : 0 ).toArray() )
106 .map( SparseDoubleMatrix1D::new )
108 .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
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< 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
converts the bit vector to a blas vector.
static< N > CRawTerm< N > from(final N p_value)
factory for a raw term
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
term structure for simple datatypes