Skip to content

Commit 52b8322

Browse files
committed
v0.6 backward compatibility
1 parent 7078229 commit 52b8322

File tree

4 files changed

+23
-7
lines changed

4 files changed

+23
-7
lines changed

REQUIRE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
julia 0.7
1+
julia 0.6
22
IterativeSolvers 0.7.0
33
Compat 1.0.0

src/utils.jl

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,11 @@ function approximate_eigenvalues(A, tol, maxiter, symmetric, v0)
9191
rmul!(w, 1/H[j+1,j])
9292
push!(V, w)
9393
end
94-
Eigs, Vects = (eigen(H[1:maxiter, 1:maxiter], Matrix{eltype(A)}(I, maxiter, maxiter))...,)
94+
@static if VERSION < v"0.7-"
95+
Eigs, Vects = eig(H[1:maxiter, 1:maxiter], Matrix{eltype(A)}(I, maxiter, maxiter))
96+
else
97+
Eigs, Vects = (eigen(H[1:maxiter, 1:maxiter], Matrix{eltype(A)}(I, maxiter, maxiter))...,)
98+
end
9599

96100
Vects, Eigs, H, V, flag
97101
end

test/runtests.jl

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -96,8 +96,13 @@ for i = 1:2
9696
end
9797
@test size(ml.final_A, 1) == 2
9898
@test nnz(ml.final_A) == 4
99-
@test round(AMG.operator_complexity(ml), digits=3) 1.142
100-
@test round(AMG.grid_complexity(ml), digits=3) 1.190
99+
@static if VERSION < v"0.7-"
100+
@test round(AMG.operator_complexity(ml), 3) 1.142
101+
@test round(AMG.grid_complexity(ml), 3) 1.190
102+
else
103+
@test round(AMG.operator_complexity(ml), digits=3) 1.142
104+
@test round(AMG.grid_complexity(ml), digits=3) 1.190
105+
end
101106

102107
include("gmg.jl")
103108

test/sa_tests.jl

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -206,19 +206,26 @@ function test_approximate_spectral_radius()
206206
end
207207

208208
for A in cases
209-
E,V = (eigen(A)...,)
209+
@static if VERSION < v"0.7-"
210+
E,V = eig(A)
211+
else
212+
E,V = (eigen(A)...,)
213+
end
210214
E = abs.(E)
211215
largest_eig = findall(E .== maximum(E))[1]
212216
expected_eig = E[largest_eig]
213217

214218
@test isapprox(approximate_spectral_radius(A), expected_eig)
215-
216219
end
217220

218221
# Symmetric matrices
219222
for A in cases
220223
A = A + A'
221-
E,V = (eigen(A)...,)
224+
@static if VERSION < v"0.7-"
225+
E,V = eig(A)
226+
else
227+
E,V = (eigen(A)...,)
228+
end
222229
E = abs.(E)
223230
largest_eig = findall(E .== maximum(E))[1]
224231
expected_eig = E[largest_eig]

0 commit comments

Comments
 (0)