Skip to content

Commit

Permalink
Interface the routine cutest_ccf
Browse files Browse the repository at this point in the history
  • Loading branch information
amontoison committed Aug 27, 2024
1 parent 2f3a632 commit f11c19d
Show file tree
Hide file tree
Showing 5 changed files with 35 additions and 20 deletions.
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ SIFDecode_jll = "54dcf436-342f-53ea-8005-3708a1ae6c8c"
SparseArrays = "2f01184e-e22b-5df5-ae63-d93ebab69eaf"

[compat]
CUTEst_jll = "=2.2.4"
CUTEst_jll = "=2.2.5"
Combinatorics = "1.0"
DataStructures = "0.17, 0.18"
JSON = "0.8, 0.9, 0.10, 0.11, 0.12, 0.13, 0.14, 0.15, 0.16, 0.17, 0.18, 0.19, 0.20, 0.21"
Expand Down
2 changes: 1 addition & 1 deletion gen/Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ JuliaFormatter = "98e50ef6-434e-11e9-1051-2b60c6c9e899"

[compat]
julia = "1.6"
CUTEst_jll = "2.2.2"
CUTEst_jll = "2.2.5"
14 changes: 14 additions & 0 deletions src/core_interface.jl
Original file line number Diff line number Diff line change
Expand Up @@ -3198,3 +3198,17 @@ for (cutest_cconst, T) in
end
end
end

"""
ccf(T, libsif, status, n, m, x, c)
"""
function ccf end

for (cutest_ccf, T) in
((:cutest_ccf_s_, :Float32), (:cutest_ccf_, :Float64), (:cutest_ccf_q_, :Float128))
@eval begin
function ccf(::Type{$T}, libsif::Ptr{Cvoid}, status, n, m, x, c)
$cutest_ccf(libsif, status, n, m, x, c)
end
end
end
19 changes: 1 addition & 18 deletions src/julia_interface.jl
Original file line number Diff line number Diff line change
Expand Up @@ -248,24 +248,7 @@ function NLPModels.cons!(
) where {T}
@lencheck nlp.meta.nvar x
@lencheck nlp.meta.ncon c
jsize = nlp.index
jsize[] = 0
get_jacobian = cutest_false
ccfsg(
T,
nlp.libsif,
nlp.status,
nlp.nvar,
nlp.ncon,
x,
c,
nlp.nnzj,
jsize,
T[],
nlp.jcols,
nlp.jrows,
get_jacobian,
)
ccf(T, nlp.libsif, nlp.status, nlp.nvar, nlp.ncon, x, c)
increment!(nlp, :neval_cons)
return c
end
Expand Down
18 changes: 18 additions & 0 deletions src/libcutest.jl
Original file line number Diff line number Diff line change
Expand Up @@ -243,6 +243,12 @@ function cutest_cint_cofsg_(libsif, status, n, x, f, nnzg, lg, sg, ivsg, grad)
grad::Ptr{Bool})::Cvoid
end

function cutest_ccf_(libsif, status, n, m, x, c)
ptr_cutest_ccf_ = Libdl.dlsym(libsif, :cutest_ccf_)
@ccall $ptr_cutest_ccf_(status::Ptr{Cint}, n::Ptr{Cint}, m::Ptr{Cint}, x::Ptr{Float64},
c::Ptr{Float64})::Cvoid
end

function cutest_cint_ccfg_(libsif, status, n, m, x, c, jtrans, lcjac1, lcjac2, cjac, grad)
ptr_cutest_cint_ccfg_ = Libdl.dlsym(libsif, :cutest_cint_ccfg_)
@ccall $ptr_cutest_cint_ccfg_(status::Ptr{Cint}, n::Ptr{Cint}, m::Ptr{Cint}, x::Ptr{Float64},
Expand Down Expand Up @@ -785,6 +791,12 @@ function cutest_cint_cofsg_s_(libsif, status, n, x, f, nnzg, lg, sg, ivsg, grad)
sg::Ptr{Float32}, ivsg::Ptr{Cint}, grad::Ptr{Bool})::Cvoid
end

function cutest_ccf_s_(libsif, status, n, m, x, c)
ptr_cutest_ccf_s_ = Libdl.dlsym(libsif, :cutest_ccf_s_)
@ccall $ptr_cutest_ccf_s_(status::Ptr{Cint}, n::Ptr{Cint}, m::Ptr{Cint}, x::Ptr{Float32},
c::Ptr{Float32})::Cvoid
end

function cutest_cint_ccfg_s_(libsif, status, n, m, x, c, jtrans, lcjac1, lcjac2, cjac, grad)
ptr_cutest_cint_ccfg_s_ = Libdl.dlsym(libsif, :cutest_cint_ccfg_s_)
@ccall $ptr_cutest_cint_ccfg_s_(status::Ptr{Cint}, n::Ptr{Cint}, m::Ptr{Cint}, x::Ptr{Float32},
Expand Down Expand Up @@ -1331,6 +1343,12 @@ function cutest_cint_cofsg_q_(libsif, status, n, x, f, nnzg, lg, sg, ivsg, grad)
sg::Ptr{Float128}, ivsg::Ptr{Cint}, grad::Ptr{Bool})::Cvoid
end

function cutest_ccf_q_(libsif, status, n, m, x, c)
ptr_cutest_ccf_q_ = Libdl.dlsym(libsif, :cutest_ccf_q_)
@ccall $ptr_cutest_ccf_q_(status::Ptr{Cint}, n::Ptr{Cint}, m::Ptr{Cint}, x::Ptr{Float128},
c::Ptr{Float128})::Cvoid
end

function cutest_cint_ccfg_q_(libsif, status, n, m, x, c, jtrans, lcjac1, lcjac2, cjac, grad)
ptr_cutest_cint_ccfg_q_ = Libdl.dlsym(libsif, :cutest_cint_ccfg_q_)
@ccall $ptr_cutest_cint_ccfg_q_(status::Ptr{Cint}, n::Ptr{Cint}, m::Ptr{Cint}, x::Ptr{Float128},
Expand Down

0 comments on commit f11c19d

Please sign in to comment.