diff --git a/Project.toml b/Project.toml index 4ea20b5..f184676 100644 --- a/Project.toml +++ b/Project.toml @@ -17,13 +17,13 @@ SIFDecode_jll = "54dcf436-342f-53ea-8005-3708a1ae6c8c" SparseArrays = "2f01184e-e22b-5df5-ae63-d93ebab69eaf" [compat] -CUTEst_jll = "=2.2.5" +CUTEst_jll = "=2.3.0" Combinatorics = "1.0" DataStructures = "0.18" JSON = "0.21" NLPModels = "0.21.3" Quadmath = "0.5.10" -SIFDecode_jll = "2.6.0" +SIFDecode_jll = "2.6.1" julia = "^1.6.0" [extras] diff --git a/docs/src/core.md b/docs/src/core.md index e6933ed..2a7f1a9 100644 --- a/docs/src/core.md +++ b/docs/src/core.md @@ -104,4 +104,5 @@ CUTEst.uvartype CUTEst.fopen CUTEst.csgrshp CUTEst.ccfsg +CUTEst.classification ``` diff --git a/gen/wrapper.jl b/gen/wrapper.jl index 4673c9f..60ab6ac 100644 --- a/gen/wrapper.jl +++ b/gen/wrapper.jl @@ -4,6 +4,11 @@ using Clang using Clang.Generators using JuliaFormatter +# Support for quadruple precision +struct JuliaCfloat128 <: Clang.Generators.AbstractJuliaSIT end +Clang.Generators.tojulia(x::CLFloat128) = JuliaCfloat128() +Clang.Generators.translate(jlty::JuliaCfloat128, options=Dict()) = :Float128 + function main() cd(@__DIR__) include_dir = joinpath(CUTEst_jll.artifact_dir, "include") @@ -15,6 +20,7 @@ function main() "integer", "real", "doublereal", + "quadreal", "logical", "rp_", "rpc_", @@ -40,11 +46,15 @@ function main() code = replace(code, "Ptr{doublereal}" => "Ptr{Float64}") code = replace(code, "Ptr{real}" => "Ptr{Float32}") code = replace(code, "Ptr{doubleCfloat}" => "Ptr{Float64}") + code = replace(code, "Ptr{quadreal}" => "Ptr{Float128}") code = replace(code, "Ptr{logical}" => "Ptr{Bool}") code = replace(code, "Ptr{rp_}" => "Ptr{Float64}") code = replace(code, "Ptr{rpc_}" => "Ptr{Float64}") code = replace(code, "Ptr{ip_}" => "Ptr{Cint}") code = replace(code, "Ptr{ipc_}" => "Ptr{Cint}") + for routine in ("classification", "probname", "pname", "varnames", "connames", "unames", "cnames") + code = replace(code, "cutest_cint_$routine" => "cutest_$routine") + end blocks = split(code, "end\n") nblocks = length(blocks) diff --git a/src/core_interface.jl b/src/core_interface.jl index 3f2e506..d038280 100644 --- a/src/core_interface.jl +++ b/src/core_interface.jl @@ -3212,3 +3212,18 @@ for (cutest_ccf, T) in end end end + +""" + classification(T, libsif, status, funit, class) +""" +function classification end + +for (cutest_classification, T) in ((:cutest_classification_s_, :Float32), + (:cutest_classification_, :Float64), + (:cutest_classification_q_, :Float128)) + @eval begin + function classification(::Type{$T}, libsif::Ptr{Cvoid}, status, funit, class) + $cutest_classification(libsif, status, funit, class) + end + end +end diff --git a/src/libcutest.jl b/src/libcutest.jl index cff5aed..cfbfb71 100644 --- a/src/libcutest.jl +++ b/src/libcutest.jl @@ -124,6 +124,12 @@ function cutest_pname_(libsif, status, funit, pname) @ccall $ptr_cutest_pname_(status::Ptr{Cint}, funit::Ptr{Cint}, pname::Ptr{Cchar})::Cvoid end +function cutest_classification_(libsif, status, funit, classification) + ptr_cutest_classification_ = Libdl.dlsym(libsif, :cutest_classification_) + @ccall $ptr_cutest_classification_(status::Ptr{Cint}, funit::Ptr{Cint}, + classification::Ptr{Cchar})::Cvoid +end + function cutest_probname_(libsif, status, pname) ptr_cutest_probname_ = Libdl.dlsym(libsif, :cutest_probname_) @ccall $ptr_cutest_probname_(status::Ptr{Cint}, pname::Ptr{Cchar})::Cvoid @@ -670,6 +676,12 @@ function cutest_pname_s_(libsif, status, funit, pname) @ccall $ptr_cutest_pname_s_(status::Ptr{Cint}, funit::Ptr{Cint}, pname::Ptr{Cchar})::Cvoid end +function cutest_classification_s_(libsif, status, funit, classification) + ptr_cutest_classification_s_ = Libdl.dlsym(libsif, :cutest_classification_s_) + @ccall $ptr_cutest_classification_s_(status::Ptr{Cint}, funit::Ptr{Cint}, + classification::Ptr{Cchar})::Cvoid +end + function cutest_probname_s_(libsif, status, pname) ptr_cutest_probname_s_ = Libdl.dlsym(libsif, :cutest_probname_s_) @ccall $ptr_cutest_probname_s_(status::Ptr{Cint}, pname::Ptr{Cchar})::Cvoid @@ -1222,6 +1234,12 @@ function cutest_pname_q_(libsif, status, funit, pname) @ccall $ptr_cutest_pname_q_(status::Ptr{Cint}, funit::Ptr{Cint}, pname::Ptr{Cchar})::Cvoid end +function cutest_classification_q_(libsif, status, funit, classification) + ptr_cutest_classification_q_ = Libdl.dlsym(libsif, :cutest_classification_q_) + @ccall $ptr_cutest_classification_q_(status::Ptr{Cint}, funit::Ptr{Cint}, + classification::Ptr{Cchar})::Cvoid +end + function cutest_probname_q_(libsif, status, pname) ptr_cutest_probname_q_ = Libdl.dlsym(libsif, :cutest_probname_q_) @ccall $ptr_cutest_probname_q_(status::Ptr{Cint}, pname::Ptr{Cchar})::Cvoid @@ -1246,8 +1264,8 @@ end function cutest_cint_uofg_q_(libsif, status, n, x, f, g, grad) ptr_cutest_cint_uofg_q_ = Libdl.dlsym(libsif, :cutest_cint_uofg_q_) - @ccall $ptr_cutest_cint_uofg_q_(status::Ptr{Cint}, n::Ptr{Cint}, x::Ptr{Float128}, f::Ptr{Float128}, - g::Ptr{Float128}, grad::Ptr{Bool})::Cvoid + @ccall $ptr_cutest_cint_uofg_q_(status::Ptr{Cint}, n::Ptr{Cint}, x::Ptr{Float128}, + f::Ptr{Float128}, g::Ptr{Float128}, grad::Ptr{Bool})::Cvoid end function cutest_udh_q_(libsif, status, n, x, lh1, h) @@ -1265,7 +1283,8 @@ end function cutest_ush_q_(libsif, status, n, x, nnzh, lh, h, irnh, icnh) ptr_cutest_ush_q_ = Libdl.dlsym(libsif, :cutest_ush_q_) @ccall $ptr_cutest_ush_q_(status::Ptr{Cint}, n::Ptr{Cint}, x::Ptr{Float128}, nnzh::Ptr{Cint}, - lh::Ptr{Cint}, h::Ptr{Float128}, irnh::Ptr{Cint}, icnh::Ptr{Cint})::Cvoid + lh::Ptr{Cint}, h::Ptr{Float128}, irnh::Ptr{Cint}, + icnh::Ptr{Cint})::Cvoid end function cutest_cint_ueh_q_(libsif, status, n, x, ne, le, iprnhi, iprhi, lirnhi, irnhi, lhi, hi, @@ -1294,9 +1313,10 @@ function cutest_cint_ugreh_q_(libsif, status, n, x, g, ne, le, iprnhi, iprhi, li hi, byrows) ptr_cutest_cint_ugreh_q_ = Libdl.dlsym(libsif, :cutest_cint_ugreh_q_) @ccall $ptr_cutest_cint_ugreh_q_(status::Ptr{Cint}, n::Ptr{Cint}, x::Ptr{Float128}, - g::Ptr{Float128}, ne::Ptr{Cint}, le::Ptr{Cint}, iprnhi::Ptr{Cint}, - iprhi::Ptr{Cint}, lirnhi::Ptr{Cint}, irnhi::Ptr{Cint}, - lhi::Ptr{Cint}, hi::Ptr{Float128}, byrows::Ptr{Bool})::Cvoid + g::Ptr{Float128}, ne::Ptr{Cint}, le::Ptr{Cint}, + iprnhi::Ptr{Cint}, iprhi::Ptr{Cint}, lirnhi::Ptr{Cint}, + irnhi::Ptr{Cint}, lhi::Ptr{Cint}, hi::Ptr{Float128}, + byrows::Ptr{Bool})::Cvoid end function cutest_cint_uhprod_q_(libsif, status, n, goth, x, p, r) @@ -1332,8 +1352,8 @@ end function cutest_cint_cofg_q_(libsif, status, n, x, f, g, grad) ptr_cutest_cint_cofg_q_ = Libdl.dlsym(libsif, :cutest_cint_cofg_q_) - @ccall $ptr_cutest_cint_cofg_q_(status::Ptr{Cint}, n::Ptr{Cint}, x::Ptr{Float128}, f::Ptr{Float128}, - g::Ptr{Float128}, grad::Ptr{Bool})::Cvoid + @ccall $ptr_cutest_cint_cofg_q_(status::Ptr{Cint}, n::Ptr{Cint}, x::Ptr{Float128}, + f::Ptr{Float128}, g::Ptr{Float128}, grad::Ptr{Bool})::Cvoid end function cutest_cint_cofsg_q_(libsif, status, n, x, f, nnzg, lg, sg, ivsg, grad) diff --git a/test/coverage.jl b/test/coverage.jl index 296bee2..a6e6219 100644 --- a/test/coverage.jl +++ b/test/coverage.jl @@ -2,6 +2,8 @@ function coverage_increase(nlp::CUTEstModel{T}) where {T} status = Cint[0] n, m = nlp.meta.nvar, nlp.meta.ncon + # class = Vector{Cchar}(undef, 30) + # CUTEst.classification(T, nlp.libsif, nlp.status, nlp.funit, class) pname = Vector{Cchar}(undef, 10) CUTEst.probname(T, nlp.libsif, status, pname) vname = Matrix{Cchar}(undef, 10, n)