Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
amontoison committed Feb 12, 2024
1 parent cfb52e4 commit ea461b2
Show file tree
Hide file tree
Showing 15 changed files with 3,392 additions and 982 deletions.
17 changes: 17 additions & 0 deletions GALAHAD.jl/gen/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -108,3 +108,20 @@ include("wrappers/abcd.jl")

Now, the Julia wrappers for the `abcd` package are accessible upon
loading the Julia interface with `using GALAHAD`.

# Tests

The file `examples.jl` help to generate Julia tests based on the C tests of a GALAHAD package.
- Create symbolic link
- Explain "tf", "t" or ""
- Call clean_example(...)

```julia
(name == "abcd") && examples("abcd", "tf")
```

To test the new package named `abcd`, insert the following line in `GALAHAD.jl/test/runtests.jl`:

```julia
include("test_abcd.jl")
```
17 changes: 12 additions & 5 deletions GALAHAD.jl/gen/examples.jl
Original file line number Diff line number Diff line change
Expand Up @@ -38,25 +38,28 @@ function examples(package::String, example::String)
text = replace(text, "} #" => "] #")
for var in ("A_val", "A_dense", "b", "c", "c_l", "c_u", "x_l", "x_u", "y_l", "y_u", "z_l", "z_u", "g", "x_0",
"w", "x", "y", "z", "val", "dense", "rhs", "rhst", "sol", "H_val", "H_dense", "C_val",
"C_dense", "H_diag", "C_diag", "H_scid", "C_scid", "Ao_val", "r")
"C_dense", "H_diag", "C_diag", "H_scid", "C_scid", "Ao_val", "r", "M_val", "M_dense",
"M_diag", "y", "W")
text = replace(text, "real_wp_ $var[] = {" => "$var = Float64[")
end
for var in ("f", "power", "weight", "shift", "radius", "half_radius", "x_l", "x_u", "sigma")
for var in ("f", "power", "weight", "shift", "radius", "half_radius", "x_l", "x_u", "sigma", "rho_g", "rho_b")
text = replace(text, "real_wp_ $var =" => "$var =")
end
for var in ("n", "ne", "m", "A_ne", "A_dense_ne", "H_ne", "H_dense_ne", "C_dense_ne",
"C_ne", "dense_ne", "o", "Ao_ne", "Ao_ptr_ne", "A_ptr_ne")
"C_ne", "dense_ne", "o", "Ao_ne", "Ao_ptr_ne", "A_ptr_ne", "m_equal",
"M_ne", "M_dense_ne", "j_ne", "h_ne", "p_ne")
text = replace(text, "int $var =" => "$var =")
end
for var in ("A_row", "A_col", "A_ptr", "row", "col", "ptr", "c_stat", "x_stat", "H_row", "H_col", "H_ptr",
"C_row", "C_col", "C_ptr", "Ao_col", "Ao_ptr", "Ao_row")
"C_row", "C_col", "C_ptr", "Ao_col", "Ao_ptr", "Ao_row", "M_row",
"M_col", "M_ptr", "J_row", "J_col", "J_ptr", "P_row", "P_ptr")
text = replace(text, "int $var[] = {" => "$var = Cint[")
end
for val in ("1", "3", "5", "6", "7", "n", "n+m")
text = replace(text, "for( int d=1 d <= $val d++){" => "for d = 1:$val")
text = replace(text, "for(int d=1 d <= $val d++){" => "for d = 1:$val")
end
for index in ("unit_m", "new_radius")
for index in ("unit_m", "new_radius", "a_is", "m_is")
text = replace(text, "for( int $index=0 $index <= 1 $index++){" => "for $index = 0:1")
text = replace(text, "for(int $index=0 $index <= 1 $index++){" => "for $index = 0:1")
end
Expand Down Expand Up @@ -109,6 +112,10 @@ function examples(package::String, example::String)
text = replace(text, "switch(d)\n" => "")
text = replace(text, "for(i=0 i<n i++)" => "for i = 1:n\n")
text = replace(text, "}\n" => "end\n")
for var in ("x", "u", "v", "hval", "g")
text = replace(text, "const real_wp_ $var[]" => "var::Vector{Float64}")
text = replace(text, "real_wp_ $var[]" => "$var::Vector{Float64}")
end
text = text * "end\n\n@testset \"" * uppercase(package) * "\" begin\n @test test_$package() == 0\nend\n"
write(dst, text)
(example == "") && clean_example(package)
Expand Down
18 changes: 9 additions & 9 deletions GALAHAD.jl/test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ include("test_bsc.jl")
include("test_ccqp.jl")
include("test_clls.jl")
include("test_convert.jl")
# include("test_cqp.jl")
# include("test_cro.jl")
include("test_cqp.jl")
include("test_cro.jl")
# include("test_dgo.jl")
include("test_dps.jl")
# include("test_dqp.jl")
Expand All @@ -36,11 +36,11 @@ include("test_lpb.jl")
include("test_lsqp.jl")
include("test_lsrt.jl")
include("test_lstr.jl")
# include("test_nls.jl")
## include("test_nls.jl")
include("test_presolve.jl")
include("test_psls.jl")
# include("test_qpa.jl")
# include("test_qpb.jl")
include("test_qpa.jl")
include("test_qpb.jl")
include("test_roots.jl")
# include("test_rpd.jl")
# include("test_rqs.jl")
Expand All @@ -49,11 +49,11 @@ include("test_sbls.jl")
include("test_sec.jl")
include("test_sha.jl")
include("test_sils.jl")
# include("test_slls.jl")
## include("test_slls.jl")
include("test_sls.jl")
# include("test_trb.jl")
# include("test_trs.jl")
# include("test_tru.jl")
## include("test_trs.jl")
## include("test_tru.jl")
include("test_ugo.jl")
# include("test_uls.jl")
include("test_uls.jl")
include("test_wcp.jl")
Loading

0 comments on commit ea461b2

Please sign in to comment.