Skip to content

Commit 5a4a9ca

Browse files
abelsiqueiradpo
authored andcommitted
Fix random error testing BFGS data.insert
1 parent b479229 commit 5a4a9ca

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

test/test_lbfgs.jl

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ for t = 1:2 # Run again after reset!
2424
push!(H, s, z); @assert H.data.insert == 1
2525

2626
# Insert a few {s,y} pairs.
27-
insert = 1
27+
insert = 0
2828
for i = 1 : mem+2
2929
s = rand(n)
3030
y = rand(n)
@@ -35,8 +35,8 @@ for t = 1:2 # Run again after reset!
3535
end
3636
end
3737

38-
@assert B.data.insert == mod(insert, B.data.mem)
39-
@assert H.data.insert == mod(insert, H.data.mem)
38+
@assert B.data.insert == mod(insert, B.data.mem) + 1
39+
@assert H.data.insert == mod(insert, H.data.mem) + 1
4040

4141
@test check_positive_definite(B)
4242
@test check_positive_definite(H)
@@ -90,7 +90,7 @@ end
9090
B = LBFGSOperator(n, mem, damped=true)
9191
H = InverseLBFGSOperator(n, mem, damped=true)
9292

93-
insert_B = insert_H = 1
93+
insert_B = insert_H = 0
9494
for i = 1 : mem+2
9595
s = rand(n)
9696
y = rand(n)
@@ -103,8 +103,8 @@ for i = 1 : mem+2
103103
end
104104
end
105105

106-
@assert B.data.insert == mod(insert_B, B.data.mem)
107-
@assert H.data.insert == mod(insert_H, H.data.mem)
106+
@assert B.data.insert == mod(insert_B, B.data.mem) + 1
107+
@assert H.data.insert == mod(insert_H, H.data.mem) + 1
108108

109109
@test check_positive_definite(B)
110110
@test check_positive_definite(H)

0 commit comments

Comments
 (0)