Class ShortDenseNdArray

    • Method Detail

      • getShort

        public short getShort​(long... indices)
        Description copied from interface: ShortNdArray
        Returns the short value of the scalar found at the given coordinates.

        To access the scalar element, the number of coordinates provided must be equal to the number of dimensions of this array (i.e. its rank). For example:

        
          ShortNdArray matrix = NdArrays.ofShorts(shape(2, 2));  // matrix rank = 2
          matrix.getShort(0, 1);  // succeeds, returns 0.0f
          matrix.getShort(0);  // throws IllegalRankException
        
          ShortNdArray scalar = matrix.get(0, 1);  // scalar rank = 0
          scalar.getShort();  // succeeds, returns 0.0f
         
        Specified by:
        getShort in interface ShortNdArray
        Parameters:
        indices - coordinates of the scalar to resolve
        Returns:
        value of that scalar
      • setShort

        public ShortNdArray setShort​(short value,
                                     long... indices)
        Description copied from interface: ShortNdArray
        Assigns the short value of the scalar found at the given coordinates.

        To access the scalar element, the number of coordinates provided must be equal to the number of dimensions of this array (i.e. its rank). For example:

        
          ShortNdArray matrix = NdArrays.ofShorts(shape(2, 2));  // matrix rank = 2
          matrix.setShort(10.0f, 0, 1);  // succeeds
          matrix.setShort(10.0f, 0);  // throws IllegalRankException
        
          ShortNdArray scalar = matrix.get(0, 1);  // scalar rank = 0
          scalar.setShort(10.0f);  // succeeds
         
        Specified by:
        setShort in interface ShortNdArray
        Parameters:
        value - value to assign
        indices - coordinates of the scalar to assign
        Returns:
        this array
      • copyTo

        public ShortNdArray copyTo​(NdArray<Short> dst)
        Description copied from interface: NdArray
        Copy the content of this array to the destination array.

        The Shaped.shape() of the destination array must be equal to the shape of this array, or an exception is thrown. After the copy, the content of both arrays can be altered independently, without affecting each other.

        Specified by:
        copyTo in interface NdArray<Short>
        Specified by:
        copyTo in interface ShortNdArray
        Parameters:
        dst - array to receive a copy of the content of this array
        Returns:
        this array