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

convert Integer in Cholesky constructors to BlasInt #29732

Merged
merged 5 commits into from
Oct 21, 2018

Conversation

kleinschmidt
Copy link
Contributor

As discussed on slack with @nalimilan and @mbauman, this loosens the constructors for Cholesky to allow Integer info arguments, which are converted to BlasInt.

Fixes JuliaStats/MixedModels.jl#143 (which is caused by BlasInt=Int32 on builds with non-ILP64 BLAS, like arch linux).

@nalimilan
Copy link
Member

Can you add a test? That would have caught this when building distro packages.

@nalimilan nalimilan added the linear algebra Linear algebra label Oct 19, 2018
@nalimilan nalimilan added the bugfix This change fixes an existing bug label Oct 19, 2018
CholeskyPivoted{T,typeof(A)}(A, uplo, piv, rank, tol, info)
function CholeskyPivoted(A::AbstractMatrix{T}, uplo::AbstractChar, piv::Vector{<:Integer},
rank::Integer, tol::Real, info::Integer) where T
CholeskyPivoted{T,typeof(A)}(A, uplo, Vector{BlasInt}(piv), BlasInt(rank), tol,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mmm, I missed this, but it's going to make a copy even when not needed. Better use convert.

Cholesky(A::AbstractMatrix{T}, uplo::AbstractChar, info::BlasInt) where {T} =
Cholesky{T,typeof(A)}(A, uplo, info)
Cholesky(A::AbstractMatrix{T}, uplo::Symbol, info::Integer) where {T} =
Cholesky{T,typeof(A)}(A, char_uplo(uplo), BlasInt(info))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually, I shouldn't even be necessary to convert explicitly to BlasInt. The conversion will happen implicitly if you just pass info and it is slightly cleaner.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is that true of the Vector too?

Copy link
Member

@andreasnoack andreasnoack Oct 19, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes. It should also be the case for `Vector.

@kleinschmidt
Copy link
Contributor Author

Okay I've removed all the conversions so the only change is broadening the methods to accept Integers.

@JeffBezanson JeffBezanson merged commit 53563cd into JuliaLang:master Oct 21, 2018
KristofferC pushed a commit that referenced this pull request Oct 29, 2018
KristofferC pushed a commit that referenced this pull request Feb 11, 2019
KristofferC pushed a commit that referenced this pull request Feb 20, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bugfix This change fixes an existing bug linear algebra Linear algebra
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants