-
-
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
A[c|t]_ldiv_B! specializations for UmfpackLU-StridedVecOrMat, less generalized linear indexing and meta-fu #20046
Conversation
…combinations, without generalized linear indexing and meta-fu.
(_AqldivB_checkshapecompat(X, B); _AqldivB_kernel!(X, lu, B, transtype); return X) | ||
|
||
_AqldivB_checkshapecompat(X::StridedVecOrMat, B::StridedVecOrMat) = | ||
size(X, 2) == size(B, 2) || throw(DimensionMismatch("input and output must have same column count")) |
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.
why the rewording from "number of columns" to "column count" ? was better before IMO
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.
Reworded to reduce line length overrun, but happy to change that in a collection of fixups? 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.
Fixed in #20055. Thanks!
_AqldivB_kernel!{T<:UMFVTypes}(x::StridedVector{T}, lu::UmfpackLU{T}, b::StridedVector{T}, transtype) = | ||
solve!(x, lu, b, transtype) | ||
_AqldivB_kernel!{T<:UMFVTypes}(X::StridedMatrix{T}, lu::UmfpackLU{T}, B::StridedMatrix{T}, transtype) = | ||
for col in 1:size(X, 1) solve!(view(X, :, col), lu, view(B, :, col), transtype) end |
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.
one-liner for loops are not very readable
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.
Is there a better way to avoid introducing another three primarily empty/extraneous lines? 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.
if a one-liner has a nontrivial block of code or is doing multiple things, it shouldn't be a one-liner
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.
Expanded in #20055, and likewise a few of the other one-liners. Thanks!
Towards fixing some generalized linear indexing deprecation warnings in #20040, this pull request rewrites the
A[c|t]_ldiv_B[!]
specializations forUmfpackLU
-StridedVecOrMat
combinations, leveraging multiple dispatch to remove generalized linear indexing and meta-fu. cc @mbauman. (Crossref. #20045.) Best!