-
-
Notifications
You must be signed in to change notification settings - Fork 14
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
Should UpperTriangular and LowerTriangular really be separate types? #268
Comments
Right now my preferred solution is to remove the upper/lower argument to |
We can still have your point 3 if instead of calling it immutable SpecialMatrix{T, A<:AbstractMatrix} <: AbstractMatrix{T}
shape::Symbol # :U, :L, or :F (for full)
data::A
end So sometimes a That said, I think I like your plan of removing the upper/lower argument. |
JuliaLang/julia#8240 would also be closed under arithmetic, and could maybe even still use the lapack triangular routines for the bandwidth = entire dimension cases by offsetting lda by 1. The |
A year ago I might have agreed without hesitation, but now I'm less sure, particularly in situations like this one. Consider: checking a single flag is Probably the best fix would be to have the compiler better at handling type-unstable code, and most likely it's best to see if we can hold out for this. A workaround might be a set of tools for making manual dispatch a little less awful. I haven't even begun to think what that might look like. |
I agree in general that we should consider using flags instead of creating more types, but in this case I think that would be problematic when it comes to type stability. The reason is that If we would subsume both types into a single |
Another possibility of we get |
@timholy With JuliaLang/julia#13680 merged, can we close this one or do you still think we need to consider this? |
Currently we have two types,
UpperTriangular
andLowerTriangular
. (Internally, there are alsoUnitUpperTriangular
andUnitLowerTriangular
, but let's ignore these for now.) The existence of these two types means thatcholfact(A, :U)
cannot be type-stable. We have theVal
mechanism, but that seems to be agreed to be a little ugly.Is there really a justification for these being two separate types?
Results:
With these performance numbers, I'm skeptical that we need these to be separate types. If there were just a boolean flag, we could have
cholfact(A, :U)
be type-stable.The text was updated successfully, but these errors were encountered: