From de9450638e2efad6760955c2b400083f7c74eaa9 Mon Sep 17 00:00:00 2001 From: Sacha Verweij Date: Thu, 26 Oct 2017 20:12:41 -0700 Subject: [PATCH] Eliminate speye from miscellaneous tests. --- test/arrayops.jl | 2 +- test/hashing.jl | 2 +- test/linalg/arnoldi.jl | 2 +- test/linalg/special.jl | 2 +- test/linalg/uniformscaling.jl | 2 +- test/perf/kernel/getdivgrad.jl | 6 +++--- test/perf/sparse/fem.jl | 2 +- test/show.jl | 2 +- 8 files changed, 10 insertions(+), 10 deletions(-) diff --git a/test/arrayops.jl b/test/arrayops.jl index 7fb1ef21890f3e..4c38a4dade0637 100644 --- a/test/arrayops.jl +++ b/test/arrayops.jl @@ -1008,7 +1008,7 @@ end @test m[1,2] == ([2,4],) # issue #21123 - @test mapslices(nnz, speye(3), 1) == [1 1 1] + @test mapslices(nnz, sparse(1.0I, 3), 1) == [1 1 1] end @testset "single multidimensional index" begin diff --git a/test/hashing.jl b/test/hashing.jl index e2f277ab5b61ce..dfae4514496136 100644 --- a/test/hashing.jl +++ b/test/hashing.jl @@ -73,7 +73,7 @@ vals = Any[ Dict(x => x for x in 1:10), Dict(7=>7,9=>9,4=>4,10=>10,2=>2,3=>3,8=>8,5=>5,6=>6,1=>1), [], [1], [2], [1, 1], [1, 2], [1, 3], [2, 2], [1, 2, 2], [1, 3, 3], - zeros(2, 2), spzeros(2, 2), eye(2, 2), speye(2, 2), + zeros(2, 2), spzeros(2, 2), eye(2, 2), sparse(1.0I, 2), sparse(ones(2, 2)), ones(2, 2), sparse([0 0; 1 0]), [0 0; 1 0], [-0. 0; -0. 0.], SparseMatrixCSC(2, 2, [1, 3, 3], [1, 2], [-0., -0.]) ] diff --git a/test/linalg/arnoldi.jl b/test/linalg/arnoldi.jl index d8c4e032f42806..82d30898b799c8 100644 --- a/test/linalg/arnoldi.jl +++ b/test/linalg/arnoldi.jl @@ -163,7 +163,7 @@ let # Adjust the tolerance a bit since matrices with repeated eigenvalues # can be very stressful to ARPACK and this may therefore fail with # info = 3 if the tolerance is too small - @test eigs(speye(50), nev=10, tol = 5e-16)[1] ≈ ones(10) #Issue 4246 + @test eigs(sparse(1.0I, 50), nev=10, tol = 5e-16)[1] ≈ ones(10) #Issue 4246 end @testset "real svds" begin diff --git a/test/linalg/special.jl b/test/linalg/special.jl index bc1cfb0f34bafa..cfe1bf9eeadc65 100644 --- a/test/linalg/special.jl +++ b/test/linalg/special.jl @@ -178,7 +178,7 @@ end annotations = testfull ? (triannotations..., symannotations...) : (LowerTriangular, Symmetric) # Concatenations involving these types, un/annotated, should yield sparse arrays spvec = spzeros(N) - spmat = speye(N) + spmat = sparse(1.0I, N) diagmat = Diagonal(ones(N)) bidiagmat = Bidiagonal(ones(N), ones(N-1), :U) tridiagmat = Tridiagonal(ones(N-1), ones(N), ones(N-1)) diff --git a/test/linalg/uniformscaling.jl b/test/linalg/uniformscaling.jl index d3ce6677b4be9f..2c4e2cb3b98e9e 100644 --- a/test/linalg/uniformscaling.jl +++ b/test/linalg/uniformscaling.jl @@ -81,7 +81,7 @@ let @test B + I == B + eye(B) @test I + B == B + eye(B) AA = randn(2, 2) - for SS in (sprandn(3,3, 0.5), speye(Int, 3)) + for SS in (sprandn(3,3, 0.5), sparse(Int(1)I, 3)) for (A, S) in ((AA, SS), (view(AA, 1:2, 1:2), view(SS, 1:3, 1:3))) @test @inferred(A + I) == A + eye(A) @test @inferred(I + A) == A + eye(A) diff --git a/test/perf/kernel/getdivgrad.jl b/test/perf/kernel/getdivgrad.jl index 04ba5663d8ab6a..47615a2d963945 100644 --- a/test/perf/kernel/getdivgrad.jl +++ b/test/perf/kernel/getdivgrad.jl @@ -5,9 +5,9 @@ #----------------- Get the A matrix function getDivGrad(n1,n2,n3) # the Divergence - D1 = kron(speye(n3),kron(speye(n2),ddx(n1))) - D2 = kron(speye(n3),kron(ddx(n2),speye(n1))) - D3 = kron(ddx(n3),kron(speye(n2),speye(n1))) + D1 = kron(sparse(1.0I, n3), kron(sparse(1.0I, n2), ddx(n1))) + D2 = kron(sparse(1.0I, n3), kron(ddx(n2), sparse(1.0I, n1))) + D3 = kron(ddx(n3), kron(sparse(1.0I, n2), sparse(1.0I, n1))) # DIV from faces to cell-centers Div = [D1 D2 D3] diff --git a/test/perf/sparse/fem.jl b/test/perf/sparse/fem.jl index 80559921c9eba1..1634da4698b65c 100644 --- a/test/perf/sparse/fem.jl +++ b/test/perf/sparse/fem.jl @@ -7,7 +7,7 @@ function fdlaplacian(N) # create a 1D laplacian and a sparse identity fdl1 = spdiagm(-1 => ones(N-1), 0 => -2*ones(N), 1 => ones(N-1)) # laplace operator on the full grid - return kron(speye(N), fdl1) + kron(fdl1, speye(N)) + return kron(sparse(1.0I, N), fdl1) + kron(fdl1, sparse(1.0I, N)) end # get the list of boundary dof-indices diff --git a/test/show.jl b/test/show.jl index a3075d722ba16f..dd200810761712 100644 --- a/test/show.jl +++ b/test/show.jl @@ -492,7 +492,7 @@ end # issue #12960 mutable struct T12960 end let - A = speye(3) + A = sparse(1.0I, 3) B = similar(A, T12960) @test sprint(show, B) == "\n [1, 1] = #undef\n [2, 2] = #undef\n [3, 3] = #undef" @test sprint(print, B) == "\n [1, 1] = #undef\n [2, 2] = #undef\n [3, 3] = #undef"