Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This is a followup on JuliaLang/LinearAlgebra.jl#144. This is a first attempt to make the code in
LinAlg
a bit more type stable. It is very convenient to dispatch on whether a matrix is upper or lower triangular, e.g.Triangular{:U}+Triangular{:U} = Triangular{:U}
butTriangular{:U}+Triangular{:L} = Matrix
. Unfortunately, it makes it them a bit more complicated to construct because the two first parameters are the element matrix types which is inferred from the input matrix whereas the last two determines if the matrix is upper or lower and if it has unit diagonal. The last two are useful to provide as a user, such that a non-triangular matrix can be interpreted as triangular.As a consequence, the present convenience constructor is not type stable, which can cause significant allocation. To solve the problem, I have introduced a parametric type with the only purpose of wrapping the arguments of the convenience constructor, such that they are types instead of value. For now, I have named the type
Token
, because we couldn't really find a good name in JuliaLang/LinearAlgebra.jl#144. Hopefully, we can avoid the new type and just wrap a value in curly brackets and have it interpreted as a type.