Skip to content
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

Merged
merged 1 commit into from
Jan 15, 2017

Conversation

Sacha0
Copy link
Member

@Sacha0 Sacha0 commented Jan 15, 2017

Towards fixing some generalized linear indexing deprecation warnings in #20040, this pull request rewrites the A[c|t]_ldiv_B[!] specializations for UmfpackLU-StridedVecOrMat combinations, leveraging multiple dispatch to remove generalized linear indexing and meta-fu. cc @mbauman. (Crossref. #20045.) Best!

@Sacha0 Sacha0 added linear algebra Linear algebra sparse Sparse arrays labels Jan 15, 2017
@Sacha0 Sacha0 changed the base branch from master to mb/deprecate-17440 January 15, 2017 08:01
…combinations, without generalized linear indexing and meta-fu.
@mbauman mbauman merged commit 81f5645 into JuliaLang:mb/deprecate-17440 Jan 15, 2017
@Sacha0 Sacha0 deleted the degliumf branch January 15, 2017 19:31
(_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"))
Copy link
Contributor

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

Copy link
Member Author

@Sacha0 Sacha0 Jan 15, 2017

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!

Copy link
Member Author

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
Copy link
Contributor

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

Copy link
Member Author

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!

Copy link
Contributor

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

Copy link
Member Author

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!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
linear algebra Linear algebra sparse Sparse arrays
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants