Message Boards Message Boards

0
|
1369 Views
|
1 Reply
|
2 Total Likes
View groups...
Share
Share this post:

Find transformations for two non-square matrices $A$ and $B$

Posted 1 year ago

I noticed the following question here:

enter image description here

In[1]:= A = {{0, c, b, -c + b c, a c, -a + a b, c + b c, a c, 
   a + a b}, {0, c, b, c + b c, a c, a + a b, -c + b c, 
   a c, -a + a b}, {0, -1, 0, b, a, 0, b, a, 0}}

B = {{0, c, b, 0, c, b, 0, -1, 0}, {-c + b c, a c, -a + a b, c + b c, 
    a c, a + a b, b, a, 0}, {c + b c, a c, a + a b, -c + b c, 
    a c, -a + a b, b, a, 0}};

Out[1]= {{0, c, b, -c + b c, a c, -a + a b, c + b c, a c, 
  a + a b}, {0, c, b, c + b c, a c, a + a b, -c + b c, 
  a c, -a + a b}, {0, -1, 0, b, a, 0, b, a, 0}}

I also noticed the example code given on the same website as follows, which does not seem to be the solution to this problem and is very lengthy:

In[15]:= Rx = RotationMatrix[\[Phi][t], {1, 0, 0}];

Ry = RotationMatrix[\[Xi][t], {0, 1, 0}];

Rz = RotationMatrix[\[Psi][t], {0, 0, 1}];

Q = Rz . Ry . Rx;

v = {\[Phi][t], \[Xi][t], \[Psi][t]};

T1 = Flatten /@ D[Q, {v}];

T2 = Flatten /@ D[Transpose[Q], {v}];

P1 = {{1, 0, 0, 0, 0, 0, 0, 0, 0}, {0, 0, 0, 1, 0, 0, 0, 0, 0}, {0, 0,
     0, 0, 0, 0, 1, 0, 0}, {0, 1, 0, 0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 
    1, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0, 0, 1, 0}, {0, 0, 1, 0, 0, 0, 0,
     0, 0}, {0, 0, 0, 0, 0, 1, 0, 0, 0}, {0, 0, 0, 0, 0, 0, 0, 0, 1}};

A1 = T1 . {{1, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 1, 0}, {0, 0, 0}, {0, 
     0, 0}, {0, 0, 1}, {0, 0, 0}, {0, 0, 0}};

A2 = T1 . {{0, 0, 0}, {1, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 1, 0}, {0, 
     0, 0}, {0, 0, 0}, {0, 0, 1}, {0, 0, 0}};

A3 = T1 . {{0, 0, 0}, {0, 0, 0}, {1, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 
     1, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 1}};

Transpose[P1 . ArrayFlatten[{{A1}, {A2}, {A3}}]] == 
  Flatten /@ D[Transpose[Q], {v}] // MatrixForm

Out[26]//MatrixForm= \!\(
TagBox["True",
Function[BoxForm`e$, 
MatrixForm[BoxForm`e$]]]\)

Is there a neat solution to this problem?

Regards, Zhao

POSTED BY: Hongyi Zhao

You could try:

transform[a_] :=  Map[Flatten] @* Transpose @*  Map[p |-> Partition[p, Dimensions[a][[1]]]]@a

Though, for larger matrices it wouldn't perform well. For starters, the composite @* operator is not too fast nor does invoking Dimensions for each row contribute to a quick solution. These concerns can easily be addressed by rewriting it as a module:

transform2[a_] := Module[{r = Dimensions[a][[1]]},
  Map[Flatten, Transpose[Map[Partition[#, r]&, a]]]]
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract