diff --git a/.gitignore b/.gitignore index 3a25230..bebfe93 100644 --- a/.gitignore +++ b/.gitignore @@ -8,3 +8,4 @@ deps/build.log Manifest.toml docs/Manifest.toml gen/symbols.txt +gen/symbols_64.txt diff --git a/gen/Project.toml b/gen/Project.toml index bca9c66..f0d1129 100644 --- a/gen/Project.toml +++ b/gen/Project.toml @@ -5,3 +5,4 @@ JuliaFormatter = "98e50ef6-434e-11e9-1051-2b60c6c9e899" [compat] julia = "1.6" +HSL_jll = "=2024.11.28" diff --git a/gen/analyzer.jl b/gen/analyzer.jl index 956ed85..0df71f7 100644 --- a/gen/analyzer.jl +++ b/gen/analyzer.jl @@ -2,7 +2,7 @@ using HSL_jll using JuliaFormatter -release = "2024.11.8" +release = "2024.11.28" libhsl = "/home/alexis/Bureau/git/hsl/libhsl/libHSL.v$release/" # Symbols of the shared library libhsl diff --git a/gen/wrapper.jl b/gen/wrapper.jl index 6e7f26d..daa7b60 100644 --- a/gen/wrapper.jl +++ b/gen/wrapper.jl @@ -11,7 +11,7 @@ function wrapper(name::String, headers::Vector{String}, optimized::Bool) @info "Wrapping $name" cd(@__DIR__) - include_dir = joinpath(HSL_jll.artifact_dir, "include") + include_dir = joinpath(HSL_jll.artifact_dir, "include", "libhsl") options = load_options(joinpath(@__DIR__, "hsl.toml")) options["general"]["output_file_path"] = joinpath("..", "src", "C", "$(name).jl") @@ -47,7 +47,7 @@ function hsl_headers(include::String, package::String, precisions::Vector{Char}) end function main(name::String="all"; optimized::Bool=false) - include = joinpath(HSL_jll.artifact_dir, "include") + include = joinpath(HSL_jll.artifact_dir, "include", "libhsl") if name == "all" || name == "libhsl" wrapper("libhsl", [joinpath(include, "libhsl.h")], optimized) diff --git a/src/C/hsl_ma48.jl b/src/C/hsl_ma48.jl index 68d1f65..370d7d0 100644 --- a/src/C/hsl_ma48.jl +++ b/src/C/hsl_ma48.jl @@ -24,9 +24,15 @@ mutable struct ma48_control{T} fill_in::Cint switch_mode::Cint - ma48_control{T}() where T = new() + ma48_control{T}() where {T} = new() - ma48_control{T}(f_arrays, multiplier, u, switch_, drop, tolerance, cgce, lp, wp, mp, ldiag, btf, struct_, maxit, factor_blocking, solve_blas, pivoting, diagonal_pivoting, fill_in, switch_mode) where T = new(f_arrays, multiplier, u, switch_, drop, tolerance, cgce, lp, wp, mp, ldiag, btf, struct_, maxit, factor_blocking, solve_blas, pivoting, diagonal_pivoting, fill_in, switch_mode) + function ma48_control{T}(f_arrays, multiplier, u, switch_, drop, tolerance, cgce, lp, wp, mp, + ldiag, btf, struct_, maxit, factor_blocking, solve_blas, pivoting, + diagonal_pivoting, fill_in, switch_mode) where {T} + return new(f_arrays, multiplier, u, switch_, drop, tolerance, cgce, lp, wp, mp, ldiag, btf, + struct_, maxit, factor_blocking, solve_blas, pivoting, diagonal_pivoting, fill_in, + switch_mode) + end end function ma48_default_control_s(control) @@ -52,9 +58,14 @@ mutable struct ma48_ainfo{T} sblock::Cint tblock::Clong - ma48_ainfo{T}() where T = new() + ma48_ainfo{T}() where {T} = new() - ma48_ainfo{T}(ops, flag, more, lena_analyse, lenj_analyse, lena_factorize, leni_factorize, ncmpa, rank, drop, struc_rank, oor, dup, stat, lblock, sblock, tblock) where T = new(ops, flag, more, lena_analyse, lenj_analyse, lena_factorize, leni_factorize, ncmpa, rank, drop, struc_rank, oor, dup, stat, lblock, sblock, tblock) + function ma48_ainfo{T}(ops, flag, more, lena_analyse, lenj_analyse, lena_factorize, + leni_factorize, ncmpa, rank, drop, struc_rank, oor, dup, stat, lblock, + sblock, tblock) where {T} + return new(ops, flag, more, lena_analyse, lenj_analyse, lena_factorize, leni_factorize, ncmpa, + rank, drop, struc_rank, oor, dup, stat, lblock, sblock, tblock) + end end mutable struct ma48_finfo{T} @@ -68,16 +79,20 @@ mutable struct ma48_finfo{T} rank::Cint stat::Cint - ma48_finfo{T}() where T = new() + ma48_finfo{T}() where {T} = new() - ma48_finfo{T}(ops, flag, more, size_factor, lena_factorize, leni_factorize, drop, rank, stat) where T = new(ops, flag, more, size_factor, lena_factorize, leni_factorize, drop, rank, stat) + function ma48_finfo{T}(ops, flag, more, size_factor, lena_factorize, leni_factorize, drop, rank, + stat) where {T} + return new(ops, flag, more, size_factor, lena_factorize, leni_factorize, drop, rank, stat) + end end function ma48_analyse_s(m, n, ne, row, col, val, factors, control, ainfo, finfo, perm, endcol) @ccall libhsl.ma48_analyse_s(m::Cint, n::Cint, ne::Clong, row::Ptr{Cint}, col::Ptr{Cint}, val::Ptr{Float32}, factors::Ptr{Cvoid}, control::Ref{ma48_control{Float32}}, ainfo::Ref{ma48_ainfo{Float32}}, - finfo::Ref{ma48_finfo{Float32}}, perm::Ptr{Cint}, endcol::Ptr{Cint})::Cvoid + finfo::Ref{ma48_finfo{Float32}}, perm::Ptr{Cint}, + endcol::Ptr{Cint})::Cvoid end function ma48_get_perm_s(m, n, factors, perm, control) @@ -88,7 +103,8 @@ end function ma48_factorize_s(m, n, ne, row, col, val, factors, control, finfo, fast, partial) @ccall libhsl.ma48_factorize_s(m::Cint, n::Cint, ne::Clong, row::Ptr{Cint}, col::Ptr{Cint}, val::Ptr{Float32}, factors::Ptr{Cvoid}, - control::Ref{ma48_control{Float32}}, finfo::Ref{ma48_finfo{Float32}}, fast::Cint, + control::Ref{ma48_control{Float32}}, + finfo::Ref{ma48_finfo{Float32}}, fast::Cint, partial::Cint)::Cvoid end @@ -106,7 +122,8 @@ function ma48_solve_s(m, n, ne, row, col, val, factors, rhs, x, control, sinfo, @ccall libhsl.ma48_solve_s(m::Cint, n::Cint, ne::Clong, row::Ptr{Cint}, col::Ptr{Cint}, val::Ptr{Float32}, factors::Ptr{Cvoid}, rhs::Ptr{Float32}, x::Ptr{Float32}, - control::Ref{ma48_control{Float32}}, sinfo::Ref{ma48_sinfo}, trans::Cint, + control::Ref{ma48_control{Float32}}, sinfo::Ref{ma48_sinfo}, + trans::Cint, resid::Ptr{Float32}, error::Ptr{Float32})::Cvoid end @@ -116,7 +133,8 @@ end function ma48_special_rows_and_cols_s(factors, rank, rows, cols, control) @ccall libhsl.ma48_special_rows_and_cols_s(factors::Ptr{Cvoid}, rank::Ptr{Cint}, rows::Ptr{Cint}, - cols::Ptr{Cint}, control::Ref{ma48_control{Float32}})::Cint + cols::Ptr{Cint}, + control::Ref{ma48_control{Float32}})::Cint end function ma48_determinant_s(factors, sgndet, logdet, control) @@ -136,7 +154,8 @@ function ma48_analyse_d(m, n, ne, row, col, val, factors, control, ainfo, finfo, @ccall libhsl.ma48_analyse_d(m::Cint, n::Cint, ne::Clong, row::Ptr{Cint}, col::Ptr{Cint}, val::Ptr{Float64}, factors::Ptr{Cvoid}, control::Ref{ma48_control{Float64}}, ainfo::Ref{ma48_ainfo{Float64}}, - finfo::Ref{ma48_finfo{Float64}}, perm::Ptr{Cint}, endcol::Ptr{Cint})::Cvoid + finfo::Ref{ma48_finfo{Float64}}, perm::Ptr{Cint}, + endcol::Ptr{Cint})::Cvoid end function ma48_get_perm_d(m, n, factors, perm, control) @@ -147,7 +166,8 @@ end function ma48_factorize_d(m, n, ne, row, col, val, factors, control, finfo, fast, partial) @ccall libhsl.ma48_factorize_d(m::Cint, n::Cint, ne::Clong, row::Ptr{Cint}, col::Ptr{Cint}, val::Ptr{Float64}, factors::Ptr{Cvoid}, - control::Ref{ma48_control{Float64}}, finfo::Ref{ma48_finfo{Float64}}, fast::Cint, + control::Ref{ma48_control{Float64}}, + finfo::Ref{ma48_finfo{Float64}}, fast::Cint, partial::Cint)::Cvoid end @@ -155,7 +175,8 @@ function ma48_solve_d(m, n, ne, row, col, val, factors, rhs, x, control, sinfo, @ccall libhsl.ma48_solve_d(m::Cint, n::Cint, ne::Clong, row::Ptr{Cint}, col::Ptr{Cint}, val::Ptr{Float64}, factors::Ptr{Cvoid}, rhs::Ptr{Float64}, x::Ptr{Float64}, - control::Ref{ma48_control{Float64}}, sinfo::Ref{ma48_sinfo}, trans::Cint, + control::Ref{ma48_control{Float64}}, sinfo::Ref{ma48_sinfo}, + trans::Cint, resid::Ptr{Float64}, error::Ptr{Float64})::Cvoid end @@ -165,7 +186,8 @@ end function ma48_special_rows_and_cols_d(factors, rank, rows, cols, control) @ccall libhsl.ma48_special_rows_and_cols_d(factors::Ptr{Cvoid}, rank::Ptr{Cint}, rows::Ptr{Cint}, - cols::Ptr{Cint}, control::Ref{ma48_control{Float64}})::Cint + cols::Ptr{Cint}, + control::Ref{ma48_control{Float64}})::Cint end function ma48_determinant_d(factors, sgndet, logdet, control) diff --git a/src/C/hsl_ma57.jl b/src/C/hsl_ma57.jl index 6634ba3..06f231d 100644 --- a/src/C/hsl_ma57.jl +++ b/src/C/hsl_ma57.jl @@ -25,12 +25,20 @@ mutable struct ma57_control{T} ordering::Cint scaling::Cint rank_deficient::Cint - ispare::NTuple{5,Cint} - rspare::NTuple{10,T} + ispare::NTuple{5, Cint} + rspare::NTuple{10, T} - ma57_control{T}() where T = new() + ma57_control{T}() where {T} = new() - ma57_control{T}(f_arrays, multiplier, reduce, u, static_tolerance, static_level, tolerance, convergence, consist, lp, wp, mp, sp, ldiag, nemin, factorblocking, solveblocking, la, liw, maxla, maxliw, pivoting, thresh, ordering, scaling, rank_deficient, ispare, rspare) where T = new(f_arrays, multiplier, reduce, u, static_tolerance, static_level, tolerance, convergence, consist, lp, wp, mp, sp, ldiag, nemin, factorblocking, solveblocking, la, liw, maxla, maxliw, pivoting, thresh, ordering, scaling, rank_deficient, ispare, rspare) + function ma57_control{T}(f_arrays, multiplier, reduce, u, static_tolerance, static_level, + tolerance, convergence, consist, lp, wp, mp, sp, ldiag, nemin, + factorblocking, solveblocking, la, liw, maxla, maxliw, pivoting, thresh, + ordering, scaling, rank_deficient, ispare, rspare) where {T} + return new(f_arrays, multiplier, reduce, u, static_tolerance, static_level, tolerance, + convergence, consist, lp, wp, mp, sp, ldiag, nemin, factorblocking, solveblocking, + la, liw, maxla, maxliw, pivoting, thresh, ordering, scaling, rank_deficient, ispare, + rspare) + end end function ma57_default_control_s(control) @@ -59,12 +67,16 @@ mutable struct ma57_ainfo{T} dup::Cint maxfrt::Cint stat::Cint - ispare::NTuple{5,Cint} - rspare::NTuple{10,T} + ispare::NTuple{5, Cint} + rspare::NTuple{10, T} - ma57_ainfo{T}() where T = new() + ma57_ainfo{T}() where {T} = new() - ma57_ainfo{T}(opsa, opse, flag, more, nsteps, nrltot, nirtot, nrlnec, nirnec, nrladu, niradu, ncmpa, ordering, oor, dup, maxfrt, stat, ispare, rspare) where T = new(opsa, opse, flag, more, nsteps, nrltot, nirtot, nrlnec, nirnec, nrladu, niradu, ncmpa, ordering, oor, dup, maxfrt, stat, ispare, rspare) + function ma57_ainfo{T}(opsa, opse, flag, more, nsteps, nrltot, nirtot, nrlnec, nirnec, nrladu, + niradu, ncmpa, ordering, oor, dup, maxfrt, stat, ispare, rspare) where {T} + return new(opsa, opse, flag, more, nsteps, nrltot, nirtot, nrlnec, nirnec, nrladu, niradu, + ncmpa, ordering, oor, dup, maxfrt, stat, ispare, rspare) + end end function ma57_analyse_s(n, ne, row, col, factors, control, ainfo, perm) @@ -100,18 +112,25 @@ mutable struct ma57_finfo{T} modstep::Cint rank::Cint stat::Cint - ispare::NTuple{5,Cint} - rspare::NTuple{10,T} + ispare::NTuple{5, Cint} + rspare::NTuple{10, T} - ma57_finfo{T}() where T = new() + ma57_finfo{T}() where {T} = new() - ma57_finfo{T}(opsa, opse, opsb, maxchange, smin, smax, flag, more, maxfrt, nebdu, nrlbdu, nirbdu, nrltot, nirtot, nrlnec, nirnec, ncmpbr, ncmpbi, ntwo, neig, delay, signc, static_, modstep, rank, stat, ispare, rspare) where T = new(opsa, opse, opsb, maxchange, smin, smax, flag, more, maxfrt, nebdu, nrlbdu, nirbdu, nrltot, nirtot, nrlnec, nirnec, ncmpbr, ncmpbi, ntwo, neig, delay, signc, static_, modstep, rank, stat, ispare, rspare) + function ma57_finfo{T}(opsa, opse, opsb, maxchange, smin, smax, flag, more, maxfrt, nebdu, nrlbdu, + nirbdu, nrltot, nirtot, nrlnec, nirnec, ncmpbr, ncmpbi, ntwo, neig, delay, + signc, static_, modstep, rank, stat, ispare, rspare) where {T} + return new(opsa, opse, opsb, maxchange, smin, smax, flag, more, maxfrt, nebdu, nrlbdu, nirbdu, + nrltot, nirtot, nrlnec, nirnec, ncmpbr, ncmpbi, ntwo, neig, delay, signc, static_, + modstep, rank, stat, ispare, rspare) + end end function ma57_factorize_s(n, ne, row, col, val, factors, control, finfo) @ccall libhsl.ma57_factorize_s(n::Cint, ne::Cint, row::Ptr{Cint}, col::Ptr{Cint}, val::Ptr{Float32}, factors::Ptr{Ptr{Cvoid}}, - control::Ref{ma57_control{Float32}}, finfo::Ref{ma57_finfo{Float32}})::Cvoid + control::Ref{ma57_control{Float32}}, + finfo::Ref{ma57_finfo{Float32}})::Cvoid end mutable struct ma57_sinfo{T} @@ -122,12 +141,14 @@ mutable struct ma57_sinfo{T} error::T flag::Cint stat::Cint - ispare::NTuple{5,Cint} - rspare::NTuple{10,T} + ispare::NTuple{5, Cint} + rspare::NTuple{10, T} - ma57_sinfo{T}() where T = new() + ma57_sinfo{T}() where {T} = new() - ma57_sinfo{T}(cond, cond2, berr, berr2, error, flag, stat, ispare, rspare) where T = new(cond, cond2, berr, berr2, error, flag, stat, ispare, rspare) + function ma57_sinfo{T}(cond, cond2, berr, berr2, error, flag, stat, ispare, rspare) where {T} + return new(cond, cond2, berr, berr2, error, flag, stat, ispare, rspare) + end end function ma57_solve_s(n, ne, row, col, val, factors, nrhs, x, control, sinfo, rhs, iter, cond) @@ -186,7 +207,8 @@ function ma57_sparse_lsolve_s(factors, control, nzrhs, irhs, nzsoln, isoln, x, s end function ma57_fredholm_alternative_s(factors, control, x, fredx, sinfo) - @ccall libhsl.ma57_fredholm_alternative_s(factors::Ptr{Ptr{Cvoid}}, control::Ref{ma57_control{Float32}}, + @ccall libhsl.ma57_fredholm_alternative_s(factors::Ptr{Ptr{Cvoid}}, + control::Ref{ma57_control{Float32}}, x::Ptr{Float32}, fredx::Ptr{Float32}, sinfo::Ref{ma57_sinfo{Float32}})::Cvoid end @@ -224,7 +246,8 @@ end function ma57_factorize_d(n, ne, row, col, val, factors, control, finfo) @ccall libhsl.ma57_factorize_d(n::Cint, ne::Cint, row::Ptr{Cint}, col::Ptr{Cint}, val::Ptr{Float64}, factors::Ptr{Ptr{Cvoid}}, - control::Ref{ma57_control{Float64}}, finfo::Ref{ma57_finfo{Float64}})::Cvoid + control::Ref{ma57_control{Float64}}, + finfo::Ref{ma57_finfo{Float64}})::Cvoid end function ma57_solve_d(n, ne, row, col, val, factors, nrhs, x, control, sinfo, rhs, iter, cond) @@ -283,7 +306,8 @@ function ma57_sparse_lsolve_d(factors, control, nzrhs, irhs, nzsoln, isoln, x, s end function ma57_fredholm_alternative_d(factors, control, x, fredx, sinfo) - @ccall libhsl.ma57_fredholm_alternative_d(factors::Ptr{Ptr{Cvoid}}, control::Ref{ma57_control{Float64}}, + @ccall libhsl.ma57_fredholm_alternative_d(factors::Ptr{Ptr{Cvoid}}, + control::Ref{ma57_control{Float64}}, x::Ptr{Float64}, fredx::Ptr{Float64}, sinfo::Ref{ma57_sinfo{Float64}})::Cvoid end diff --git a/src/C/hsl_ma77.jl b/src/C/hsl_ma77.jl index c27bba3..2e0fd98 100644 --- a/src/C/hsl_ma77.jl +++ b/src/C/hsl_ma77.jl @@ -5,11 +5,11 @@ mutable struct ma77_control{T} unit_error::Cint unit_warning::Cint bits::Cint - buffer_lpage::NTuple{2,Cint} - buffer_npage::NTuple{2,Cint} + buffer_lpage::NTuple{2, Cint} + buffer_npage::NTuple{2, Cint} file_size::Clong maxstore::Clong - storage::NTuple{3,Clong} + storage::NTuple{3, Clong} nemin::Cint maxit::Cint infnorm::Cint @@ -25,13 +25,21 @@ mutable struct ma77_control{T} u::T umin::T consist_tol::T - ispare::NTuple{5,Cint} - lspare::NTuple{5,Clong} - rspare::NTuple{5,T} + ispare::NTuple{5, Cint} + lspare::NTuple{5, Clong} + rspare::NTuple{5, T} - ma77_control{T}() where T = new() + ma77_control{T}() where {T} = new() - ma77_control{T}(f_arrays, print_level, unit_diagnostics, unit_error, unit_warning, bits, buffer_lpage, buffer_npage, file_size, maxstore, storage, nemin, maxit, infnorm, thresh, nb54, action, multiplier, nb64, nbi, small, static_, storage_indef, u, umin, consist_tol, ispare, lspare, rspare) where T = new(f_arrays, print_level, unit_diagnostics, unit_error, unit_warning, bits, buffer_lpage, buffer_npage, file_size, maxstore, storage, nemin, maxit, infnorm, thresh, nb54, action, multiplier, nb64, nbi, small, static_, storage_indef, u, umin, consist_tol, ispare, lspare, rspare) + function ma77_control{T}(f_arrays, print_level, unit_diagnostics, unit_error, unit_warning, bits, + buffer_lpage, buffer_npage, file_size, maxstore, storage, nemin, maxit, + infnorm, thresh, nb54, action, multiplier, nb64, nbi, small, static_, + storage_indef, u, umin, consist_tol, ispare, lspare, rspare) where {T} + return new(f_arrays, print_level, unit_diagnostics, unit_error, unit_warning, bits, + buffer_lpage, buffer_npage, file_size, maxstore, storage, nemin, maxit, infnorm, + thresh, nb54, action, multiplier, nb64, nbi, small, static_, storage_indef, u, umin, + consist_tol, ispare, lspare, rspare) + end end function ma77_default_control_s(control) @@ -59,24 +67,33 @@ mutable struct ma77_info{T} num_perturbed::Cint ntwo::Cint stat::Cint - index::NTuple{4,Cint} - nio_read::NTuple{2,Clong} - nio_write::NTuple{2,Clong} - nwd_read::NTuple{2,Clong} - nwd_write::NTuple{2,Clong} - num_file::NTuple{4,Cint} - storage::NTuple{4,Clong} + index::NTuple{4, Cint} + nio_read::NTuple{2, Clong} + nio_write::NTuple{2, Clong} + nwd_read::NTuple{2, Clong} + nwd_write::NTuple{2, Clong} + num_file::NTuple{4, Cint} + storage::NTuple{4, Clong} tree_nodes::Cint unit_restart::Cint unused::Cint usmall::T - ispare::NTuple{5,Cint} - lspare::NTuple{5,Clong} - rspare::NTuple{5,T} + ispare::NTuple{5, Cint} + lspare::NTuple{5, Clong} + rspare::NTuple{5, T} - ma77_info{T}() where T = new() + ma77_info{T}() where {T} = new() - ma77_info{T}(detlog, detsign, flag, iostat, matrix_dup, matrix_rank, matrix_outrange, maxdepth, maxfront, minstore, ndelay, nfactor, nflops, niter, nsup, num_neg, num_nothresh, num_perturbed, ntwo, stat, index, nio_read, nio_write, nwd_read, nwd_write, num_file, storage, tree_nodes, unit_restart, unused, usmall, ispare, lspare, rspare) where T = new(detlog, detsign, flag, iostat, matrix_dup, matrix_rank, matrix_outrange, maxdepth, maxfront, minstore, ndelay, nfactor, nflops, niter, nsup, num_neg, num_nothresh, num_perturbed, ntwo, stat, index, nio_read, nio_write, nwd_read, nwd_write, num_file, storage, tree_nodes, unit_restart, unused, usmall, ispare, lspare, rspare) + function ma77_info{T}(detlog, detsign, flag, iostat, matrix_dup, matrix_rank, matrix_outrange, + maxdepth, maxfront, minstore, ndelay, nfactor, nflops, niter, nsup, num_neg, + num_nothresh, num_perturbed, ntwo, stat, index, nio_read, nio_write, + nwd_read, nwd_write, num_file, storage, tree_nodes, unit_restart, unused, + usmall, ispare, lspare, rspare) where {T} + return new(detlog, detsign, flag, iostat, matrix_dup, matrix_rank, matrix_outrange, maxdepth, + maxfront, minstore, ndelay, nfactor, nflops, niter, nsup, num_neg, num_nothresh, + num_perturbed, ntwo, stat, index, nio_read, nio_write, nwd_read, nwd_write, num_file, + storage, tree_nodes, unit_restart, unused, usmall, ispare, lspare, rspare) + end end function ma77_open_nelt_s(n, fname1, fname2, fname3, fname4, keep, control, info, nelt) @@ -88,13 +105,15 @@ end function ma77_open_s(n, fname1, fname2, fname3, fname4, keep, control, info) @ccall libhsl.ma77_open_s(n::Cint, fname1::Cstring, fname2::Cstring, fname3::Cstring, - fname4::Cstring, keep::Ptr{Ptr{Cvoid}}, control::Ref{ma77_control{Float32}}, + fname4::Cstring, keep::Ptr{Ptr{Cvoid}}, + control::Ref{ma77_control{Float32}}, info::Ref{ma77_info{Float32}})::Cvoid end function ma77_input_vars_s(idx, nvar, list, keep, control, info) @ccall libhsl.ma77_input_vars_s(idx::Cint, nvar::Cint, list::Ptr{Cint}, keep::Ptr{Ptr{Cvoid}}, - control::Ref{ma77_control{Float32}}, info::Ref{ma77_info{Float32}})::Cvoid + control::Ref{ma77_control{Float32}}, + info::Ref{ma77_info{Float32}})::Cvoid end function ma77_input_reals_s(idx, length, reals, keep, control, info) @@ -105,17 +124,20 @@ end function ma77_analyse_s(order, keep, control, info) @ccall libhsl.ma77_analyse_s(order::Ptr{Cint}, keep::Ptr{Ptr{Cvoid}}, - control::Ref{ma77_control{Float32}}, info::Ref{ma77_info{Float32}})::Cvoid + control::Ref{ma77_control{Float32}}, + info::Ref{ma77_info{Float32}})::Cvoid end function ma77_factor_s(posdef, keep, control, info, scale) - @ccall libhsl.ma77_factor_s(posdef::Cint, keep::Ptr{Ptr{Cvoid}}, control::Ref{ma77_control{Float32}}, + @ccall libhsl.ma77_factor_s(posdef::Cint, keep::Ptr{Ptr{Cvoid}}, + control::Ref{ma77_control{Float32}}, info::Ref{ma77_info{Float32}}, scale::Ptr{Float32})::Cvoid end function ma77_factor_solve_s(posdef, keep, control, info, scale, nrhs, lx, rhs) @ccall libhsl.ma77_factor_solve_s(posdef::Cint, keep::Ptr{Ptr{Cvoid}}, - control::Ref{ma77_control{Float32}}, info::Ref{ma77_info{Float32}}, + control::Ref{ma77_control{Float32}}, + info::Ref{ma77_info{Float32}}, scale::Ptr{Float32}, nrhs::Cint, lx::Cint, rhs::Ptr{Float32})::Cvoid end @@ -141,7 +163,8 @@ end function ma77_enquire_posdef_s(d, keep, control, info) @ccall libhsl.ma77_enquire_posdef_s(d::Ptr{Float32}, keep::Ptr{Ptr{Cvoid}}, - control::Ref{ma77_control{Float32}}, info::Ref{ma77_info{Float32}})::Cvoid + control::Ref{ma77_control{Float32}}, + info::Ref{ma77_info{Float32}})::Cvoid end function ma77_enquire_indef_s(piv_order, d, keep, control, info) @@ -152,13 +175,15 @@ end function ma77_alter_s(d, keep, control, info) @ccall libhsl.ma77_alter_s(d::Ptr{Float32}, keep::Ptr{Ptr{Cvoid}}, - control::Ref{ma77_control{Float32}}, info::Ref{ma77_info{Float32}})::Cvoid + control::Ref{ma77_control{Float32}}, + info::Ref{ma77_info{Float32}})::Cvoid end function ma77_restart_s(restart_file, fname1, fname2, fname3, fname4, keep, control, info) @ccall libhsl.ma77_restart_s(restart_file::Cstring, fname1::Cstring, fname2::Cstring, fname3::Cstring, fname4::Cstring, keep::Ptr{Ptr{Cvoid}}, - control::Ref{ma77_control{Float32}}, info::Ref{ma77_info{Float32}})::Cvoid + control::Ref{ma77_control{Float32}}, + info::Ref{ma77_info{Float32}})::Cvoid end function ma77_finalise_s(keep, control, info) @@ -169,7 +194,8 @@ end function ma77_solve_fredholm_s(nrhs, flag_out, lx, x, keep, control, info, scale) @ccall libhsl.ma77_solve_fredholm_s(nrhs::Cint, flag_out::Ptr{Cint}, lx::Cint, x::Ptr{Float32}, keep::Ptr{Ptr{Cvoid}}, - control::Ref{ma77_control{Float32}}, info::Ref{ma77_info{Float32}}, + control::Ref{ma77_control{Float32}}, + info::Ref{ma77_info{Float32}}, scale::Ptr{Float32})::Cvoid end @@ -193,13 +219,15 @@ end function ma77_open_d(n, fname1, fname2, fname3, fname4, keep, control, info) @ccall libhsl.ma77_open_d(n::Cint, fname1::Cstring, fname2::Cstring, fname3::Cstring, - fname4::Cstring, keep::Ptr{Ptr{Cvoid}}, control::Ref{ma77_control{Float64}}, + fname4::Cstring, keep::Ptr{Ptr{Cvoid}}, + control::Ref{ma77_control{Float64}}, info::Ref{ma77_info{Float64}})::Cvoid end function ma77_input_vars_d(idx, nvar, list, keep, control, info) @ccall libhsl.ma77_input_vars_d(idx::Cint, nvar::Cint, list::Ptr{Cint}, keep::Ptr{Ptr{Cvoid}}, - control::Ref{ma77_control{Float64}}, info::Ref{ma77_info{Float64}})::Cvoid + control::Ref{ma77_control{Float64}}, + info::Ref{ma77_info{Float64}})::Cvoid end function ma77_input_reals_d(idx, length, reals, keep, control, info) @@ -210,17 +238,20 @@ end function ma77_analyse_d(order, keep, control, info) @ccall libhsl.ma77_analyse_d(order::Ptr{Cint}, keep::Ptr{Ptr{Cvoid}}, - control::Ref{ma77_control{Float64}}, info::Ref{ma77_info{Float64}})::Cvoid + control::Ref{ma77_control{Float64}}, + info::Ref{ma77_info{Float64}})::Cvoid end function ma77_factor_d(posdef, keep, control, info, scale) - @ccall libhsl.ma77_factor_d(posdef::Cint, keep::Ptr{Ptr{Cvoid}}, control::Ref{ma77_control{Float64}}, + @ccall libhsl.ma77_factor_d(posdef::Cint, keep::Ptr{Ptr{Cvoid}}, + control::Ref{ma77_control{Float64}}, info::Ref{ma77_info{Float64}}, scale::Ptr{Float64})::Cvoid end function ma77_factor_solve_d(posdef, keep, control, info, scale, nrhs, lx, rhs) @ccall libhsl.ma77_factor_solve_d(posdef::Cint, keep::Ptr{Ptr{Cvoid}}, - control::Ref{ma77_control{Float64}}, info::Ref{ma77_info{Float64}}, + control::Ref{ma77_control{Float64}}, + info::Ref{ma77_info{Float64}}, scale::Ptr{Float64}, nrhs::Cint, lx::Cint, rhs::Ptr{Float64})::Cvoid end @@ -246,7 +277,8 @@ end function ma77_enquire_posdef_d(d, keep, control, info) @ccall libhsl.ma77_enquire_posdef_d(d::Ptr{Float64}, keep::Ptr{Ptr{Cvoid}}, - control::Ref{ma77_control{Float64}}, info::Ref{ma77_info{Float64}})::Cvoid + control::Ref{ma77_control{Float64}}, + info::Ref{ma77_info{Float64}})::Cvoid end function ma77_enquire_indef_d(piv_order, d, keep, control, info) @@ -257,13 +289,15 @@ end function ma77_alter_d(d, keep, control, info) @ccall libhsl.ma77_alter_d(d::Ptr{Float64}, keep::Ptr{Ptr{Cvoid}}, - control::Ref{ma77_control{Float64}}, info::Ref{ma77_info{Float64}})::Cvoid + control::Ref{ma77_control{Float64}}, + info::Ref{ma77_info{Float64}})::Cvoid end function ma77_restart_d(restart_file, fname1, fname2, fname3, fname4, keep, control, info) @ccall libhsl.ma77_restart_d(restart_file::Cstring, fname1::Cstring, fname2::Cstring, fname3::Cstring, fname4::Cstring, keep::Ptr{Ptr{Cvoid}}, - control::Ref{ma77_control{Float64}}, info::Ref{ma77_info{Float64}})::Cvoid + control::Ref{ma77_control{Float64}}, + info::Ref{ma77_info{Float64}})::Cvoid end function ma77_finalise_d(keep, control, info) @@ -274,7 +308,8 @@ end function ma77_solve_fredholm_d(nrhs, flag_out, lx, x, keep, control, info, scale) @ccall libhsl.ma77_solve_fredholm_d(nrhs::Cint, flag_out::Ptr{Cint}, lx::Cint, x::Ptr{Float64}, keep::Ptr{Ptr{Cvoid}}, - control::Ref{ma77_control{Float64}}, info::Ref{ma77_info{Float64}}, + control::Ref{ma77_control{Float64}}, + info::Ref{ma77_info{Float64}}, scale::Ptr{Float64})::Cvoid end diff --git a/src/C/hsl_ma86.jl b/src/C/hsl_ma86.jl index 6a82793..da09a85 100644 --- a/src/C/hsl_ma86.jl +++ b/src/C/hsl_ma86.jl @@ -15,9 +15,14 @@ mutable struct ma86_control{T} umin::T scaling::Cint - ma86_control{T}() where T = new() + ma86_control{T}() where {T} = new() - ma86_control{T}(f_arrays, diagnostics_level, unit_diagnostics, unit_error, unit_warning, nemin, nb, action, nbi, pool_size, small_, static_, u, umin, scaling) where T = new(f_arrays, diagnostics_level, unit_diagnostics, unit_error, unit_warning, nemin, nb, action, nbi, pool_size, small_, static_, u, umin, scaling) + function ma86_control{T}(f_arrays, diagnostics_level, unit_diagnostics, unit_error, unit_warning, + nemin, nb, action, nbi, pool_size, small_, static_, u, umin, + scaling) where {T} + return new(f_arrays, diagnostics_level, unit_diagnostics, unit_error, unit_warning, nemin, nb, + action, nbi, pool_size, small_, static_, u, umin, scaling) + end end function ma86_default_control_s(control) @@ -42,9 +47,14 @@ mutable struct ma86_info{T} stat::Cint usmall::T - ma86_info{T}() where T = new() + ma86_info{T}() where {T} = new() - ma86_info{T}(detlog, detsign, flag, matrix_rank, maxdepth, num_delay, num_factor, num_flops, num_neg, num_nodes, num_nothresh, num_perturbed, num_two, pool_size, stat, usmall) where T = new(detlog, detsign, flag, matrix_rank, maxdepth, num_delay, num_factor, num_flops, num_neg, num_nodes, num_nothresh, num_perturbed, num_two, pool_size, stat, usmall) + function ma86_info{T}(detlog, detsign, flag, matrix_rank, maxdepth, num_delay, num_factor, + num_flops, num_neg, num_nodes, num_nothresh, num_perturbed, num_two, + pool_size, stat, usmall) where {T} + return new(detlog, detsign, flag, matrix_rank, maxdepth, num_delay, num_factor, num_flops, + num_neg, num_nodes, num_nothresh, num_perturbed, num_two, pool_size, stat, usmall) + end end function ma86_analyse_s(n, ptr, row, order, keep, control, info) @@ -55,7 +65,8 @@ end function ma86_factor_s(n, ptr, row, val, order, keep, control, info, scale) @ccall libhsl.ma86_factor_s(n::Cint, ptr::Ptr{Cint}, row::Ptr{Cint}, val::Ptr{Float32}, - order::Ptr{Cint}, keep::Ptr{Ptr{Cvoid}}, control::Ref{ma86_control{Float32}}, + order::Ptr{Cint}, keep::Ptr{Ptr{Cvoid}}, + control::Ref{ma86_control{Float32}}, info::Ref{ma86_info{Float32}}, scale::Ptr{Float32})::Cvoid end @@ -69,7 +80,8 @@ end function ma86_solve_s(job, nrhs, ldx, x, order, keep, control, info, scale) @ccall libhsl.ma86_solve_s(job::Cint, nrhs::Cint, ldx::Cint, x::Ptr{Float32}, - order::Ptr{Cint}, keep::Ptr{Ptr{Cvoid}}, control::Ref{ma86_control{Float32}}, + order::Ptr{Cint}, keep::Ptr{Ptr{Cvoid}}, + control::Ref{ma86_control{Float32}}, info::Ref{ma86_info{Float32}}, scale::Ptr{Float32})::Cvoid end @@ -89,7 +101,8 @@ end function ma86_factor_d(n, ptr, row, val, order, keep, control, info, scale) @ccall libhsl.ma86_factor_d(n::Cint, ptr::Ptr{Cint}, row::Ptr{Cint}, val::Ptr{Float64}, - order::Ptr{Cint}, keep::Ptr{Ptr{Cvoid}}, control::Ref{ma86_control{Float64}}, + order::Ptr{Cint}, keep::Ptr{Ptr{Cvoid}}, + control::Ref{ma86_control{Float64}}, info::Ref{ma86_info{Float64}}, scale::Ptr{Float64})::Cvoid end @@ -103,7 +116,8 @@ end function ma86_solve_d(job, nrhs, ldx, x, order, keep, control, info, scale) @ccall libhsl.ma86_solve_d(job::Cint, nrhs::Cint, ldx::Cint, x::Ptr{Float64}, - order::Ptr{Cint}, keep::Ptr{Ptr{Cvoid}}, control::Ref{ma86_control{Float64}}, + order::Ptr{Cint}, keep::Ptr{Ptr{Cvoid}}, + control::Ref{ma86_control{Float64}}, info::Ref{ma86_info{Float64}}, scale::Ptr{Float64})::Cvoid end @@ -139,7 +153,8 @@ end function ma86_solve_c(job, nrhs, ldx, x, order, keep, control, info, scale) @ccall libhsl.ma86_solve_c(job::Cint, nrhs::Cint, ldx::Cint, x::Ptr{ComplexF32}, - order::Ptr{Cint}, keep::Ptr{Ptr{Cvoid}}, control::Ref{ma86_control{Float32}}, + order::Ptr{Cint}, keep::Ptr{Ptr{Cvoid}}, + control::Ref{ma86_control{Float32}}, info::Ref{ma86_info{Float32}}, scale::Ptr{Float32})::Cvoid end @@ -175,7 +190,8 @@ end function ma86_solve_z(job, nrhs, ldx, x, order, keep, control, info, scale) @ccall libhsl.ma86_solve_z(job::Cint, nrhs::Cint, ldx::Cint, x::Ptr{ComplexF64}, - order::Ptr{Cint}, keep::Ptr{Ptr{Cvoid}}, control::Ref{ma86_control{Float64}}, + order::Ptr{Cint}, keep::Ptr{Ptr{Cvoid}}, + control::Ref{ma86_control{Float64}}, info::Ref{ma86_info{Float64}}, scale::Ptr{Float64})::Cvoid end diff --git a/src/C/hsl_ma87.jl b/src/C/hsl_ma87.jl index 216f71c..b1a5de2 100644 --- a/src/C/hsl_ma87.jl +++ b/src/C/hsl_ma87.jl @@ -9,11 +9,15 @@ mutable struct ma87_control{T} pool_size::Cint diag_zero_minus::T diag_zero_plus::T - unused::NTuple{40,Cchar} + unused::NTuple{40, Cchar} - ma87_control{T}() where T = new() + ma87_control{T}() where {T} = new() - ma87_control{T}(f_arrays, diagnostics_level, unit_diagnostics, unit_error, unit_warning, nemin, nb, pool_size, diag_zero_minus, diag_zero_plus, unused) where T = new(f_arrays, diagnostics_level, unit_diagnostics, unit_error, unit_warning, nemin, nb, pool_size, diag_zero_minus, diag_zero_plus, unused) + function ma87_control{T}(f_arrays, diagnostics_level, unit_diagnostics, unit_error, unit_warning, + nemin, nb, pool_size, diag_zero_minus, diag_zero_plus, unused) where {T} + return new(f_arrays, diagnostics_level, unit_diagnostics, unit_error, unit_warning, nemin, nb, + pool_size, diag_zero_minus, diag_zero_plus, unused) + end end function ma87_default_control_s(control) @@ -30,11 +34,15 @@ mutable struct ma87_info{T} pool_size::Cint stat::Cint num_zero::Cint - unused::NTuple{40,Cchar} + unused::NTuple{40, Cchar} - ma87_info{T}() where T = new() + ma87_info{T}() where {T} = new() - ma87_info{T}(detlog, flag, maxdepth, num_factor, num_flops, num_nodes, pool_size, stat, num_zero, unused) where T = new(detlog, flag, maxdepth, num_factor, num_flops, num_nodes, pool_size, stat, num_zero, unused) + function ma87_info{T}(detlog, flag, maxdepth, num_factor, num_flops, num_nodes, pool_size, stat, + num_zero, unused) where {T} + return new(detlog, flag, maxdepth, num_factor, num_flops, num_nodes, pool_size, stat, num_zero, + unused) + end end function ma87_analyse_s(n, ptr, row, order, keep, control, info) @@ -45,7 +53,8 @@ end function ma87_factor_s(n, ptr, row, val, order, keep, control, info) @ccall libhsl.ma87_factor_s(n::Cint, ptr::Ptr{Cint}, row::Ptr{Cint}, val::Ptr{Float32}, - order::Ptr{Cint}, keep::Ptr{Ptr{Cvoid}}, control::Ref{ma87_control{Float32}}, + order::Ptr{Cint}, keep::Ptr{Ptr{Cvoid}}, + control::Ref{ma87_control{Float32}}, info::Ref{ma87_info{Float32}})::Cvoid end @@ -59,7 +68,8 @@ end function ma87_solve_s(job, nrhs, ldx, x, order, keep, control, info) @ccall libhsl.ma87_solve_s(job::Cint, nrhs::Cint, ldx::Cint, x::Ptr{Float32}, - order::Ptr{Cint}, keep::Ptr{Ptr{Cvoid}}, control::Ref{ma87_control{Float32}}, + order::Ptr{Cint}, keep::Ptr{Ptr{Cvoid}}, + control::Ref{ma87_control{Float32}}, info::Ref{ma87_info{Float32}})::Cvoid end @@ -68,7 +78,8 @@ function ma87_sparse_fwd_solve_s(nbi, bindex, b, order, invp, nxi, index, x, w, order::Ptr{Cint}, invp::Ptr{Cint}, nxi::Ptr{Cint}, index::Ptr{Cint}, x::Ptr{Float32}, w::Ptr{Float32}, keep::Ptr{Ptr{Cvoid}}, - control::Ref{ma87_control{Float32}}, info::Ref{ma87_info{Float32}})::Cvoid + control::Ref{ma87_control{Float32}}, + info::Ref{ma87_info{Float32}})::Cvoid end function ma87_finalise_s(keep, control) @@ -87,7 +98,8 @@ end function ma87_factor_d(n, ptr, row, val, order, keep, control, info) @ccall libhsl.ma87_factor_d(n::Cint, ptr::Ptr{Cint}, row::Ptr{Cint}, val::Ptr{Float64}, - order::Ptr{Cint}, keep::Ptr{Ptr{Cvoid}}, control::Ref{ma87_control{Float64}}, + order::Ptr{Cint}, keep::Ptr{Ptr{Cvoid}}, + control::Ref{ma87_control{Float64}}, info::Ref{ma87_info{Float64}})::Cvoid end @@ -101,7 +113,8 @@ end function ma87_solve_d(job, nrhs, ldx, x, order, keep, control, info) @ccall libhsl.ma87_solve_d(job::Cint, nrhs::Cint, ldx::Cint, x::Ptr{Float64}, - order::Ptr{Cint}, keep::Ptr{Ptr{Cvoid}}, control::Ref{ma87_control{Float64}}, + order::Ptr{Cint}, keep::Ptr{Ptr{Cvoid}}, + control::Ref{ma87_control{Float64}}, info::Ref{ma87_info{Float64}})::Cvoid end @@ -110,7 +123,8 @@ function ma87_sparse_fwd_solve_d(nbi, bindex, b, order, invp, nxi, index, x, w, order::Ptr{Cint}, invp::Ptr{Cint}, nxi::Ptr{Cint}, index::Ptr{Cint}, x::Ptr{Float64}, w::Ptr{Float64}, keep::Ptr{Ptr{Cvoid}}, - control::Ref{ma87_control{Float64}}, info::Ref{ma87_info{Float64}})::Cvoid + control::Ref{ma87_control{Float64}}, + info::Ref{ma87_info{Float64}})::Cvoid end function ma87_finalise_d(keep, control) @@ -129,7 +143,8 @@ end function ma87_factor_c(n, ptr, row, val, order, keep, control, info) @ccall libhsl.ma87_factor_c(n::Cint, ptr::Ptr{Cint}, row::Ptr{Cint}, val::Ptr{ComplexF32}, - order::Ptr{Cint}, keep::Ptr{Ptr{Cvoid}}, control::Ref{ma87_control{Float32}}, + order::Ptr{Cint}, keep::Ptr{Ptr{Cvoid}}, + control::Ref{ma87_control{Float32}}, info::Ref{ma87_info{Float32}})::Cvoid end @@ -143,7 +158,8 @@ end function ma87_solve_c(job, nrhs, ldx, x, order, keep, control, info) @ccall libhsl.ma87_solve_c(job::Cint, nrhs::Cint, ldx::Cint, x::Ptr{ComplexF32}, - order::Ptr{Cint}, keep::Ptr{Ptr{Cvoid}}, control::Ref{ma87_control{Float32}}, + order::Ptr{Cint}, keep::Ptr{Ptr{Cvoid}}, + control::Ref{ma87_control{Float32}}, info::Ref{ma87_info{Float32}})::Cvoid end @@ -152,7 +168,8 @@ function ma87_sparse_fwd_solve_c(nbi, bindex, b, order, invp, nxi, index, x, w, order::Ptr{Cint}, invp::Ptr{Cint}, nxi::Ptr{Cint}, index::Ptr{Cint}, x::Ptr{ComplexF32}, w::Ptr{ComplexF32}, keep::Ptr{Ptr{Cvoid}}, - control::Ref{ma87_control{Float32}}, info::Ref{ma87_info{Float32}})::Cvoid + control::Ref{ma87_control{Float32}}, + info::Ref{ma87_info{Float32}})::Cvoid end function ma87_finalise_c(keep, control) @@ -171,7 +188,8 @@ end function ma87_factor_z(n, ptr, row, val, order, keep, control, info) @ccall libhsl.ma87_factor_z(n::Cint, ptr::Ptr{Cint}, row::Ptr{Cint}, val::Ptr{ComplexF64}, - order::Ptr{Cint}, keep::Ptr{Ptr{Cvoid}}, control::Ref{ma87_control{Float64}}, + order::Ptr{Cint}, keep::Ptr{Ptr{Cvoid}}, + control::Ref{ma87_control{Float64}}, info::Ref{ma87_info{Float64}})::Cvoid end @@ -185,7 +203,8 @@ end function ma87_solve_z(job, nrhs, ldx, x, order, keep, control, info) @ccall libhsl.ma87_solve_z(job::Cint, nrhs::Cint, ldx::Cint, x::Ptr{ComplexF64}, - order::Ptr{Cint}, keep::Ptr{Ptr{Cvoid}}, control::Ref{ma87_control{Float64}}, + order::Ptr{Cint}, keep::Ptr{Ptr{Cvoid}}, + control::Ref{ma87_control{Float64}}, info::Ref{ma87_info{Float64}})::Cvoid end @@ -194,7 +213,8 @@ function ma87_sparse_fwd_solve_z(nbi, bindex, b, order, invp, nxi, index, x, w, order::Ptr{Cint}, invp::Ptr{Cint}, nxi::Ptr{Cint}, index::Ptr{Cint}, x::Ptr{ComplexF64}, w::Ptr{ComplexF64}, keep::Ptr{Ptr{Cvoid}}, - control::Ref{ma87_control{Float64}}, info::Ref{ma87_info{Float64}})::Cvoid + control::Ref{ma87_control{Float64}}, + info::Ref{ma87_info{Float64}})::Cvoid end function ma87_finalise_z(keep, control) diff --git a/src/C/hsl_ma97.jl b/src/C/hsl_ma97.jl index f196fa0..9115f11 100644 --- a/src/C/hsl_ma97.jl +++ b/src/C/hsl_ma97.jl @@ -16,44 +16,18 @@ mutable struct ma97_control{T} solve_min::Clong solve_mf::Cint consist_tol::T - ispare::NTuple{5,Cint} - rspare::NTuple{10,T} - - """ - # Main control type for MA97. - - ma97_control{T}(; kwargs...) - - ## Keyword arguments: - - * `print_level::Int`: integer controling the verbosit level. Accepted values are: - * <0: no printing - * 0: errors and warnings only (default) - * 1: errors, warnings and basic diagnostics - * 2: errors, warning and full diagnostics - * `unit_diagnostics::Int`: Fortran file unit for diagnostics (default: 6) - * `unit_error::Int`: Fortran file unit for errors (default: 6) - * `unit_warning::Int`: Fortran file unit for warnings (default: 6) - """ - function ma97_control{T}(; - print_level::Int = -1, - unit_diagnostics::Int = 6, - unit_error::Int = 6, - unit_warning::Int = 6) where {T} - control = ma97_control{T}(0, 0, 0, 0.0, 0, 0, 0, 0.0, 0.0, 0, 0, 0, 0, 0, 0, 0, 0.0, ntuple(x -> Cint(0), 5), ntuple(x -> zero(T), 10)) - T == Float32 && ma97_default_control_s(control) - T == Float64 && ma97_default_control_d(control) - T == ComplexF32 && ma97_default_control_c(control) - T == ComplexF64 && ma97_default_control_z(control) - control.f_arrays = 1 # Use 1-based indexing for arrays, avoiding copies. - control.print_level = print_level - control.unit_diagnostics = unit_diagnostics - control.unit_error = unit_error - control.unit_warning = unit_warning - return control - end + ispare::NTuple{5, Cint} + rspare::NTuple{10, T} + + ma97_control{T}() where {T} = new() - ma97_control{T}(f_arrays, action, nemin, multiplier, ordering, print_level, scaling, small, u, unit_diagnostics, unit_error, unit_warning, factor_min, solve_blas3, solve_min, solve_mf, consist_tol, ispare, rspare) where T = new(f_arrays, action, nemin, multiplier, ordering, print_level, scaling, small, u, unit_diagnostics, unit_error, unit_warning, factor_min, solve_blas3, solve_min, solve_mf, consist_tol, ispare, rspare) + function ma97_control{T}(f_arrays, action, nemin, multiplier, ordering, print_level, scaling, + small, u, unit_diagnostics, unit_error, unit_warning, factor_min, + solve_blas3, solve_min, solve_mf, consist_tol, ispare, rspare) where {T} + return new(f_arrays, action, nemin, multiplier, ordering, print_level, scaling, small, u, + unit_diagnostics, unit_error, unit_warning, factor_min, solve_blas3, solve_min, + solve_mf, consist_tol, ispare, rspare) + end end function ma97_default_control_s(control) @@ -79,21 +53,19 @@ mutable struct ma97_info{T} ordering::Cint stat::Cint maxsupernode::Cint - ispare::NTuple{4,Cint} - rspare::NTuple{10,T} - - """ - # Main info type for MA97 - - info = ma97_info{T}() - - An `info` structure used to collect statistics on the analysis, factorization and solve. - """ - function ma97_info{T}() where {T} - return new(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, ntuple(x -> Cint(0), 4), ntuple(x -> zero(T), 10)) + ispare::NTuple{4, Cint} + rspare::NTuple{10, T} + + ma97_info{T}() where {T} = new() + + function ma97_info{T}(flag, flag68, flag77, matrix_dup, matrix_rank, matrix_outrange, + matrix_missing_diag, maxdepth, maxfront, num_delay, num_factor, num_flops, + num_neg, num_sup, num_two, ordering, stat, maxsupernode, ispare, + rspare) where {T} + return new(flag, flag68, flag77, matrix_dup, matrix_rank, matrix_outrange, matrix_missing_diag, + maxdepth, maxfront, num_delay, num_factor, num_flops, num_neg, num_sup, num_two, + ordering, stat, maxsupernode, ispare, rspare) end - - ma97_info{T}(flag, flag68, flag77, matrix_dup, matrix_rank, matrix_outrange, matrix_missing_diag, maxdepth, maxfront, num_delay, num_factor, num_flops, num_neg, num_sup, num_two, ordering, stat, maxsupernode, ispare, rspare) where T = new(flag, flag68, flag77, matrix_dup, matrix_rank, matrix_outrange, matrix_missing_diag, maxdepth, maxfront, num_delay, num_factor, num_flops, num_neg, num_sup, num_two, ordering, stat, maxsupernode, ispare, rspare) end function ma97_analyse_s(check, n, ptr, row, val, akeep, control, info, order) @@ -106,7 +78,8 @@ end function ma97_analyse_coord_s(n, ne, row, col, val, akeep, control, info, order) @ccall libhsl.ma97_analyse_coord_s(n::Cint, ne::Cint, row::Ptr{Cint}, col::Ptr{Cint}, val::Ptr{Float32}, akeep::Ptr{Ptr{Cvoid}}, - control::Ref{ma97_control{Float32}}, info::Ref{ma97_info{Float32}}, + control::Ref{ma97_control{Float32}}, + info::Ref{ma97_info{Float32}}, order::Ptr{Cint})::Cvoid end @@ -122,14 +95,16 @@ function ma97_factor_solve_s(matrix_type, ptr, row, val, nrhs, x, ldx, akeep, fk @ccall libhsl.ma97_factor_solve_s(matrix_type::Cint, ptr::Ptr{Cint}, row::Ptr{Cint}, val::Ptr{Float32}, nrhs::Cint, x::Ptr{Float32}, ldx::Cint, akeep::Ptr{Ptr{Cvoid}}, fkeep::Ptr{Ptr{Cvoid}}, - control::Ref{ma97_control{Float32}}, info::Ref{ma97_info{Float32}}, + control::Ref{ma97_control{Float32}}, + info::Ref{ma97_info{Float32}}, scale::Ptr{Float32})::Cvoid end function ma97_solve_s(job, nrhs, x, ldx, akeep, fkeep, control, info) @ccall libhsl.ma97_solve_s(job::Cint, nrhs::Cint, x::Ptr{Float32}, ldx::Cint, akeep::Ptr{Ptr{Cvoid}}, fkeep::Ptr{Ptr{Cvoid}}, - control::Ref{ma97_control{Float32}}, info::Ref{ma97_info{Float32}})::Cvoid + control::Ref{ma97_control{Float32}}, + info::Ref{ma97_info{Float32}})::Cvoid end function ma97_free_akeep_s(akeep) @@ -146,25 +121,29 @@ end function ma97_enquire_posdef_s(akeep, fkeep, control, info, d) @ccall libhsl.ma97_enquire_posdef_s(akeep::Ptr{Ptr{Cvoid}}, fkeep::Ptr{Ptr{Cvoid}}, - control::Ref{ma97_control{Float32}}, info::Ref{ma97_info{Float32}}, + control::Ref{ma97_control{Float32}}, + info::Ref{ma97_info{Float32}}, d::Ptr{Float32})::Cvoid end function ma97_enquire_indef_s(akeep, fkeep, control, info, piv_order, d) @ccall libhsl.ma97_enquire_indef_s(akeep::Ptr{Ptr{Cvoid}}, fkeep::Ptr{Ptr{Cvoid}}, - control::Ref{ma97_control{Float32}}, info::Ref{ma97_info{Float32}}, + control::Ref{ma97_control{Float32}}, + info::Ref{ma97_info{Float32}}, piv_order::Ptr{Cint}, d::Ptr{Float32})::Cvoid end function ma97_alter_s(d, akeep, fkeep, control, info) @ccall libhsl.ma97_alter_s(d::Ptr{Float32}, akeep::Ptr{Ptr{Cvoid}}, fkeep::Ptr{Ptr{Cvoid}}, - control::Ref{ma97_control{Float32}}, info::Ref{ma97_info{Float32}})::Cvoid + control::Ref{ma97_control{Float32}}, + info::Ref{ma97_info{Float32}})::Cvoid end function ma97_solve_fredholm_s(nrhs, flag_out, x, ldx, akeep, fkeep, control, info) @ccall libhsl.ma97_solve_fredholm_s(nrhs::Cint, flag_out::Ptr{Cint}, x::Ptr{Float32}, ldx::Cint, akeep::Ptr{Ptr{Cvoid}}, fkeep::Ptr{Ptr{Cvoid}}, - control::Ref{ma97_control{Float32}}, info::Ref{ma97_info{Float32}})::Cvoid + control::Ref{ma97_control{Float32}}, + info::Ref{ma97_info{Float32}})::Cvoid end function ma97_lmultiply_s(trans, k, x, ldx, y, ldy, akeep, fkeep, control, info) @@ -196,7 +175,8 @@ end function ma97_analyse_coord_d(n, ne, row, col, val, akeep, control, info, order) @ccall libhsl.ma97_analyse_coord_d(n::Cint, ne::Cint, row::Ptr{Cint}, col::Ptr{Cint}, val::Ptr{Float64}, akeep::Ptr{Ptr{Cvoid}}, - control::Ref{ma97_control{Float64}}, info::Ref{ma97_info{Float64}}, + control::Ref{ma97_control{Float64}}, + info::Ref{ma97_info{Float64}}, order::Ptr{Cint})::Cvoid end @@ -212,14 +192,16 @@ function ma97_factor_solve_d(matrix_type, ptr, row, val, nrhs, x, ldx, akeep, fk @ccall libhsl.ma97_factor_solve_d(matrix_type::Cint, ptr::Ptr{Cint}, row::Ptr{Cint}, val::Ptr{Float64}, nrhs::Cint, x::Ptr{Float64}, ldx::Cint, akeep::Ptr{Ptr{Cvoid}}, fkeep::Ptr{Ptr{Cvoid}}, - control::Ref{ma97_control{Float64}}, info::Ref{ma97_info{Float64}}, + control::Ref{ma97_control{Float64}}, + info::Ref{ma97_info{Float64}}, scale::Ptr{Float64})::Cvoid end function ma97_solve_d(job, nrhs, x, ldx, akeep, fkeep, control, info) @ccall libhsl.ma97_solve_d(job::Cint, nrhs::Cint, x::Ptr{Float64}, ldx::Cint, akeep::Ptr{Ptr{Cvoid}}, fkeep::Ptr{Ptr{Cvoid}}, - control::Ref{ma97_control{Float64}}, info::Ref{ma97_info{Float64}})::Cvoid + control::Ref{ma97_control{Float64}}, + info::Ref{ma97_info{Float64}})::Cvoid end function ma97_free_akeep_d(akeep) @@ -236,25 +218,29 @@ end function ma97_enquire_posdef_d(akeep, fkeep, control, info, d) @ccall libhsl.ma97_enquire_posdef_d(akeep::Ptr{Ptr{Cvoid}}, fkeep::Ptr{Ptr{Cvoid}}, - control::Ref{ma97_control{Float64}}, info::Ref{ma97_info{Float64}}, + control::Ref{ma97_control{Float64}}, + info::Ref{ma97_info{Float64}}, d::Ptr{Float64})::Cvoid end function ma97_enquire_indef_d(akeep, fkeep, control, info, piv_order, d) @ccall libhsl.ma97_enquire_indef_d(akeep::Ptr{Ptr{Cvoid}}, fkeep::Ptr{Ptr{Cvoid}}, - control::Ref{ma97_control{Float64}}, info::Ref{ma97_info{Float64}}, + control::Ref{ma97_control{Float64}}, + info::Ref{ma97_info{Float64}}, piv_order::Ptr{Cint}, d::Ptr{Float64})::Cvoid end function ma97_alter_d(d, akeep, fkeep, control, info) @ccall libhsl.ma97_alter_d(d::Ptr{Float64}, akeep::Ptr{Ptr{Cvoid}}, fkeep::Ptr{Ptr{Cvoid}}, - control::Ref{ma97_control{Float64}}, info::Ref{ma97_info{Float64}})::Cvoid + control::Ref{ma97_control{Float64}}, + info::Ref{ma97_info{Float64}})::Cvoid end function ma97_solve_fredholm_d(nrhs, flag_out, x, ldx, akeep, fkeep, control, info) @ccall libhsl.ma97_solve_fredholm_d(nrhs::Cint, flag_out::Ptr{Cint}, x::Ptr{Float64}, ldx::Cint, akeep::Ptr{Ptr{Cvoid}}, fkeep::Ptr{Ptr{Cvoid}}, - control::Ref{ma97_control{Float64}}, info::Ref{ma97_info{Float64}})::Cvoid + control::Ref{ma97_control{Float64}}, + info::Ref{ma97_info{Float64}})::Cvoid end function ma97_lmultiply_d(trans, k, x, ldx, y, ldy, akeep, fkeep, control, info) @@ -286,7 +272,8 @@ end function ma97_analyse_coord_c(n, ne, row, col, val, akeep, control, info, order) @ccall libhsl.ma97_analyse_coord_c(n::Cint, ne::Cint, row::Ptr{Cint}, col::Ptr{Cint}, val::Ptr{ComplexF32}, akeep::Ptr{Ptr{Cvoid}}, - control::Ref{ma97_control{Float32}}, info::Ref{ma97_info{Float32}}, + control::Ref{ma97_control{Float32}}, + info::Ref{ma97_info{Float32}}, order::Ptr{Cint})::Cvoid end @@ -302,14 +289,16 @@ function ma97_factor_solve_c(matrix_type, ptr, row, val, nrhs, x, ldx, akeep, fk @ccall libhsl.ma97_factor_solve_c(matrix_type::Cint, ptr::Ptr{Cint}, row::Ptr{Cint}, val::Ptr{ComplexF32}, nrhs::Cint, x::Ptr{ComplexF32}, ldx::Cint, akeep::Ptr{Ptr{Cvoid}}, fkeep::Ptr{Ptr{Cvoid}}, - control::Ref{ma97_control{Float32}}, info::Ref{ma97_info{Float32}}, + control::Ref{ma97_control{Float32}}, + info::Ref{ma97_info{Float32}}, scale::Ptr{Float32})::Cvoid end function ma97_solve_c(job, nrhs, x, ldx, akeep, fkeep, control, info) @ccall libhsl.ma97_solve_c(job::Cint, nrhs::Cint, x::Ptr{ComplexF32}, ldx::Cint, akeep::Ptr{Ptr{Cvoid}}, fkeep::Ptr{Ptr{Cvoid}}, - control::Ref{ma97_control{Float32}}, info::Ref{ma97_info{Float32}})::Cvoid + control::Ref{ma97_control{Float32}}, + info::Ref{ma97_info{Float32}})::Cvoid end function ma97_free_akeep_c(akeep) @@ -326,25 +315,29 @@ end function ma97_enquire_posdef_c(akeep, fkeep, control, info, d) @ccall libhsl.ma97_enquire_posdef_c(akeep::Ptr{Ptr{Cvoid}}, fkeep::Ptr{Ptr{Cvoid}}, - control::Ref{ma97_control{Float32}}, info::Ref{ma97_info{Float32}}, + control::Ref{ma97_control{Float32}}, + info::Ref{ma97_info{Float32}}, d::Ptr{Float32})::Cvoid end function ma97_enquire_indef_c(akeep, fkeep, control, info, piv_order, d) @ccall libhsl.ma97_enquire_indef_c(akeep::Ptr{Ptr{Cvoid}}, fkeep::Ptr{Ptr{Cvoid}}, - control::Ref{ma97_control{Float32}}, info::Ref{ma97_info{Float32}}, + control::Ref{ma97_control{Float32}}, + info::Ref{ma97_info{Float32}}, piv_order::Ptr{Cint}, d::Ptr{ComplexF32})::Cvoid end function ma97_alter_c(d, akeep, fkeep, control, info) @ccall libhsl.ma97_alter_c(d::Ptr{ComplexF32}, akeep::Ptr{Ptr{Cvoid}}, fkeep::Ptr{Ptr{Cvoid}}, - control::Ref{ma97_control{Float32}}, info::Ref{ma97_info{Float32}})::Cvoid + control::Ref{ma97_control{Float32}}, + info::Ref{ma97_info{Float32}})::Cvoid end function ma97_solve_fredholm_c(nrhs, flag_out, x, ldx, akeep, fkeep, control, info) @ccall libhsl.ma97_solve_fredholm_c(nrhs::Cint, flag_out::Ptr{Cint}, x::Ptr{ComplexF32}, ldx::Cint, akeep::Ptr{Ptr{Cvoid}}, fkeep::Ptr{Ptr{Cvoid}}, - control::Ref{ma97_control{Float32}}, info::Ref{ma97_info{Float32}})::Cvoid + control::Ref{ma97_control{Float32}}, + info::Ref{ma97_info{Float32}})::Cvoid end function ma97_lmultiply_c(trans, k, x, ldx, y, ldy, akeep, fkeep, control, info) @@ -376,7 +369,8 @@ end function ma97_analyse_coord_z(n, ne, row, col, val, akeep, control, info, order) @ccall libhsl.ma97_analyse_coord_z(n::Cint, ne::Cint, row::Ptr{Cint}, col::Ptr{Cint}, val::Ptr{ComplexF64}, akeep::Ptr{Ptr{Cvoid}}, - control::Ref{ma97_control{Float64}}, info::Ref{ma97_info{Float64}}, + control::Ref{ma97_control{Float64}}, + info::Ref{ma97_info{Float64}}, order::Ptr{Cint})::Cvoid end @@ -392,14 +386,16 @@ function ma97_factor_solve_z(matrix_type, ptr, row, val, nrhs, x, ldx, akeep, fk @ccall libhsl.ma97_factor_solve_z(matrix_type::Cint, ptr::Ptr{Cint}, row::Ptr{Cint}, val::Ptr{ComplexF64}, nrhs::Cint, x::Ptr{ComplexF64}, ldx::Cint, akeep::Ptr{Ptr{Cvoid}}, fkeep::Ptr{Ptr{Cvoid}}, - control::Ref{ma97_control{Float64}}, info::Ref{ma97_info{Float64}}, + control::Ref{ma97_control{Float64}}, + info::Ref{ma97_info{Float64}}, scale::Ptr{Float64})::Cvoid end function ma97_solve_z(job, nrhs, x, ldx, akeep, fkeep, control, info) @ccall libhsl.ma97_solve_z(job::Cint, nrhs::Cint, x::Ptr{ComplexF64}, ldx::Cint, akeep::Ptr{Ptr{Cvoid}}, fkeep::Ptr{Ptr{Cvoid}}, - control::Ref{ma97_control{Float64}}, info::Ref{ma97_info{Float64}})::Cvoid + control::Ref{ma97_control{Float64}}, + info::Ref{ma97_info{Float64}})::Cvoid end function ma97_free_akeep_z(akeep) @@ -416,25 +412,29 @@ end function ma97_enquire_posdef_z(akeep, fkeep, control, info, d) @ccall libhsl.ma97_enquire_posdef_z(akeep::Ptr{Ptr{Cvoid}}, fkeep::Ptr{Ptr{Cvoid}}, - control::Ref{ma97_control{Float64}}, info::Ref{ma97_info{Float64}}, + control::Ref{ma97_control{Float64}}, + info::Ref{ma97_info{Float64}}, d::Ptr{Float64})::Cvoid end function ma97_enquire_indef_z(akeep, fkeep, control, info, piv_order, d) @ccall libhsl.ma97_enquire_indef_z(akeep::Ptr{Ptr{Cvoid}}, fkeep::Ptr{Ptr{Cvoid}}, - control::Ref{ma97_control{Float64}}, info::Ref{ma97_info{Float64}}, + control::Ref{ma97_control{Float64}}, + info::Ref{ma97_info{Float64}}, piv_order::Ptr{Cint}, d::Ptr{ComplexF64})::Cvoid end function ma97_alter_z(d, akeep, fkeep, control, info) @ccall libhsl.ma97_alter_z(d::Ptr{ComplexF64}, akeep::Ptr{Ptr{Cvoid}}, fkeep::Ptr{Ptr{Cvoid}}, - control::Ref{ma97_control{Float64}}, info::Ref{ma97_info{Float64}})::Cvoid + control::Ref{ma97_control{Float64}}, + info::Ref{ma97_info{Float64}})::Cvoid end function ma97_solve_fredholm_z(nrhs, flag_out, x, ldx, akeep, fkeep, control, info) @ccall libhsl.ma97_solve_fredholm_z(nrhs::Cint, flag_out::Ptr{Cint}, x::Ptr{ComplexF64}, ldx::Cint, akeep::Ptr{Ptr{Cvoid}}, fkeep::Ptr{Ptr{Cvoid}}, - control::Ref{ma97_control{Float64}}, info::Ref{ma97_info{Float64}})::Cvoid + control::Ref{ma97_control{Float64}}, + info::Ref{ma97_info{Float64}})::Cvoid end function ma97_lmultiply_z(trans, k, x, ldx, y, ldy, akeep, fkeep, control, info) diff --git a/src/C/hsl_mc68.jl b/src/C/hsl_mc68.jl index f50bd0d..a0ed12d 100644 --- a/src/C/hsl_mc68.jl +++ b/src/C/hsl_mc68.jl @@ -12,7 +12,11 @@ mutable struct mc68_control mc68_control() = new() - mc68_control(f_array_in, f_array_out, min_l_workspace, lp, wp, mp, nemin, print_level, row_full_thresh, row_search) = new(f_array_in, f_array_out, min_l_workspace, lp, wp, mp, nemin, print_level, row_full_thresh, row_search) + function mc68_control(f_array_in, f_array_out, min_l_workspace, lp, wp, mp, nemin, print_level, + row_full_thresh, row_search) + return new(f_array_in, f_array_out, min_l_workspace, lp, wp, mp, nemin, print_level, + row_full_thresh, row_search) + end end function mc68_default_control_i(control) @@ -33,7 +37,11 @@ mutable struct mc68_info mc68_info() = new() - mc68_info(flag, iostat, stat, out_range, duplicate, n_compressions, n_zero_eigs, l_workspace, zb01_info, n_dense_rows) = new(flag, iostat, stat, out_range, duplicate, n_compressions, n_zero_eigs, l_workspace, zb01_info, n_dense_rows) + function mc68_info(flag, iostat, stat, out_range, duplicate, n_compressions, n_zero_eigs, + l_workspace, zb01_info, n_dense_rows) + return new(flag, iostat, stat, out_range, duplicate, n_compressions, n_zero_eigs, l_workspace, + zb01_info, n_dense_rows) + end end function mc68_order_i(ord, n, ptr, row, perm, control, info) diff --git a/src/C/hsl_mc78.jl b/src/C/hsl_mc78.jl index 1f423c6..8a43104 100644 --- a/src/C/hsl_mc78.jl +++ b/src/C/hsl_mc78.jl @@ -1,8 +1,8 @@ mutable struct mc78_control f_arrays::Cint heuristic::Cint - nrelax::NTuple{3,Cint} - zrelax::NTuple{3,Cdouble} + nrelax::NTuple{3, Cint} + zrelax::NTuple{3, Cdouble} nemin::Cint unit_error::Cint unit_warning::Cint @@ -13,7 +13,11 @@ mutable struct mc78_control mc78_control() = new() - mc78_control(f_arrays, heuristic, nrelax, zrelax, nemin, unit_error, unit_warning, ssa_abort, svar, sort, lopt) = new(f_arrays, heuristic, nrelax, zrelax, nemin, unit_error, unit_warning, ssa_abort, svar, sort, lopt) + function mc78_control(f_arrays, heuristic, nrelax, zrelax, nemin, unit_error, unit_warning, + ssa_abort, svar, sort, lopt) + return new(f_arrays, heuristic, nrelax, zrelax, nemin, unit_error, unit_warning, ssa_abort, + svar, sort, lopt) + end end function mc78_default_control_i(control) diff --git a/src/C/hsl_mc79.jl b/src/C/hsl_mc79.jl index 7b3a8fd..6eaf547 100644 --- a/src/C/hsl_mc79.jl +++ b/src/C/hsl_mc79.jl @@ -31,7 +31,9 @@ mutable struct mc79_info mc79_info() = new() - mc79_info(flag, hz_comps, vt_comps, sq_comps, m1, m2, m3, mbar, n1, n2, n3, nbar, stat) = new(flag, hz_comps, vt_comps, sq_comps, m1, m2, m3, mbar, n1, n2, n3, nbar, stat) + function mc79_info(flag, hz_comps, vt_comps, sq_comps, m1, m2, m3, mbar, n1, n2, n3, nbar, stat) + return new(flag, hz_comps, vt_comps, sq_comps, m1, m2, m3, mbar, n1, n2, n3, nbar, stat) + end end function mc79_matching_i(m, n, ptr, row, rowmatch, colmatch, control, info) diff --git a/src/C/hsl_mi20.jl b/src/C/hsl_mi20.jl index 30fd1e8..2b4f533 100644 --- a/src/C/hsl_mi20.jl +++ b/src/C/hsl_mi20.jl @@ -23,9 +23,18 @@ mutable struct mi20_control{T} error::Cint one_pass_coarsen::Cint - mi20_control{T}() where T = new() + mi20_control{T}() where {T} = new() - mi20_control{T}(f_arrays, aggressive, c_fail, max_levels, max_points, reduction, st_method, st_parameter, testing, trunc_parameter, coarse_solver, coarse_solver_its, damping, err_tol, levels, pre_smoothing, smoother, post_smoothing, v_iterations, print_level, print, error, one_pass_coarsen) where T = new(f_arrays, aggressive, c_fail, max_levels, max_points, reduction, st_method, st_parameter, testing, trunc_parameter, coarse_solver, coarse_solver_its, damping, err_tol, levels, pre_smoothing, smoother, post_smoothing, v_iterations, print_level, print, error, one_pass_coarsen) + function mi20_control{T}(f_arrays, aggressive, c_fail, max_levels, max_points, reduction, + st_method, st_parameter, testing, trunc_parameter, coarse_solver, + coarse_solver_its, damping, err_tol, levels, pre_smoothing, smoother, + post_smoothing, v_iterations, print_level, print, error, + one_pass_coarsen) where {T} + return new(f_arrays, aggressive, c_fail, max_levels, max_points, reduction, st_method, + st_parameter, testing, trunc_parameter, coarse_solver, coarse_solver_its, damping, + err_tol, levels, pre_smoothing, smoother, post_smoothing, v_iterations, print_level, + print, error, one_pass_coarsen) + end end function mi20_default_control_s(control) @@ -42,9 +51,13 @@ mutable struct mi20_solve_control{T} preconditioner_side::Cint rel_tol::T - mi20_solve_control{T}() where T = new() + mi20_solve_control{T}() where {T} = new() - mi20_solve_control{T}(abs_tol, breakdown_tol, gmres_restart, init_guess, krylov_solver, max_its, preconditioner_side, rel_tol) where T = new(abs_tol, breakdown_tol, gmres_restart, init_guess, krylov_solver, max_its, preconditioner_side, rel_tol) + function mi20_solve_control{T}(abs_tol, breakdown_tol, gmres_restart, init_guess, krylov_solver, + max_its, preconditioner_side, rel_tol) where {T} + return new(abs_tol, breakdown_tol, gmres_restart, init_guess, krylov_solver, max_its, + preconditioner_side, rel_tol) + end end function mi20_default_solve_control_s(solve_control) @@ -61,9 +74,12 @@ mutable struct mi20_info{T} iterations::Cint residual::T - mi20_info{T}() where T = new() + mi20_info{T}() where {T} = new() - mi20_info{T}(flag, clevels, cpoints, cnnz, stat, getrf_info, iterations, residual) where T = new(flag, clevels, cpoints, cnnz, stat, getrf_info, iterations, residual) + function mi20_info{T}(flag, clevels, cpoints, cnnz, stat, getrf_info, iterations, + residual) where {T} + return new(flag, clevels, cpoints, cnnz, stat, getrf_info, iterations, residual) + end end function mi20_setup_s(n, ptr, col, val, keep, control, info) @@ -87,7 +103,8 @@ end function mi20_setup_coord_s(n, ne, row, col, val, keep, control, info) @ccall libhsl.mi20_setup_coord_s(n::Cint, ne::Cint, row::Ptr{Cint}, col::Ptr{Cint}, val::Ptr{Float32}, keep::Ptr{Ptr{Cvoid}}, - control::Ref{mi20_control{Float32}}, info::Ref{mi20_info{Float32}})::Cvoid + control::Ref{mi20_control{Float32}}, + info::Ref{mi20_info{Float32}})::Cvoid end function mi20_finalize_s(keep, control, info) @@ -137,7 +154,8 @@ end function mi20_setup_coord_d(n, ne, row, col, val, keep, control, info) @ccall libhsl.mi20_setup_coord_d(n::Cint, ne::Cint, row::Ptr{Cint}, col::Ptr{Cint}, val::Ptr{Float64}, keep::Ptr{Ptr{Cvoid}}, - control::Ref{mi20_control{Float64}}, info::Ref{mi20_info{Float64}})::Cvoid + control::Ref{mi20_control{Float64}}, + info::Ref{mi20_info{Float64}})::Cvoid end function mi20_finalize_d(keep, control, info) diff --git a/src/C/hsl_mi28.jl b/src/C/hsl_mi28.jl index 79ec04d..5966c83 100644 --- a/src/C/hsl_mi28.jl +++ b/src/C/hsl_mi28.jl @@ -15,9 +15,14 @@ mutable struct mi28_control{T} unit_error::Cint unit_warning::Cint - mi28_control{T}() where T = new() + mi28_control{T}() where {T} = new() - mi28_control{T}(f_arrays, alpha, check, iorder, iscale, lowalpha, maxshift, rrt, shift_factor, shift_factor2, small, tau1, tau2, unit_error, unit_warning) where T = new(f_arrays, alpha, check, iorder, iscale, lowalpha, maxshift, rrt, shift_factor, shift_factor2, small, tau1, tau2, unit_error, unit_warning) + function mi28_control{T}(f_arrays, alpha, check, iorder, iscale, lowalpha, maxshift, rrt, + shift_factor, shift_factor2, small, tau1, tau2, unit_error, + unit_warning) where {T} + return new(f_arrays, alpha, check, iorder, iscale, lowalpha, maxshift, rrt, shift_factor, + shift_factor2, small, tau1, tau2, unit_error, unit_warning) + end end function mi28_default_control_s(control) @@ -42,9 +47,14 @@ mutable struct mi28_info{T} stat::Cint alpha::T - mi28_info{T}() where T = new() + mi28_info{T}() where {T} = new() - mi28_info{T}(band_after, band_before, dup, flag, flag61, flag64, flag68, flag77, nrestart, nshift, oor, profile_before, profile_after, size_r, stat, alpha) where T = new(band_after, band_before, dup, flag, flag61, flag64, flag68, flag77, nrestart, nshift, oor, profile_before, profile_after, size_r, stat, alpha) + function mi28_info{T}(band_after, band_before, dup, flag, flag61, flag64, flag68, flag77, + nrestart, nshift, oor, profile_before, profile_after, size_r, stat, + alpha) where {T} + return new(band_after, band_before, dup, flag, flag61, flag64, flag68, flag77, nrestart, nshift, + oor, profile_before, profile_after, size_r, stat, alpha) + end end function mi28_factorize_s(n, ptr, row, val, lsize, rsize, keep, control, info, scale, perm) diff --git a/src/Fortran/mi24.jl b/src/Fortran/mi24.jl index c58ad59..cc6bf6c 100644 --- a/src/Fortran/mi24.jl +++ b/src/Fortran/mi24.jl @@ -3,6 +3,11 @@ function mi24id(icntl, cntl, isave, rsave, lsave) lsave::Ptr{Cint})::Cvoid end +function mi24id_64(icntl, cntl, isave, rsave, lsave) + @ccall libhsl_subset_64.mi24id_64_(icntl::Ptr{Int64}, cntl::Ptr{Float64}, isave::Ptr{Int64}, + rsave::Ptr{Float64}, lsave::Ptr{Int64})::Cvoid +end + function mi24ad(iact, n, m, w, ldw, locy, locz, h, ldh, resid, icntl, cntl, info, isave, rsave, lsave) @ccall libhsl.mi24ad_(iact::Ref{Cint}, n::Ref{Cint}, m::Ref{Cint}, w::Ptr{Float64}, @@ -12,11 +17,26 @@ function mi24ad(iact, n, m, w, ldw, locy, locz, h, ldh, resid, icntl, cntl, info lsave::Ptr{Cint})::Cvoid end +function mi24ad_64(iact, n, m, w, ldw, locy, locz, h, ldh, resid, icntl, cntl, info, isave, rsave, + lsave) + @ccall libhsl_subset_64.mi24ad_64_(iact::Ref{Int64}, n::Ref{Int64}, m::Ref{Int64}, + w::Ptr{Float64}, ldw::Ref{Int64}, locy::Ref{Int64}, + locz::Ref{Int64}, h::Ptr{Float64}, ldh::Ref{Int64}, + resid::Ref{Float64}, icntl::Ptr{Int64}, cntl::Ptr{Float64}, + info::Ptr{Int64}, isave::Ptr{Int64}, rsave::Ptr{Float64}, + lsave::Ptr{Int64})::Cvoid +end + function mi24i(icntl, cntl, isave, rsave, lsave) @ccall libhsl.mi24i_(icntl::Ptr{Cint}, cntl::Ptr{Float32}, isave::Ptr{Cint}, rsave::Ptr{Float32}, lsave::Ptr{Cint})::Cvoid end +function mi24i_64(icntl, cntl, isave, rsave, lsave) + @ccall libhsl_subset_64.mi24i_64_(icntl::Ptr{Int64}, cntl::Ptr{Float32}, isave::Ptr{Int64}, + rsave::Ptr{Float32}, lsave::Ptr{Int64})::Cvoid +end + function mi24a(iact, n, m, w, ldw, locy, locz, h, ldh, resid, icntl, cntl, info, isave, rsave, lsave) @ccall libhsl.mi24a_(iact::Ref{Cint}, n::Ref{Cint}, m::Ref{Cint}, w::Ptr{Float32}, ldw::Ref{Cint}, @@ -24,3 +44,13 @@ function mi24a(iact, n, m, w, ldw, locy, locz, h, ldh, resid, icntl, cntl, info, resid::Ref{Float32}, icntl::Ptr{Cint}, cntl::Ptr{Float32}, info::Ptr{Cint}, isave::Ptr{Cint}, rsave::Ptr{Float32}, lsave::Ptr{Cint})::Cvoid end + +function mi24a_64(iact, n, m, w, ldw, locy, locz, h, ldh, resid, icntl, cntl, info, isave, rsave, + lsave) + @ccall libhsl_subset_64.mi24a_64_(iact::Ref{Int64}, n::Ref{Int64}, m::Ref{Int64}, w::Ptr{Float32}, + ldw::Ref{Int64}, locy::Ref{Int64}, locz::Ref{Int64}, + h::Ptr{Float32}, ldh::Ref{Int64}, resid::Ref{Float32}, + icntl::Ptr{Int64}, cntl::Ptr{Float32}, info::Ptr{Int64}, + isave::Ptr{Int64}, rsave::Ptr{Float32}, + lsave::Ptr{Int64})::Cvoid +end diff --git a/test/Jenkinsfile b/test/Jenkinsfile deleted file mode 100644 index 1a2469a..0000000 --- a/test/Jenkinsfile +++ /dev/null @@ -1,83 +0,0 @@ -def prNumber = BRANCH_NAME.tokenize("PR-")[0] -def runTestPath = "BenchmarkSetup/test/run_tests.sh" -def pattern = "[a-zA-Z0-9]+?.jl" -def repoName = (CHANGE_URL =~ pattern)[0] -def token = repoName.tokenize(".")[0] -pipeline { - agent any - options { - skipDefaultCheckout false - } - triggers { - GenericTrigger( - genericVariables: [ - [ - key: 'org', - value: '$.organization.login', - expressionType: 'JSONPath', //Optional, defaults to JSONPath - regexpFilter: '', //Optional, defaults to empty string - defaultValue: '' //Optional, defaults to empty string - ], - [ - key: 'pullrequest', - value: '$.pull_request.number', - expressionType: 'JSONPath', //Optional, defaults to JSONPath - regexpFilter: '', //Optional, defaults to empty string - defaultValue: '$prNumber' //Optional, defaults to empty string - ], - [ - key: 'repo', - value: '$.repository.name', - expressionType: 'JSONPath', //Optional, defaults to JSONPath - regexpFilter: '', //Optional, defaults to empty string - defaultValue: '' //Optional, defaults to empty string - ] - ], - - causeString: 'Triggered on pullrequest update/creation', - - token: "$token", - - printContributedVariables: true, - printPostContent: true, - - silentResponse: false, - - regexpFilterText: '$pullrequest', - regexpFilterExpression: prNumber - ) - } - stages { - stage('clone Setup') { - when { - expression { env.repo && env.org && env.pullrequest } - } - steps { - sh "git clone ${JENKINS_SETUP_URL} || true" - } - } - stage('run tests') { - when { - expression { env.repo && env.org && env.pullrequest } - } - steps { - script { - if (fileExists('test/run_tests.sh')) { - runTestPath = 'test/run_tests.sh'; - } - } - sh "chmod +x ${runTestPath}" - sh "mkdir -p $HOME/tests/${org}/${repo}" - sh "qsub -N ${repo}_${pullrequest}_test -V -cwd -e $HOME/tests/${org}/${repo}/${pullrequest}_${BUILD_NUMBER}_error.log ${runTestPath}" - } - } - } - post { - success { - echo "SUCCESS!" - } - cleanup { - sh 'printenv' - } - } -} diff --git a/test/run_tests.sh b/test/run_tests.sh deleted file mode 100644 index a7f7d7c..0000000 --- a/test/run_tests.sh +++ /dev/null @@ -1,13 +0,0 @@ -#!/bin/bash - -. $HOME/.bash_profile - -# clean up any potential previous build -rm -rf deps/usr -rm -f deps/build.log deps/deps.jl - -# Specify the module to test (e.g "HSL") -julia -E 'using Pkg; module_name = "HSL"; Pkg.activate("test_env"); Pkg.develop(PackageSpec(url=joinpath("."))); Pkg.build(module_name); Pkg.test(module_name)' &> "$org"_"$repo"_"$pullrequest".txt - -# Create the gist and create comment on PR: -julia test/send_gist_url.jl diff --git a/test/send_gist_url.jl b/test/send_gist_url.jl deleted file mode 100644 index f08f36f..0000000 --- a/test/send_gist_url.jl +++ /dev/null @@ -1,76 +0,0 @@ -using Pkg -Pkg.activate(joinpath("test_env")) -Pkg.add("GitHub") -Pkg.instantiate() - -using GitHub - -ORG, REPO, PR = ENV["org"], ENV["repo"], ENV["pullrequest"] -TEST_RESULTS_FILE = "$(ORG)_$(REPO)_$(PR).txt" -LOG_FILE = joinpath("deps", "build.log") - -# Need to add GITHUB_AUTH to your .bashrc -myauth = GitHub.authenticate(ENV["GITHUB_AUTH"]) - -function create_gist(authentication) - file_content = read(TEST_RESULTS_FILE, String) - log_content = read(LOG_FILE, String) - - file_dict = Dict( - TEST_RESULTS_FILE => Dict("content" => file_content), - "build.log" => Dict("content" => log_content), - ) - gist = Dict{String, Any}("description" => "Test results", "public" => true, "files" => file_dict) - - posted_gist = GitHub.create_gist(params = gist, auth = authentication) - - return posted_gist -end - -function post_gist_url_to_pr(comment::String; kwargs...) - api = GitHub.DEFAULT_API - repo = get_repo(api, ORG, REPO; kwargs...) - pull_request = get_pull_request(api, ORG, repo, parse(Int, PR); kwargs...) - GitHub.create_comment(api, repo, pull_request, comment; kwargs...) -end - -function get_repo(api::GitHub.GitHubWebAPI, org::String, repo_name::String; kwargs...) - my_params = Dict(:visibility => "all") - # return GitHub.repo(api, repo; params = my_params, kwargs...) - return Repo(GitHub.gh_get_json(api, "/repos/$(org)/$(repo_name)"; params = my_params, kwargs...)) -end - -function get_pull_request( - api::GitHub.GitHubWebAPI, - org::String, - repo::Repo, - pullrequest_id; - kwargs..., -) - my_params = Dict(:sort => "popularity", :direction => "desc") - pull_request = PullRequest( - GitHub.gh_get_json( - api, - "/repos/$(org)/$(repo.name)/pulls/$(pullrequest_id)"; - params = my_params, - kwargs..., - ), - ) - - return pull_request -end - -function get_comment_from_test_results() - open(TEST_RESULTS_FILE, "r") do file - text_to_match = r"tests passed" - for line in readlines(file) - if occursin(text_to_match, line) - return "$(strip(line)): " - end - end - return "Tests failed: " - end -end - -comment = get_comment_from_test_results() -post_gist_url_to_pr("$comment $(create_gist(myauth).html_url)"; auth = myauth)