braintools.spike.bitwise_iand

Contents

braintools.spike.bitwise_iand#

braintools.spike.bitwise_iand(x, y)#

Perform a bitwise IAND (Inverse AND) operation on spike tensors.

This function computes the Inverse AND (IAND) operation between two spike tensors. IAND is defined as (NOT x) AND y.

Parameters:
  • x (Array | ndarray | bool | number | bool | int | float | complex | Quantity) – The first input spike tensor (the negated operand).

  • y (Array | ndarray | bool | number | bool | int | float | complex | Quantity) – The second input spike tensor.

Returns:

The element-wise IAND of the inputs, with their broadcast shape.

Return type:

Array | ndarray | bool | number | bool | int | float | complex | Quantity

See also

bitwise

Dispatch to a bitwise operation by name.

bitwise_and, bitwise_not

Notes

This operation is implemented using the formula (1 - x) * y, which is equivalent to the IAND operation for binary values. Boolean inputs give a boolean result (computed with the logical functions); numeric inputs use the arithmetic formula, which keeps the dtype and stays differentiable for surrogate-gradient spikes.

Examples

>>> import jax.numpy as jnp
>>> import braintools
>>> x = jnp.array([0, 0, 1, 1])
>>> y = jnp.array([0, 1, 0, 1])
>>> braintools.spike.bitwise_iand(x, y)
Array([0, 1, 0, 0], dtype=int32)