Tensor product of Matrices
- To: mathgroup at smc.vnet.net
- Subject: [mg128472] Tensor product of Matrices
- From: Sensei <sensei_s_mail_is_at at me.com>
- Date: Tue, 23 Oct 2012 00:56:17 -0400 (EDT)
- Delivered-to: l-mathgroup@mail-archive0.wolfram.com
- Delivered-to: l-mathgroup@wolfram.com
- Delivered-to: mathgroup-newout@smc.vnet.net
- Delivered-to: mathgroup-newsend@smc.vnet.net
Hi everyone!
I've succeeded with your help in implementing a tensor application, but
now I need your help on tensor products, I hope you won't mind!
This is simple: I want to "add" a row and a column to a matrix. This is
easy with a matrix:
A =
{
{1, 0, 0},
{0, 1, 0},
{0, 0, 1},
{0, 0, 0}
};
B =
{
{1, 0, 0, 0},
{0, 1, 0, 0},
{0, 0, 1, 0}
};
M = Partition[Table[i, {i, 1, 9}], 3];
A.M.B
{{1, 2, 3, 0}, {4, 5, 6, 0}, {7, 8, 9, 0}, {0, 0, 0, 0}}
Now how can we do this with a tensor? This is the tensors I'm using:
Id = SparseArray[
Flatten[Table[{i, j, i, j} -> 1, {i, 1, 3}, {j, 1, 3}], 1],
{3, 3, 4, 4}
];
Flatten[Id, {{3}, {4}, {1, 2}}].Flatten[M, {{1, 2}}] // Normal
{{1, 2, 3, 0}, {4, 5, 6, 0}, {7, 8, 9, 0}, {0, 0, 0, 0}}
IIRC, I'm using Id_ijkl M_ij, but Id_ijkl = X_ki Y_jl, where this is the
tensor product.
How can I make this product?
Wherever I search the web, I find references to the Kroneker product,
which isn't what I'm looking for.
Thanks!