Skip to content

A[c|t]_ldiv_B! specializations for UmfpackLU-StridedVecOrMat, less generalized linear indexing and meta-fu#20046

Merged
mbauman merged 1 commit intoJuliaLang:mb/deprecate-17440from
Sacha0:degliumf
Jan 15, 2017
Merged

A[c|t]_ldiv_B! specializations for UmfpackLU-StridedVecOrMat, less generalized linear indexing and meta-fu#20046
mbauman merged 1 commit intoJuliaLang:mb/deprecate-17440from
Sacha0:degliumf

Conversation

@Sacha0
Copy link
Copy Markdown
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
Comment thread base/sparse/umfpack.jl
(_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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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!

Comment thread base/sparse/umfpack.jl
_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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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