Skip to content

Commit

Permalink
Use sdplrlib from shared library (#5)
Browse files Browse the repository at this point in the history
* Use sdplrlib from shared library

* Fix format
  • Loading branch information
blegat authored Nov 16, 2023
1 parent 70d4691 commit 37c8ec0
Show file tree
Hide file tree
Showing 3 changed files with 2,268 additions and 0 deletions.
1 change: 1 addition & 0 deletions Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,5 @@ version = "0.1.0"
SDPLR_jll = "3a057b76-36a0-51f0-a66f-6d580b8e8efd"

[compat]
SDPLR_jll = "100.1.300"
julia = "1.6"
71 changes: 71 additions & 0 deletions src/SDPLR.jl
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,75 @@ function solve_sdpa_file(file)
return run(`$(SDPLR_jll.sdplr()) $file`)
end

function solve(
blksz::Vector{Cptrdiff_t},
blktype::Vector{Cchar},
b::Vector{Cdouble},
CAent::Vector{Cdouble},
CArow::Vector{Csize_t},
CAcol::Vector{Csize_t},
CAinfo_entptr::Vector{Csize_t},
CAinfo_type::Vector{Cchar},
numbfgsvecs::Integer,
rho_f::Cdouble,
rho_c::Cdouble,
sigmafac::Cdouble,
rankreduce::Integer,
gaptol::Cdouble,
checkbd::Integer,
typebd::Integer,
dthresh_dim::Integer,
dthresh_dens::Cdouble,
timelim::Integer,
rankredtol::Cdouble,
printlevel::Integer,
R::Vector{Cdouble},
lambda::Vector{Cdouble},
maxranks::Vector{Csize_t},
ranks::Vector{Csize_t},
pieces::Vector{Cdouble},
)
numblk = length(blksz)
@assert length(blktype) == numblk
m = length(b)
@assert length(CAinfo_entptr) == (m + 1) * numblk + 1
@assert length(CAinfo_type) == (m + 1) * numblk
@assert length(CAent) == length(CArow) == length(CAcol)
@assert length(lambda) == m
@assert length(maxranks) == numblk
@assert length(ranks) == numblk
@assert length(pieces) == 8
ret = @ccall SDPLR.SDPLR_jll.libsdplr.sdplrlib(
m::Csize_t,
numblk::Csize_t,
blksz::Ptr{Cptrdiff_t},
blktype::Ptr{Cchar},
b::Ptr{Cdouble},
CAent::Ptr{Cdouble},
CArow::Ptr{Csize_t},
CAcol::Ptr{Csize_t},
CAinfo_entptr::Ptr{Csize_t},
CAinfo_type::Ptr{Cchar},
numbfgsvecs::Csize_t,
rho_f::Cdouble,
rho_c::Cdouble,
sigmafac::Cdouble,
rankreduce::Csize_t,
gaptol::Cdouble,
checkbd::Cptrdiff_t,
typebd::Csize_t,
dthresh_dim::Csize_t,
dthresh_dens::Cdouble,
timelim::Csize_t,
rankredtol::Cdouble,
printlevel::Csize_t,
R::Ptr{Cdouble},
lambda::Ptr{Cdouble},
maxranks::Ptr{Csize_t},
ranks::Ptr{Csize_t},
pieces::Ptr{Cdouble},
)::Csize_t
return ret
end

end # module
Loading

0 comments on commit 37c8ec0

Please sign in to comment.