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

Fixes for Julia v1.10 #833

Merged
merged 3 commits into from
Jan 31, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
11 changes: 6 additions & 5 deletions src/Cones/possemideftrisparse/cholmodimpl.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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}}
Expand Down Expand Up @@ -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
Expand Down
3 changes: 2 additions & 1 deletion src/Solvers/Solvers.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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}}
Expand Down
3 changes: 3 additions & 0 deletions src/Solvers/process.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down
4 changes: 3 additions & 1 deletion src/Solvers/systemsolvers/naive.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
4 changes: 3 additions & 1 deletion src/Solvers/systemsolvers/naiveelim.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
Loading