RE: Kronecker product of matrices
- To: mathgroup at smc.vnet.net
- Subject: [mg18502] RE: [mg18429] Kronecker product of matrices
- From: "Ersek, Ted R" <ErsekTR at navair.navy.mil>
- Date: Wed, 7 Jul 1999 23:08:53 -0400
- Sender: owner-wri-mathgroup at wolfram.com
Kostas Oikonomou wrote:
------------------------
Is there a simple way to make Outer[Times,A,B] produce the Kronecker
product of A and B? What I mean is that if A is nxn and B mxm, Outer
produces a block form, instead of a plain (mn)x(mn) matrix.
-------------------------
The concept of KroneckerProduct was used in a course I took on Kalman
Filtes. In that course it was defined as follows:
Given matrices A and B
KroneckerProduct[A,B] is the tensor
produced by multiplying each element
of (A) by the matrix (B).
If this is the definition you need the oneliner below will do it. I don't
see how it can be done with Outer.
In[1]:=
KroneckerProduct[a_?MatrixQ,b_?MatrixQ]:=Map[# b&, a, {-1}]
Now for a small example.
----------------------------
In[2]:=
a={{a11,a12},{a21,a22}};
b={{b11,b12},{b21,b22}};
In[4]:=
KroneckerProduct[a,b]
Out[4]=
{{
{{a11 b11,a11 b12},{a11 b21,a11 b22}},
{{a12 b11,a12 b12},{a12 b21,a12 b22}}},
{{{a21 b11,a21 b12},{a21 b21,a21 b22}},
{{a22 b11,a22 b12},{a22 b21,a22 b22}}
}}
-------------
Regards,
Ted Ersek