-
Notifications
You must be signed in to change notification settings - Fork 152
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
Use LinearAlgebra.Diagonal instead of defining SDiagonal type #533
Conversation
Fixes JuliaArrays#531. I've kept SDiagonal as a type alias for compatibility.
61e1234
to
669b0a4
Compare
src/SDiagonal.jl
Outdated
*(A::StaticMatrix, D::SDiagonal) = scalem(A,D.diag) | ||
*(D::SDiagonal, A::StaticMatrix) = scalem(D.diag,A) | ||
# define specific methods to avoid allocating mutable arrays | ||
*(A::StaticMatrix, D::SDiagonal) = A .* D.diag' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would be good to time this against scalem
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm, it does seem to be about 10x slower for a 4x4 matrix. I wonder why it's so much slower?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ah, I forgot to use $
interpolation. They're more or less the same.
Thank you. I find it surprising that nothing is lost if a static array object is not inheriting into |
I'm not sure I understand what you mean. This is just using the broadcasting of static arrays |
I think the point is that previously I'm not sure which is best to be quite honest. One clear advantage of this PR is that we get to delete a bunch of code. |
Ah, I see. I personally think it makes sense to use If you need a way to determine if the underlying structure is a There is probably still room to improve |
Yes, I agree we can't have both, and that traits are a way out. I do think the changes here are probably a good idea, I'm just not using |
@mschauer it looks like you contributed |
Fundamentally, users should be able to wrap To my mind, we should see if we can support the "trait" of static-sizedness directly through |
@andyferris you're right. I think we postponed this in the past (v0.5??) because the compiler couldn't deal with it. But the compiler has improved hugely since then. |
Fixes #531. I've kept SDiagonal as a type alias for compatibility.