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

Use sdplrlib from shared library #5

Merged
merged 2 commits into from
Nov 16, 2023
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
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
Loading