Class TensorSupport<V>

  • Type Parameters:
    V - the type of the elements of the tensor(ic)
    All Implemented Interfaces:
    BasicOperationSupport<V>

    public class TensorSupport<V>
    extends ScalarIterableSupport<V>
    Extends the usage of fields by operations defined on tensors
    • Constructor Detail

      • TensorSupport

        public TensorSupport​(Environment<V> environment)
    • Method Detail

      • calculate

        public final <C> OngoingTensorOperation<C,​V> calculate​(Tensor<V> tensoric)
        Allows to perform calculation on given tensoric.
        Parameters:
        tensoric - to calculate with.
        Returns:
        expression to calculate.
      • zeros

        public Tensor<V> zeros​(Shape shape)
        returns a ZERO value Tensor for given Shape.
        Parameters:
        shape - to use.
        Returns:
        a Tensor of given Shape filled with 0.0;
      • ones

        public Tensor<V> ones​(Shape shape)
        returns a IDENTITY value Tensor for given Shape.
        Parameters:
        shape - to use.
        Returns:
        a Tensor of given Shape filled with field identities;
      • elementInverseOf

        public Tensor<V> elementInverseOf​(Tensor<V> tensor)
        Parameters:
        tensor - to use.s
        Returns:
        a Tensor with field inverse values
      • negativeOf

        public Tensor<V> negativeOf​(Tensor<V> tensor)
        Parameters:
        tensor - to use
        Returns:
        a Tensor of negative values
      • resample

        public OngoingFieldAwareResamplingStart<V> resample​(Tensor<V> tensor)
        Starting clause for a fluent expression to resample a tensor, using structural resamplings (e.g. repeating), but also field aware resamplings (e.g. linear interpolation). For example:
         
         Tensoric<Double> resampled = resample(aDoubleTensor)
                                   .repeat(String.class)
                                   .then().linear(Integer.class, Integer::doubleValue)
                                   .toTensoric();
         
         
        Note: The order of the options is important, as the resampling will be performed in the given order!

        For options which do not require a field, see the version in TensorStructurals.resample(Tensor).

        Parameters:
        tensor - the tensor to be resampled
        Returns:
        an object to define further the strategy for resampling.