Skip to content

Commit

Permalink
Fixes for Julia v1.10
Browse files Browse the repository at this point in the history
  • Loading branch information
odow committed Jan 11, 2024
1 parent 119e43a commit beb23c5
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 8 deletions.
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
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

0 comments on commit beb23c5

Please sign in to comment.