Class NDBitwise


  • public class NDBitwise
    extends Object
    • Constructor Detail

      • NDBitwise

        public NDBitwise()
    • Method Detail

      • and

        public INDArray and​(INDArray x,
                            INDArray y)
        Bitwise AND operation. Supports broadcasting.
        Inputs must satisfy the following constraints:
        Must be same types: isSameType(x, y)
        Must have broadcastable shapes: isBroadcastableShapes(x, y)
        Parameters:
        x - First input array (INT type)
        y - Second input array (INT type)
        Returns:
        output Bitwise AND array (INT type)
      • bitRotl

        public INDArray bitRotl​(INDArray x,
                                INDArray shift)
        Roll integer bits to the left, i.e. var << 4 | var >> (32 - 4)
        Parameters:
        x - Input 1 (INT type)
        shift - Number of bits to shift. (INT type)
        Returns:
        output SDVariable with shifted bits (INT type)
      • bitRotr

        public INDArray bitRotr​(INDArray x,
                                INDArray shift)
        Roll integer bits to the right, i.e. var >> 4 | var << (32 - 4)
        Parameters:
        x - Input 1 (INT type)
        shift - Number of bits to shift. (INT type)
        Returns:
        output SDVariable with shifted bits (INT type)
      • bitShift

        public INDArray bitShift​(INDArray x,
                                 INDArray shift)
        Shift integer bits to the left, i.e. var << 4
        Parameters:
        x - Input 1 (INT type)
        shift - Number of bits to shift. (INT type)
        Returns:
        output SDVariable with shifted bits (INT type)
      • bitShiftRight

        public INDArray bitShiftRight​(INDArray x,
                                      INDArray shift)
        Shift integer bits to the right, i.e. var >> 4
        Parameters:
        x - Input 1 (INT type)
        shift - Number of bits to shift. (INT type)
        Returns:
        output SDVariable with shifted bits (INT type)
      • bitsHammingDistance

        public INDArray bitsHammingDistance​(INDArray x,
                                            INDArray y)
        Bitwise Hamming distance reduction over all elements of both input arrays.
        For example, if x=01100000 and y=1010000 then the bitwise Hamming distance is 2 (due to differences at positions 0 and 1)
        Inputs must satisfy the following constraints:
        Must be same types: isSameType(x, y)
        Parameters:
        x - First input array. (INT type)
        y - Second input array. (INT type)
        Returns:
        output bitwise Hamming distance (INT type)
      • leftShift

        public INDArray leftShift​(INDArray x,
                                  INDArray y)
        Bitwise left shift operation. Supports broadcasting.
        Parameters:
        x - Input to be bit shifted (INT type)
        y - Amount to shift elements of x array (INT type)
        Returns:
        output Bitwise shifted input x (INT type)
      • leftShiftCyclic

        public INDArray leftShiftCyclic​(INDArray x,
                                        INDArray y)
        Bitwise left cyclical shift operation. Supports broadcasting.
        Unlike #leftShift(INDArray, INDArray) the bits will "wrap around":
        leftShiftCyclic(01110000, 2) -> 11000001
        Parameters:
        x - Input to be bit shifted (INT type)
        y - Amount to shift elements of x array (INT type)
        Returns:
        output Bitwise cyclic shifted input x (INT type)
      • or

        public INDArray or​(INDArray x,
                           INDArray y)
        Bitwise OR operation. Supports broadcasting.
        Inputs must satisfy the following constraints:
        Must be same types: isSameType(x, y)
        Must have broadcastable shapes: isBroadcastableShapes(x, y)
        Parameters:
        x - First input array (INT type)
        y - First input array (INT type)
        Returns:
        output Bitwise OR array (INT type)
      • rightShift

        public INDArray rightShift​(INDArray x,
                                   INDArray y)
        Bitwise right shift operation. Supports broadcasting.
        Parameters:
        x - Input to be bit shifted (INT type)
        y - Amount to shift elements of x array (INT type)
        Returns:
        output Bitwise shifted input x (INT type)
      • rightShiftCyclic

        public INDArray rightShiftCyclic​(INDArray x,
                                         INDArray y)
        Bitwise right cyclical shift operation. Supports broadcasting.
        Unlike rightShift(INDArray, INDArray) the bits will "wrap around":
        rightShiftCyclic(00001110, 2) -> 10000011
        Parameters:
        x - Input to be bit shifted (INT type)
        y - Amount to shift elements of x array (INT type)
        Returns:
        output Bitwise cyclic shifted input x (INT type)
      • xor

        public INDArray xor​(INDArray x,
                            INDArray y)
        Bitwise XOR operation (exclusive OR). Supports broadcasting.
        Inputs must satisfy the following constraints:
        Must be same types: isSameType(x, y)
        Must have broadcastable shapes: isBroadcastableShapes(x, y)
        Parameters:
        x - First input array (INT type)
        y - First input array (INT type)
        Returns:
        output Bitwise XOR array (INT type)