Class ImmutableDoubleArrayBackedTensor

  • All Implemented Interfaces:
    Tensor<java.lang.Double>, Tensoric<java.lang.Double>

    public class ImmutableDoubleArrayBackedTensor
    extends AbstractTensor<java.lang.Double>
    A specific implementation of a tensor, that contains double values. It is backed by a simple double array to minimize memory usage and improve performance.
    • Method Detail

      • get

        public java.lang.Double get​(Position position)
        Parameters:
        position - the position in the N-dimensional space where to find the value.
        Returns:
        the value at the given position
      • get

        public java.lang.Double get​(java.lang.Object... coordinates)
        Parameters:
        coordinates - form N-dimensional space where to find the value.
        Returns:
        a value at the given coordinates.
      • shape

        public Shape shape()
        Description copied from interface: Tensor
        Retrieves the shape of the tensor. As shape we understand simply the structure of a tensor: Its dimensions and the available positions.

        Implementations have to take care that the returned value here is never null.

        Returns:
        the shape of the tensor.
      • context

        public Position context()
        Description copied from interface: Tensor
        Retrieves the context of the tensor, which is nothing else than a position. As context of the tensor we understand coordinates within a higher dimensional space than than the tensor has itself. This coordinates can e.g. transport information when e.g. a higher-dimensional tensor is split into smaller ones, so that it can potentially be reconstructed afterwards.

        Implementations have to guarantee that the returned value here is never null.

        Returns:
        the context of the tensor.
      • contains

        public boolean contains​(Position position)
        Description copied from interface: Tensoric
        Returns true if the tensoric object contains the given position, false otherwise.
        Parameters:
        position - the position to be checked
        Returns:
        true if the position is contained in the tensoric object, false otherwise.