Skip to content

Commit

Permalink
Fix random error testing BFGS data.insert
Browse files Browse the repository at this point in the history
  • Loading branch information
abelsiqueira authored and dpo committed Sep 14, 2017
1 parent b479229 commit 5a4a9ca
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions test/test_lbfgs.jl
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ for t = 1:2 # Run again after reset!
push!(H, s, z); @assert H.data.insert == 1

# Insert a few {s,y} pairs.
insert = 1
insert = 0
for i = 1 : mem+2
s = rand(n)
y = rand(n)
Expand All @@ -35,8 +35,8 @@ for t = 1:2 # Run again after reset!
end
end

@assert B.data.insert == mod(insert, B.data.mem)
@assert H.data.insert == mod(insert, H.data.mem)
@assert B.data.insert == mod(insert, B.data.mem) + 1
@assert H.data.insert == mod(insert, H.data.mem) + 1

@test check_positive_definite(B)
@test check_positive_definite(H)
Expand Down Expand Up @@ -90,7 +90,7 @@ end
B = LBFGSOperator(n, mem, damped=true)
H = InverseLBFGSOperator(n, mem, damped=true)

insert_B = insert_H = 1
insert_B = insert_H = 0
for i = 1 : mem+2
s = rand(n)
y = rand(n)
Expand All @@ -103,8 +103,8 @@ for i = 1 : mem+2
end
end

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

@test check_positive_definite(B)
@test check_positive_definite(H)
Expand Down

0 comments on commit 5a4a9ca

Please sign in to comment.