Message Boards Message Boards

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

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

Posted 2 years ago
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