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

Question: Utility of DiagonalMatrix struct #453

Open
derekdreery opened this issue Apr 22, 2018 · 2 comments
Open

Question: Utility of DiagonalMatrix struct #453

derekdreery opened this issue Apr 22, 2018 · 2 comments

Comments

@derekdreery
Copy link

Multiplying by a diagonal matrix is faster than a general matrix, because it is equivalent to scaling rows if mat * diag, or columns if diag * mat. Should there be a DiagonalMatrix stored as a vector that implements matrix mult like this to be faster?

An application, for example, is scaling in a rotation/scale/translation transformation.

@derekdreery
Copy link
Author

An alternative is some method on a matrix that takes a vector and applies it in this way.

@brendanzab
Copy link
Collaborator

Yeah, originally I was thinking this would be a nice optimization! I don't currently do it though. It's also a handy invariant to know in some cases, but again, I haven't taken advantage of it. Lots of unfinished business on cgmath - if you want to chat further I'm on Gitter!

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

2 participants