Class FloatDenseNdArray

    • Method Detail

      • getFloat

        public float getFloat​(long... indices)
        Description copied from interface: FloatNdArray
        Returns the float 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:

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

        public FloatNdArray setFloat​(float value,
                                     long... indices)
        Description copied from interface: FloatNdArray
        Assigns the float 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:

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

        public FloatNdArray copyTo​(NdArray<Float> 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 FloatNdArray
        Specified by:
        copyTo in interface NdArray<Float>
        Parameters:
        dst - array to receive a copy of the content of this array
        Returns:
        this array