pub fn kron<T>(
a: ArrayView<'_, T, Ix2>,
b: ArrayView<'_, T, Ix2>,
) -> Array<T, Ix2>
Expand description
Compute the Kronecker product of two 2D arrays
§Arguments
a
- First input arrayb
- Second input array
§Returns
The Kronecker product of the input arrays
§Examples
use ndarray::array;
use scirs2_core::ndarray_ext::matrix::kron;
let a = array![[1, 2], [3, 4]];
let b = array![[0, 5], [6, 7]];
let result = kron(a.view(), b.view());
assert_eq!(result.shape(), &[4, 4]);
assert_eq!(result, array![
[0, 5, 0, 10],
[6, 7, 12, 14],
[0, 15, 0, 20],
[18, 21, 24, 28]
]);