Shift the bits of each element left or right.
Numeric.bit.shift(value, places, right = false)Moves bits left or right by the given count.
- Parameters:
value: Scalar, vector, or matrix values to shiftplaces: Number of bit positions to shiftright: When true shifts bits toward the low end
- Returns: Shifted values matching the input nesting shape
- NumPy: Covers
np.bitwise_left_shift,np.left_shift,np.bitwise_right_shift,np.right_shiftthrough a single Numerix method.
import Numeric from '@neabyte/numerix'
const values = Numeric.bit.shift([1, 2], 1)
console.log(values)
// [2,4]import Numeric from '@neabyte/numerix'
const values = Numeric.bit.shift([4, 2], 1, true)
console.log(values)
// [2,1]import Numeric from '@neabyte/numerix'
const value = Numeric.bit.shift(1, 3)
console.log(value)
// 8import Numeric from '@neabyte/numerix'
const values = Numeric.bit.shift([[1, 2]], [1, 2])
console.log(values)
// [[2,8]]