Documentation of 'cc.redberry.core.tensor.Tensor' Java class
Tensor
cc.redberry.core.tensor

Class Tensor

    • Constructor Detail

      • Tensor

        public Tensor()
    • Method Detail

      • getIndices

        public abstract Indices getIndices()
        Returns indices of this tensor.
        Returns:
        indices of this tensor
      • iterator

        public java.util.Iterator<Tensor> iterator()
        Return read-only iterator over tensor elements.
        Specified by:
        iterator in interface java.lang.Iterable<Tensor>
        Returns:
        read-only iterator over tensor elements
      • get

        public abstract Tensor get(int i)
        Returns element at i-th position.
        Parameters:
        i - position
        Returns:
        element at i-th position
        Throws:
        java.lang.IndexOutOfBoundsException - if i < 0 or i >= size()
      • size

        public abstract int size()
        Returns the number of elements in this tensor.
        Returns:
        the number of elements in this tensor
      • set

        public Tensor set(int i,
                          Tensor tensor)
        Returns new tensor instance with i-th sub-tensor replaced by provided tensor.
        Parameters:
        i - index of sub-tensor to be replaced
        tensor - tensor to replace i-th sub-tensor
        Returns:
        new instance of tensor
      • getRange

        public Tensor[] getRange(int from,
                                 int to)
        Retrieves several sub-tensors from current tensor. This function is faster than sequential invocations of get(int) method.
        Parameters:
        from - index of first sub-tensor to be retrieved (inclusive)
        to - next index after last sub-tensor to be retrieved (exclusive)
        Returns:
        array with retrieved tensors
      • toArray

        public Tensor[] toArray()
      • toString

        public abstract java.lang.String toString(OutputFormat outputFormat)
        Returns a string representation of a tensor according to the specified OutputFormat.
        Parameters:
        outputFormat - output format
        Returns:
        a string representation of a tensor
      • toString

        public final java.lang.String toString()
        Returns a string representation of a tensor according to the default OutputFormat defined in CC.getDefaultOutputFormat().
        Overrides:
        toString in class java.lang.Object
        Returns:
        a string representation of a tensor
      • compareTo

        public final int compareTo(Tensor t)
        Compares tensors by their hash codes.
        Specified by:
        compareTo in interface java.lang.Comparable<Tensor>
        Parameters:
        t - tensor
        Returns:
        0 if hashes are equals, 1 if hash code of this greater the hash code of specified tensor and -1 otherwise
      • hashCode

        public final int hashCode()
        Overrides:
        hashCode in class java.lang.Object
      • getBuilder

        public abstract TensorBuilder getBuilder()
        Creates a builder for this tensor. See TensorBuilder for more information.
        Returns:
        builder for this tensor
      • getFactory

        public abstract TensorFactory getFactory()
        Returns a factory for this tensor. See TensorFactory for more information.
        Returns:
        builder for this tensor

DataMelt 3.0 © DataMelt by jWork.ORG

Ads help maintain this website.