ekmett / linear

Low-dimensional linear algebra primitives for Haskell.
http://hackage.haskell.org/package/linear
Other
201 stars 50 forks source link

Matrices stored in column-major format? #94

Open alang9 opened 9 years ago

ocharles commented 9 years ago

What exactly is the question here? If you're sending matrices to OpenGL there are flags to convert on the fly. If you need column major somewhere else - where exactly do you need it? Manually specifying matrices? Loading from files?

On Fri, 6 Nov 2015 5:51 pm Alex Lang notifications@github.com wrote:

— Reply to this email directly or view it on GitHub https://github.com/ekmett/linear/issues/94.

alang9 commented 9 years ago

I'm thinking of what to do if you want to perform matrix multiplication using BLAS' dgemm.

ekmett commented 5 years ago

Thinking outloud here.

Right now, dgemm, etc. are all going to require us to marshal to an external format regardless unless we do something like #152 to allow us to have a better backing store, at which point we're a bit outside of the current scope of this library.

I do wind up transposing when I marshal to OpenGL in, say, Glow.Block, but I was going to have to copy there regardless.

dpwiz commented 3 years ago

Matrices stored row-major (vector of rows), but transformations and projections defined in column-major notation and require transposing. This is so confusing...

Rewriting them in row-major will be a major breaking change, but maybe the gains in clarity are worth it.

ekmett commented 3 years ago

It really depends on what order you tend to do your matrix multiplications. e.g. Working with OpenGL vs. Direct3d flips which you'd prefer, left to right vector matrix vs. right to left matrix vector.

No matter what I pick, half the community is upset, so I went with the one I needed at the time.

-Edward

On Fri, Dec 25, 2020 at 12:49 PM Alexander Bondarenko < notifications@github.com> wrote:

Matrices stored row-major (vector of rows), but transformations and projections defined in column-major notation and require transposing. This is so confusing...

Rewriting them in row-major will be a major breaking change, but maybe the gains in clarity are worth it.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/ekmett/linear/issues/94#issuecomment-751289772, or unsubscribe https://github.com/notifications/unsubscribe-auth/AACKMEKIM6AFXRG36FCRQBDSWT3GRANCNFSM4BTWNWSQ .

dpwiz commented 3 years ago

Oh.. That kinda makes sense. M44 stated as row-major, so you'd have to transpose and the transformations are written to be transposed :exploding_head: