Re: RE: Kronecker product of matrices
- To: mathgroup at smc.vnet.net
- Subject: [mg21406] Re: [mg18502] RE: [mg18429] Kronecker product of matrices
- From: Gianluca Gorni <gorni at dimi.uniud.it>
- Date: Tue, 4 Jan 2000 02:12:37 -0500 (EST)
- 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. > > ------------------------- If you need the Kronecker product as an (mn)x(mn) matrix here is a way: kroneckerProduct[a_?MatrixQ, b_?MatrixQ] := Flatten[Map[Flatten[#1, 1] &, Transpose[Outer[Times, a, b], {1, 3, 2}], {2}], 1]; I found the (hopefully) right transposition by trial and error. Another way is to build blocks and then merge them with BlockMatrix[], from the package LinearAlgebra`MatrixManipulation. Good luck, Gianluca Gorni -- +---------------------------------+ | Gianluca Gorni | | Universita` di Udine | | Dipartimento di Matematica | | e Informatica | | via delle Scienze 208 | | I-33100 Udine UD | | Italy | +---------------------------------+ | Ph.: (39) 0432-558422 | | Fax: (39) 0432-558499 | | mailto:gorni at dimi.uniud.it | | http://www.dimi.uniud.it/~gorni | +---------------------------------+