suppose I have a matrix like this:
a =
1 2
3 4
I want to double the size of matrix and create something like this:
aa =
1 1 2 2
1 1 2 2
3 3 4 4
3 3 4 4
in this way, each element in the first matrix propagates to four elements in the bigger matrix.
a(i,j) == aa(2*i-1, 2*j-1)
== aa(2*i , 2*j-1)
== aa(2*i-1, 2*j)
== aa(2*i , 2*j)
is there any predefined functions to do that?
definitely I can do that by two loops, but I want the easiest and cleanest way!
use
kron
- Kronecker tensor product: