Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .cirrus.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ task:
name: FreeBSD
env:
matrix:
- JULIA_VERSION: 1.0
- JULIA_VERSION: 1
- JULIA_VERSION: nightly
allow_failures: $JULIA_VERSION == 'nightly'
Expand Down
5 changes: 3 additions & 2 deletions Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,12 @@ TimerOutputs = "a759f4b9-e2f1-59dc-863e-4aeb61b1ea8f"
[compat]
FastClosures = "0.2, 0.3"
TimerOutputs = "^0.5"
julia = "^1.0.0"
julia = "^1.3.0"

[extras]
Arpack = "7d9fca2a-8960-54d3-9f78-7d1dccf2cb97"
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
TestSetExtensions = "98d24dd4-01ad-11ea-1b02-c9a08f80db04"

[targets]
test = ["Test", "TestSetExtensions"]
test = ["Arpack", "Test", "TestSetExtensions"]
7 changes: 7 additions & 0 deletions src/lbfgs.jl
Original file line number Diff line number Diff line change
Expand Up @@ -292,3 +292,10 @@ function reset!(op :: LBFGSOperator)
op.nctprod = 0
return op
end

# define mul! so we can call, e.g., Arpack
function mul!(y :: AbstractVector, op :: LBFGSOperator, x :: AbstractVector)
op.prod(x)
y .= op.data.Ax
return y
end
7 changes: 7 additions & 0 deletions src/lsr1.jl
Original file line number Diff line number Diff line change
Expand Up @@ -214,3 +214,10 @@ function reset!(op :: LSR1Operator)
op.nctprod = 0
return op
end

# define mul! so we can call, e.g., Arpack
function mul!(y :: AbstractVector, op :: LSR1Operator, x :: AbstractVector)
op.prod(x)
y .= op.data.Ax
return y
end
2 changes: 1 addition & 1 deletion test/runtests.jl
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using Test, TestSetExtensions, LinearOperators
using Arpack, Test, TestSetExtensions, LinearOperators

include("test_aux.jl")

Expand Down
17 changes: 17 additions & 0 deletions test/test_lbfgs.jl
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,23 @@ function test_lbfgs()
@test nallocs == 0
end

@testset "LBFGS eigenvalues" begin
n = 100
mem = 20
B = LBFGSOperator(n, mem=mem)
H = InverseLBFGSOperator(n, mem=mem)
for _ = 1:2:n
s = rand(n)
y = rand(n)
push!(B, s, y)
push!(H, s, y)
end
λ = eigs(B, nev=n)[1] # call Arpack
@test minimum(λ) > 0
λ = eigs(H)[1]
@test minimum(λ) > 0
end

end

test_lbfgs()
14 changes: 14 additions & 0 deletions test/test_lsr1.jl
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,20 @@ function test_lsr1()
nallocs = @allocated diag!(B, x)
@test nallocs == 0
end

@testset "LSR1 eigenvalues" begin
n = 100
mem = 20
B = LSR1Operator(n, mem=mem)
for _ = 1:2:n
s = rand(n)
y = rand(n)
push!(B, s, y)
end
vals = eigs(B, nev=n)
resid = vals[end]
@test norm(resid) ≤ sqrt(eps(eltype(B)))
end
end

test_lsr1()