mlx.core.kron

Contents

mlx.core.kron#

kron(a: array, b: array, *, stream: None | Stream | Device = None) array#

Compute the Kronecker product of two arrays a and b.

Parameters:
  • a (array) – The first input array.

  • b (array) – The second input array.

  • stream (Union[None, Stream, Device], optional) – Optional stream or device for execution. Default: None.

Returns:

The Kronecker product of a and b.

Return type:

array

Examples

>>> a = mx.array([[1, 2], [3, 4]])
>>> b = mx.array([[0, 5], [6, 7]])
>>> result = mx.kron(a, b)
>>> print(result)
array([[0, 5, 0, 10],
       [6, 7, 12, 14],
       [0, 15, 0, 20],
       [18, 21, 24, 28]], dtype=int32)