Calculate the Kronecker product of two matrices. More...

Modules

 af_kronProd
 The C interface for Kronecker product.
 

Detailed Description

Calculate the Kronecker product of two matrices.

Compute the Kronecker product of a matrix. This outer product is a block matrix such that if the input matrices are (m by n) and (p by q), then the output matrix is (mp by nq).

float ha[] = {1, 3, 2, 4};
float hb[] = {0, 6, 5, 7};
array a = array(2, 2, ha);
// a = 1 2
// 3 4
array b = array(2, 2, hb);
// b = 0 5
// 6 7
// Create space for the result
array c = array(4, 4, f32);
float* da = a.device<float>();
float* db = b.device<float>();
float* dc = c.device<float>();
af_kronProd_SS(dc, 2, 2, da, 0, 2, 2, db, 0);
print(c);
// c =
// 0.0000 5.0000 0.0000 10.0000
// 6.0000 7.0000 12.0000 14.0000
// 0.0000 15.0000 0.0000 20.0000
// 18.0000 21.0000 24.0000 28.0000