kron#

ivy.kron(a, b, /, *, out=None)[source]#

Compute the Kronecker product, a composite array made of blocks of the second array scaled by the first.

Parameters:
  • a (Union[Array, NativeArray]) – First input array.

  • b (Union[Array, NativeArray]) – Second input array

  • out (Optional[Array], default: None) – optional output array, for writing the result to. It must have a shape that the inputs broadcast to.

Return type:

Array

Returns:

ret – Array representing the Kronecker product of the input arrays.

Examples

>>> a = ivy.array([1,2])
>>> b = ivy.array([3,4])
>>> ivy.kron(a, b)
ivy.array([3, 4, 6, 8])
Array.kron(self, b, /, *, out=None)[source]#

ivy.Array instance method variant of ivy.kron. This method simply wraps the function, and so the docstring for ivy.kron also applies to this method with minimal changes.

Return type:

Array

Examples

>>> a = ivy.array([1,2])
>>> b = ivy.array([3,4])
>>> a.diagflat(b)
ivy.array([3, 4, 6, 8])
Container.kron(self, b, /, *, key_chains=None, to_apply=True, prune_unapplied=False, map_sequences=False, out=None)[source]#

ivy.Container instance method variant of ivy.kron. This method simply wraps the function, and so the docstring for ivy.kron also applies to this method with minimal changes.

Return type:

Container

Examples

>>> a = ivy.Container(x=ivy.array([1,2]), y=ivy.array([50]))
>>> b = ivy.Container(x=ivy.array([3,4]), y=ivy.array(9))
>>> a.kron(b)
{
    a: ivy.array([3, 4, 6, 8])
    b: ivy.array([450])
}