pub fn kron<T, La, Lb>(
a: &DSlice<T, 2, La>,
b: &DSlice<T, 2, Lb>,
) -> DTensor<T, 2>Expand description
Computes the Kronecker product of two 2D tensors.
The Kronecker product of matrices A (m×n) and B (p×q) is defined as the
block matrix of size (m*p) × (n*q) where each element a[i, j] of A
multiplies the entire matrix B.
§Examples
use mdarray::tensor;
use mdarray_linalg::kron;
let a = tensor![[1., 2.],
[3., 4.]];
let b = tensor![[0., 5.],
[6., 7.]];
let k = kron(&a, &b);
assert_eq!(k, tensor![
[ 0., 5., 0., 10.],
[ 6., 7., 12., 14.],
[ 0., 15., 0., 20.],
[18., 21., 24., 28.]
]);