From a4b38ad9a60fb08f4bda4a4ab01f4be8def7ef88 Mon Sep 17 00:00:00 2001 From: Daniel Karrasch Date: Fri, 25 Jun 2021 03:14:42 +0200 Subject: [PATCH] Fix lu deprecation warning on julia v1.7+ (#284) --- Project.toml | 3 +-- src/TaylorSeries.jl | 5 ++++- src/arithmetic.jl | 8 ++++++-- 3 files changed, 11 insertions(+), 5 deletions(-) diff --git a/Project.toml b/Project.toml index d696c721..10a18d51 100644 --- a/Project.toml +++ b/Project.toml @@ -1,10 +1,9 @@ name = "TaylorSeries" uuid = "6aa5eb33-94cf-58f4-a9d0-e4b2c4fc25ea" repo = "https://github.com/JuliaDiff/TaylorSeries.jl.git" -version = "0.11.0" +version = "0.11.1" [deps] -InteractiveUtils = "b77e0a4c-d291-57a0-90e8-8db25a27a240" LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e" Markdown = "d6f4376e-aef5-505a-96c1-9c027394607a" Requires = "ae029012-a4dd-5104-9daa-d747884805df" diff --git a/src/TaylorSeries.jl b/src/TaylorSeries.jl index 4a02ac39..b978e094 100644 --- a/src/TaylorSeries.jl +++ b/src/TaylorSeries.jl @@ -17,7 +17,6 @@ see also [`HomogeneousPolynomial`](@ref). module TaylorSeries -using InteractiveUtils: subtypes using SparseArrays: SparseMatrixCSC using Markdown using Requires @@ -26,6 +25,10 @@ using LinearAlgebra: norm, mul!, lu, lu!, LinearAlgebra.lutype, LinearAlgebra.copy_oftype, LinearAlgebra.issuccess +if VERSION >= v"1.7.0-DEV.1188" + using LinearAlgebra: NoPivot, RowMaximum +end + import LinearAlgebra: norm, mul!, lu import Base: ==, +, -, *, /, ^ diff --git a/src/arithmetic.jl b/src/arithmetic.jl index f3e54ea1..8f6836d5 100644 --- a/src/arithmetic.jl +++ b/src/arithmetic.jl @@ -602,6 +602,10 @@ end # return Ai # end +# see https://github.com/JuliaLang/julia/pull/40623 +const LU_RowMaximum = VERSION >= v"1.7.0-DEV.1188" ? RowMaximum() : Val(true) +const LU_NoPivot = VERSION >= v"1.7.0-DEV.1188" ? NoPivot() : Val(false) + # Adapted from (Julia v1.2) stdlib/v1.2/LinearAlgebra/src/lu.jl#240-253 # and (Julia v1.4.0-dev) stdlib/LinearAlgebra/v1.4/src/lu.jl#270-274, # licensed under MIT "Expat". @@ -610,10 +614,10 @@ end # We can't assume an ordered field so we first try without pivoting function lu(A::AbstractMatrix{Taylor1{T}}; check::Bool = true) where {T<:Number} S = Taylor1{lutype(T)} - F = lu!(copy_oftype(A, S), Val(false); check = false) + F = lu!(copy_oftype(A, S), LU_NoPivot; check = false) if issuccess(F) return F else - return lu!(copy_oftype(A, S), Val(true); check = check) + return lu!(copy_oftype(A, S), LU_RowMaximum; check = check) end end