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

Upcoming lu issue on nightly #281

Closed
dkarrasch opened this issue Jun 19, 2021 · 7 comments
Closed

Upcoming lu issue on nightly #281

dkarrasch opened this issue Jun 19, 2021 · 7 comments

Comments

@dkarrasch
Copy link
Contributor

On current master, there is a finer distinction in copy_oftype-like constructors, which will likely make this package fail on nightly, see

JuliaLang/julia#40831 (comment)

This affects your own lu implementation, which uses copy_oftype(A, S), which used to call convert(AbstractArray{S}(A)), but now relies on 2-arg similar. So there are two options to fix this:

  1. Write a 2-arg similar function for matrices with eltype Taylor1, then copy_oftype will start using this starting from Julia v1.8 "silently".
  2. Replace copy_oftype(A, S) in lu by a direct call to convert(AbstractArray{S}, A), which is handled internally in your package.

If needed, I'd be willing to help, probably just like @daanhb.

@lbenet
Copy link
Member

lbenet commented Jun 19, 2021

Hi @dkarrasch ! Thanks for reporting the future issue. If you can, we would be grateful if you can help us with this.

@daanhb
Copy link

daanhb commented Jun 19, 2021

Hi, I'm happy to chime in. From the surrounding comments in the code, it seems the goal is to avoid pivoting, which LinearAlgebra would otherwise do by default but it may fail in this case. If that is so, might the following be sufficient?

lu(A::AbstractMatrix{Taylor1{T}}; check::Bool = true) where {T<:Number} = lu(A, Val(false); bool=bool)

This is not quite the same as the current implementation though, because the code tries again with pivoting if the first attempt fails. So perhaps

function lu(A::AbstractMatrix{Taylor1{T}}; check::Bool = true) where {T<:Number}
    F = lu(A, Val(false); bool=bool)
    if issuccess(F)
        return F
    else
        lu(A, Val(true); bool=bool)
    end
end

The advantage of the above is that you avoid using LinearAlgebra internals, but perhaps I'm missing something. If it turns out that LinearAlgebra doesn't properly copy the array, say, then we'll have to look into that.

@dkarrasch
Copy link
Contributor Author

I tested a little bit and found that the issue is the new lu(::StridedMatrix) method, which takes precedence over the lu(::AbstractMatrix{Taylor1}) method defined here. In #41288, I have removed that method assuming (JuliaLang/julia#40831 (comment)) that copy_toarray and copy_oftype is no different on StridedMatrixes.

@lbenet
Copy link
Member

lbenet commented Jun 20, 2021

Thanks @daanhb for chiming in! I guess by now you have already found that the changes implemented in #223 were motivated by a somewhat similar report #221. I'm not an expert in Linear Algebra, so any help from you is welcome.

As a side question, do you know if we can test now 1.7 and 1.8 using github actions?

@dkarrasch
Copy link
Contributor Author

For 1.7, you would need to "hardcode" it as "1.7". Version 1.8 is available as "nightly", just "1" corresponds to v1.6.1 currently.

@lbenet
Copy link
Member

lbenet commented Jun 24, 2021

I just tested (locally) Julia v1.7.0-beta2 and got the following warning:

Tests for Taylor1 expansions |  375    375
┌ Warning: `lu!(A::Union{StridedMatrix, HermOrSym, Tridiagonal}, ::Val{false}; check::Bool = true)` is deprecated, use `lu!(A, NoPivot(); check = check)` instead.
│   caller = ip:0x0
└ @ Core :-1

Aside from this warning, tests pass fine.

@dkarrasch
Copy link
Contributor Author

Yes, the "problematic" PR is not included in v1.7, it's going to be in v1.8, which is why tests will fail now on nightly. But JuliaLang/julia#41288 is going to fix that issue. There is WIP for the deprecation warning, PR is coming soon.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants