Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

genericMatrix should be row major #3596

Open
mahrud opened this issue Nov 27, 2024 · 5 comments
Open

genericMatrix should be row major #3596

mahrud opened this issue Nov 27, 2024 · 5 comments

Comments

@mahrud
Copy link
Member

mahrud commented Nov 27, 2024

It was pointed out during the workshop that the output of genericMatrix should be row major instead of column major because this makes no sense:

i1 : R = QQ[x_(1,1) .. x_(2,5)];

i2 : genericMatrix(R, 2, 5)

o2 = | x_(1,1) x_(1,3) x_(1,5) x_(2,2) x_(2,4) |
     | x_(1,2) x_(1,4) x_(2,1) x_(2,3) x_(2,5) |

             2      5
o2 : Matrix R  <-- R
@d-torrance
Copy link
Member

This was bugging me the other day, too. I wonder how much code it would break if we changed it? For example, permanents fixes the problem by doing this:

M1:= transpose genericMatrix(R1,xxX_(1,1),c,r);

@mahrud
Copy link
Member Author

mahrud commented Nov 27, 2024

I personally think it's a change worth trying, and if we find that it breaks way too many things we can just add genericMatrix' which does the transpose.

@mikestillman
Copy link
Member

I agree that the proposed way is better, but I'm afraid it will break alot of code. Not code in the system so much, but in particular, for personal code of mine for different projects of mine.

@pzinn
Copy link
Contributor

pzinn commented Nov 27, 2024

I remember this as being one of the first things that annoyed me when I started using M2 twenty years ago. And adding transpose is not great because the degree shift becomes visible

i2 : transpose genericMatrix(QQ[m_(1,1)..m_(2,2)],2,2)

o2 = {-1} | m_(1,1) m_(1,2) |
     {-1} | m_(2,1) m_(2,2) |

                            2                     2
o2 : Matrix (QQ[m   ..m   ])  <-- (QQ[m   ..m   ])
                 1,1   2,2             1,1   2,2

@mahrud
Copy link
Member Author

mahrud commented Nov 27, 2024

This is also bad:

i4 : R = QQ[x_(1,1)..x_(2,3)];

i5 : reshape(R^2, R^3, vars R)

o5 = | x_(1,1) x_(1,3) x_(2,2) |
     | x_(1,2) x_(2,1) x_(2,3) |

             2      3
o5 : Matrix R  <-- R

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants