-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
yak shaving, full deprecation style #23838
Conversation
return false | ||
for j in 1:min(n, m + k - 1) | ||
for i in max(1, j - k + 1):m | ||
iszero(A[i, j]) || return false |
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.
maybe @inbounds
?
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.
I am not certain this is safe for arbitrary AbstractArray
s, for example OffsetArray
s, and so hesitate to add an @inbounds
?
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.
Eventually, these functions should use either be restricted to StridedMatrix
or the index calculations be changed to work with OffsetArrays
.
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.
Good call :). Do you have thoughts on the best way to generalize these loops? Thanks!
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.
The easiest might be to reuse the existing loops and then use the i
and j
to index into the actual indices for the array, e.g. ii = indices(A, 1)[i]
, and then index with ii
and jj
.
Looks great, I like the |
I think |
Cheers, agreed :). |
74a1faf
to
6791a6f
Compare
Nixed |
6791a6f
to
ba3c22d
Compare
Thanks all! :) |
tl;dr
This pull request eliminates a few uses of
full
from base/linalg/special.jl, via a minor yak shave. Ref. JuliaLang/LinearAlgebra.jl#229, JuliaLang/LinearAlgebra.jl#231, #18850, and linked threads.details
The eliminated uses of
full
were part of ad hoc checks for upper bidiagonal, lower bidiagonal, and tridiagonal band structure in conversions between structured and/or annotated matrix types.The first commit generalizes existing and introduces new (not exported) generic functions that perform the necessary upper bidiagonal, lower bidiagonal, and tridiagonal band structure checks. Specifically, the first commit extends
istri[u|l](A)
toistri[u|l](A, k)
matchingtri[u|l](A, k)
, implementsisbanded(A, kl, ku)
as a short child ofistri[u|l](A, k)
, (re)implementsisdiag(A)
,isbidiag[u|l](A)
, andistridiag(A)
as short children ofisbanded(A, ul, uk)
, and tests and documents all those functions.The second commit eliminates the uses of
full
in question via the functions provided by the first commit.The third commit then cleans up the complete set of surrounding structured and/or annotated matrix interconversion methods, at a pleasing LOC reduction.
Best!