Skip to content

Commit 174c648

Browse files
dpoabelsiqueira
authored andcommitted
update tests
1 parent 5de6b77 commit 174c648

File tree

2 files changed

+13
-12
lines changed

2 files changed

+13
-12
lines changed

test/test_lbfgs.jl

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ function test_lbfgs()
66
@testset ExtendedTestSet "LBFGS" begin
77
n = 10
88
mem = 5
9-
B = LBFGSOperator(n, mem, scaling=false)
10-
H = InverseLBFGSOperator(n, mem, scaling=false)
9+
B = LBFGSOperator(n, mem=mem, scaling=false)
10+
H = InverseLBFGSOperator(n, mem=mem, scaling=false)
1111

1212
for t = 1:2 # Run again after reset!
1313
@test norm(diag(B) - diag(Matrix(B))) <= rtol
@@ -64,7 +64,7 @@ function test_lbfgs()
6464

6565
# test against full BFGS without scaling
6666
mem = n
67-
LB = LBFGSOperator(n, mem, scaling=false)
67+
LB = LBFGSOperator(n, mem=mem, scaling=false)
6868
B = Matrix(1.0I, n, n)
6969

7070
function bfgs!(B, s, y, damped=false)
@@ -91,8 +91,8 @@ function test_lbfgs()
9191
end
9292

9393
# test damped L-BFGS
94-
B = LBFGSOperator(n, mem, damped=true, scaling=false, σ₂=0.8, σ₃=Inf)
95-
H = InverseLBFGSOperator(n, mem, damped=true, scaling=false, σ₂=0.8, σ₃=Inf)
94+
B = LBFGSOperator(n, mem=mem, damped=true, scaling=false, σ₂=0.8, σ₃=Inf)
95+
H = InverseLBFGSOperator(n, mem=mem, damped=true, scaling=false, σ₂=0.8, σ₃=Inf)
9696

9797
insert_B = insert_H = 0
9898
for i = 1 : mem+2
@@ -126,7 +126,7 @@ function test_lbfgs()
126126

127127
# test against full BFGS without scaling
128128
mem = n
129-
LB = LBFGSOperator(n, mem, damped=true, scaling=false)
129+
LB = LBFGSOperator(n, mem=mem, damped=true, scaling=false)
130130
B = Matrix(1.0I, n, n)
131131

132132
@test norm(Matrix(LB) - B) < rtol * norm(B)
@@ -146,8 +146,8 @@ function test_lbfgs()
146146
n = 10
147147
mem = 5
148148
for T in (Float16, Float32, Float64, BigFloat)
149-
B = LBFGSOperator(T, n, mem)
150-
H = InverseLBFGSOperator(T, n, mem)
149+
B = LBFGSOperator(T, n, mem=mem)
150+
H = InverseLBFGSOperator(T, n, mem=mem)
151151
s = ones(T, n)
152152
y = ones(T, n)
153153
push!(B, s, y)

test/test_lsr1.jl

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ function test_lsr1()
55
@testset ExtendedTestSet "LSR1" begin
66
n = 10
77
mem = 5
8-
B = LSR1Operator(n, mem, scaling=false)
8+
B = LSR1Operator(n, mem=mem, scaling=false)
99

1010
for t = 1:2
1111
@test norm(diag(B) - diag(Matrix(B))) <= rtol
@@ -16,7 +16,8 @@ function test_lsr1()
1616
# Test that only valid updates are accepted.
1717
s = simple_vector(Float64, n)
1818
y = B * s
19-
push!(B, s, y); @test B.data.insert == 1
19+
push!(B, s, y)
20+
@test B.data.insert == 1
2021

2122
# Insert a few {s,y} pairs.
2223
for i = 1 : mem+2
@@ -37,7 +38,7 @@ function test_lsr1()
3738

3839
# test against full SR1 without scaling
3940
mem = n
40-
LB = LSR1Operator(n, mem, scaling=false)
41+
LB = LSR1Operator(n, mem=mem, scaling=false)
4142
B = Matrix(1.0I, n, n)
4243

4344
function sr1!(B, s, y)
@@ -67,7 +68,7 @@ function test_lsr1()
6768
n = 10
6869
mem = 5
6970
for T in (Float16, Float32, Float64, BigFloat)
70-
B = LSR1Operator(T, n, mem)
71+
B = LSR1Operator(T, n, mem=mem)
7172
s = ones(T, n)
7273
y = ones(T, n)
7374
push!(B, s, y)

0 commit comments

Comments
 (0)