开发者

how to generate the "exchange" map a.k.a. "swap" map

I am looking for an easy way to generate a simple linear map in Octave. The matrix I need, call it sigma(n), is defined by the following property: for all matrices A and B (both of dimension n) we have the equation:

sigma(n) * kron(A,B) = kron(B,A) * sigma开发者_JAVA技巧(n)

For example,

sigma(2) = [1,0,0,0; 0,0,1,0; 0,1,0,0; 0,0,0,1].

Is there a simple function for sigma(n)?

For my purposes n will be fairly small, less than 50, so efficiency is not a concern.

EDIT: now with the correct defining equation


I realise it's bad form to answer one's own question, but with a small amount of head scratching I managed to generate the matrix explicitly:

function sig = sigma_(n) 
  sig = zeros(n^2,n^2);
  for i = 0:(n-1)
    for j = 0:(n-1)
      sig(i*n + j + 1, i+ (j*n) + 1) = 1;
    endfor
  endfor
endfunction

If anyone has a neater way to do this, I'm still interested.


Interesting question!

I don't think that what you are asking is exactly possible. However, the two kronecker products are similar, via a permutation matrix, i.e., one has:

kron(A,B) = P kron(B,A) P^{-1}

This permutation matrix is such that the value of Px is obtained by putting x in a matrix row by row, and stacking the columns of that resulting matrix together.

Edit A proof that you are asking is not possible. Consider the matrices

A = 1 1       B = 1 0
    1 1           0 0

Then the two kronecker products are:

1 1 0 0      1 0 1 0
1 1 0 0      0 0 0 0
0 0 0 0      1 0 1 0
0 0 0 0      0 0 0 0

Suppose you multiply the first matrix on the left by any matrix sigma: the last two columns will stay at zero, so the result cannot be equal to the second matrix. QED.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜