Skip to content

Commit 63d1e44

Browse files
authored
Do not fill-in with integer in mutli-precision tests (#111)
1 parent 3409ae7 commit 63d1e44

File tree

2 files changed

+23
-23
lines changed

2 files changed

+23
-23
lines changed

src/nlp/multiple-precision.jl

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,8 @@ function multiple_precision_nlp(
4646
for T in precisions
4747
nlp = nlp_from_T(T)
4848
S = typeof(nlp.meta.x0)
49-
x = fill!(S(undef, nlp.meta.nvar), 1)
50-
v = fill!(S(undef, nlp.meta.nvar), 2)
49+
x = fill!(S(undef, nlp.meta.nvar), T(1))
50+
v = fill!(S(undef, nlp.meta.nvar), T(2))
5151
@test obj exclude || typeof(obj(nlp, x)) == T
5252
@test grad exclude || typeof(grad(nlp, x)) == S
5353
@test hess exclude || eltype(hess(nlp, x)) == T
@@ -57,11 +57,11 @@ function multiple_precision_nlp(
5757
rows, cols = hess_structure(nlp)
5858
vals = hess_coord(nlp, x)
5959
@test typeof(vals) == S
60-
Hv = fill!(S(undef, nlp.meta.nvar), 1)
60+
Hv = fill!(S(undef, nlp.meta.nvar), T(1))
6161
@test eltype(hess_op!(nlp, rows, cols, vals, Hv)) == T
6262
end
6363
if nlp.meta.ncon > 0
64-
y = fill!(S(undef, nlp.meta.ncon), 1)
64+
y = fill!(S(undef, nlp.meta.ncon), T(1))
6565
@test cons exclude || typeof(cons(nlp, x)) == S
6666
@test jac exclude || eltype(jac(nlp, x)) == T
6767
@test jac_op exclude || eltype(jac_op(nlp, x)) == T
@@ -81,23 +81,23 @@ function multiple_precision_nlp(
8181
rows, cols = jac_structure(nlp)
8282
vals = jac_coord(nlp, x)
8383
@test typeof(vals) == S
84-
Av = fill!(S(undef, nlp.meta.ncon), 0)
85-
Atv = fill!(S(undef, nlp.meta.nvar), 0)
84+
Av = fill!(S(undef, nlp.meta.ncon), T(0))
85+
Atv = fill!(S(undef, nlp.meta.nvar), T(0))
8686
@test eltype(jac_op!(nlp, rows, cols, vals, Av, Atv)) == T
8787
if linear_api && nlp.meta.nnln > 0
8888
rows, cols = jac_nln_structure(nlp)
8989
vals = jac_nln_coord(nlp, x)
9090
@test typeof(vals) == S
91-
Av = fill!(S(undef, nlp.meta.nnln), 0)
92-
Atv = fill!(S(undef, nlp.meta.nvar), 0)
91+
Av = fill!(S(undef, nlp.meta.nnln), T(0))
92+
Atv = fill!(S(undef, nlp.meta.nvar), T(0))
9393
@test eltype(jac_nln_op!(nlp, rows, cols, vals, Av, Atv)) == T
9494
end
9595
if linear_api && nlp.meta.nlin > 0
9696
rows, cols = jac_lin_structure(nlp)
9797
vals = jac_lin_coord(nlp, x)
9898
@test typeof(vals) == S
99-
Av = fill!(S(undef, nlp.meta.nlin), 0)
100-
Atv = fill!(S(undef, nlp.meta.nvar), 0)
99+
Av = fill!(S(undef, nlp.meta.nlin), T(0))
100+
Atv = fill!(S(undef, nlp.meta.nvar), T(0))
101101
@test eltype(jac_lin_op!(nlp, rows, cols, vals, Av, Atv)) == T
102102
end
103103
end
@@ -109,7 +109,7 @@ function multiple_precision_nlp(
109109
rows, cols = hess_structure(nlp)
110110
vals = hess_coord(nlp, x, y)
111111
@test typeof(vals) == S
112-
Hv = fill!(S(undef, nlp.meta.nvar), 0)
112+
Hv = fill!(S(undef, nlp.meta.nvar), T(0))
113113
@test eltype(hess_op!(nlp, rows, cols, vals, Hv)) == T
114114
end
115115
@test jth_hess exclude || eltype(jth_hess(nlp, x, 1)) == T

src/nls/multiple-precision.jl

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -46,10 +46,10 @@ function multiple_precision_nls(
4646
for T in precisions
4747
nls = nls_from_T(T)
4848
S = typeof(nls.meta.x0)
49-
x = fill!(S(undef, nls.meta.nvar), 1)
50-
v = fill!(S(undef, nls.meta.nvar), 2)
51-
y = fill!(S(undef, nls.meta.ncon), 2)
52-
w = fill!(S(undef, nls.nls_meta.nequ), 2)
49+
x = fill!(S(undef, nls.meta.nvar), T(1))
50+
v = fill!(S(undef, nls.meta.nvar), T(2))
51+
y = fill!(S(undef, nls.meta.ncon), T(2))
52+
w = fill!(S(undef, nls.nls_meta.nequ), T(2))
5353
@test residual exclude || typeof(residual(nls, x)) == S
5454
@test jac_residual exclude || eltype(jac_residual(nls, x)) == T
5555
@test jac_op_residual exclude || eltype(jac_op_residual(nls, x)) == T
@@ -59,8 +59,8 @@ function multiple_precision_nls(
5959
rows, cols = jac_structure_residual(nls)
6060
vals = jac_coord_residual(nls, x)
6161
@test typeof(vals) == S
62-
Av = fill!(S(undef, nls.nls_meta.nequ), 0)
63-
Atv = fill!(S(undef, nls.meta.nvar), 0)
62+
Av = fill!(S(undef, nls.nls_meta.nequ), T(0))
63+
Atv = fill!(S(undef, nls.meta.nvar), T(0))
6464
@test eltype(jac_op_residual!(nls, rows, cols, vals, Av, Atv)) == T
6565
end
6666
@test hess_residual exclude || eltype(hess_residual(nls, x, ones(T, nls.nls_meta.nequ))) == T
@@ -94,25 +94,25 @@ function multiple_precision_nls(
9494
rows, cols = jac_structure(nls)
9595
vals = jac_coord(nls, x)
9696
@test typeof(vals) == S
97-
Av = fill!(S(undef, nls.meta.ncon), 0)
98-
Atv = fill!(S(undef, nls.meta.nvar), 0)
97+
Av = fill!(S(undef, nls.meta.ncon), T(0))
98+
Atv = fill!(S(undef, nls.meta.nvar), T(0))
9999
@test eltype(jac_op!(nls, rows, cols, vals, Av, Atv)) == T
100100
@test jprod exclude || typeof(jprod(nls, x, v)) == S
101101
@test jtprod exclude || typeof(jtprod(nls, x, y)) == S
102102
if linear_api && nls.meta.nnln > 0
103103
rows, cols = jac_nln_structure(nls)
104104
vals = jac_nln_coord(nls, x)
105105
@test typeof(vals) == S
106-
Av = fill!(S(undef, nls.meta.nnln), 0)
107-
Atv = fill!(S(undef, nls.meta.nvar), 0)
106+
Av = fill!(S(undef, nls.meta.nnln), T(0))
107+
Atv = fill!(S(undef, nls.meta.nvar), T(0))
108108
@test eltype(jac_nln_op!(nls, rows, cols, vals, Av, Atv)) == T
109109
end
110110
if linear_api && nls.meta.nlin > 0
111111
rows, cols = jac_lin_structure(nls)
112112
vals = jac_lin_coord(nls, x)
113113
@test typeof(vals) == S
114-
Av = fill!(S(undef, nls.meta.nlin), 0)
115-
Atv = fill!(S(undef, nls.meta.nvar), 0)
114+
Av = fill!(S(undef, nls.meta.nlin), T(0))
115+
Atv = fill!(S(undef, nls.meta.nvar), T(0))
116116
@test eltype(jac_lin_op!(nls, rows, cols, vals, Av, Atv)) == T
117117
end
118118
end

0 commit comments

Comments
 (0)