From beb23c563814b0b96daba8ec88891a53e771a349 Mon Sep 17 00:00:00 2001 From: odow Date: Thu, 11 Jan 2024 15:44:52 +1300 Subject: [PATCH 1/3] Fixes for Julia v1.10 --- src/Cones/possemideftrisparse/cholmodimpl.jl | 11 ++++++----- src/Solvers/Solvers.jl | 3 ++- src/Solvers/systemsolvers/naive.jl | 4 +++- src/Solvers/systemsolvers/naiveelim.jl | 4 +++- 4 files changed, 14 insertions(+), 8 deletions(-) diff --git a/src/Cones/possemideftrisparse/cholmodimpl.jl b/src/Cones/possemideftrisparse/cholmodimpl.jl index bba4c467a..fe738f929 100644 --- a/src/Cones/possemideftrisparse/cholmodimpl.jl +++ b/src/Cones/possemideftrisparse/cholmodimpl.jl @@ -52,6 +52,8 @@ mutable struct PSDSparseCholmodCache{T <: BlasReal, R <: RealOrComplex{T}} <: PSDSparseCholmodCache{T, R}() where {T <: BlasReal, R <: RealOrComplex{T}} = new{T, R}() end +_unsafe_load(::Type{T}, ptr::Ptr, i) where {T} = unsafe_load(convert(Ptr{T}, ptr), i) + function setup_extra_data!( cone::PosSemidefTriSparse{PSDSparseCholmod, T, R}, ) where {T <: BlasReal, R <: RealOrComplex{T}} @@ -79,14 +81,13 @@ function setup_extra_data!( f = unsafe_load(pointer(symb_mat)) @assert f.n == cone.side @assert f.is_super != 0 - num_super = Int(f.nsuper) - supers = cache.supers = [unsafe_load(f.super, i) + 1 for i in 1:num_super] + supers = cache.supers = [_unsafe_load(Int, f.super, i) + 1 for i in 1:num_super] push!(supers, side + 1) - fs = [unsafe_load(f.s, i) + 1 for i in 1:Int(f.ssize)] - fpi = [unsafe_load(f.pi, i) + 1 for i in 1:num_super] + fs = [_unsafe_load(Int, f.s, i) + 1 for i in 1:Int(f.ssize)] + fpi = [_unsafe_load(Int, f.pi, i) + 1 for i in 1:num_super] push!(fpi, length(fs) + 1) - fpx = [unsafe_load(f.px, i) + 1 for i in 1:num_super] + fpx = [_unsafe_load(Int, f.px, i) + 1 for i in 1:num_super] # construct super_map # super_map[k] = s if column k is in supernode s diff --git a/src/Solvers/Solvers.jl b/src/Solvers/Solvers.jl index a54ec239e..88c221a4c 100644 --- a/src/Solvers/Solvers.jl +++ b/src/Solvers/Solvers.jl @@ -124,7 +124,8 @@ mutable struct Solver{T <: Real} Ap_fact::Factorization{T} Ap_rank::Int Ap_R::UpperTriangular{T, <:AbstractMatrix{T}} - Ap_Q::Union{UniformScaling, AbstractMatrix{T}} + # Ap_Q::Union{UniformScaling, AbstractMatrix{T}} + Ap_Q::Any # Any is needed for Julia 1.10 and later AG_fact::Factorization{T} AG_rank::Int AG_R::UpperTriangular{T, <:AbstractMatrix{T}} diff --git a/src/Solvers/systemsolvers/naive.jl b/src/Solvers/systemsolvers/naive.jl index db6f23c7d..95fafe026 100644 --- a/src/Solvers/systemsolvers/naive.jl +++ b/src/Solvers/systemsolvers/naive.jl @@ -216,7 +216,9 @@ function load(syssolver::NaiveDenseSystemSolver{T}, solver::Solver{T}) where {T dz(1, q), 1, ) - @assert lhs isa Matrix{T} + if !(lhs isa Matrix{T}) + lhs = Matrix{T}(lhs) + end syssolver.lhs = lhs syssolver.lhs_fact = zero(lhs) diff --git a/src/Solvers/systemsolvers/naiveelim.jl b/src/Solvers/systemsolvers/naiveelim.jl index 561b76dea..c6cc42a8b 100644 --- a/src/Solvers/systemsolvers/naiveelim.jl +++ b/src/Solvers/systemsolvers/naiveelim.jl @@ -302,7 +302,9 @@ function load(syssolver::NaiveElimDenseSystemSolver{T}, solver::Solver{T}) where -model.h', 1, ) - @assert lhs_sub isa Matrix{T} + if !(lhs_sub isa Matrix{T}) + lhs_sub = Matrix{T}(lhs_sub) + end syssolver.lhs_sub = lhs_sub syssolver.lhs_sub_fact = zero(lhs_sub) From 14f89b4b913377ee890c5d7d6ca1c719ddf3de58 Mon Sep 17 00:00:00 2001 From: Oscar Dowson Date: Thu, 11 Jan 2024 15:48:50 +1300 Subject: [PATCH 2/3] Update ci.yml --- .github/workflows/ci.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 20892fb84..14806d5d8 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -15,9 +15,9 @@ jobs: fail-fast: false matrix: version: -# - '1.5' # minimum Julia version supported + - '1.6' - '1' -# - 'nightly' + # - 'nightly' os: - ubuntu-latest arch: From a16fa6ae3ce34efc0985583e458121bf428f6bcd Mon Sep 17 00:00:00 2001 From: odow Date: Thu, 11 Jan 2024 16:40:10 +1300 Subject: [PATCH 3/3] Update --- src/Solvers/process.jl | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/Solvers/process.jl b/src/Solvers/process.jl index 8a057bd6c..2f0d021ef 100644 --- a/src/Solvers/process.jl +++ b/src/Solvers/process.jl @@ -499,6 +499,9 @@ function unreduce_y(solver::Solver{T}, y::Vector{T}) where {T <: Real} if !in(solver.status, infeas_statuses) ya .+= solver.reduce_cQ1 end + if length(solver.reduce_y_keep_idxs) == 0 + return + end @views ya_sub = ya[1:length(solver.reduce_y_keep_idxs)] ldiv!(solver.reduce_Ap_R, ya_sub) @views y_sub = solver.result.y[solver.reduce_y_keep_idxs]