From abe31d103c0437d764c160c7985c10dc5f62df3b Mon Sep 17 00:00:00 2001 From: Andreas Noack Date: Thu, 11 Oct 2018 11:59:35 +0200 Subject: [PATCH] Use Int8(1) instead of true in I --- stdlib/LinearAlgebra/src/uniformscaling.jl | 2 +- stdlib/LinearAlgebra/test/uniformscaling.jl | 6 +++--- stdlib/SparseArrays/test/sparse.jl | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/stdlib/LinearAlgebra/src/uniformscaling.jl b/stdlib/LinearAlgebra/src/uniformscaling.jl index be1379e9034f3..4abcf5f7ad620 100644 --- a/stdlib/LinearAlgebra/src/uniformscaling.jl +++ b/stdlib/LinearAlgebra/src/uniformscaling.jl @@ -46,7 +46,7 @@ julia> [1 2im 3; 1im 2 3] * I 0+1im 2+0im 3+0im ``` """ -const I = UniformScaling(true) +const I = UniformScaling(Int8(1)) eltype(::Type{UniformScaling{T}}) where {T} = T ndims(J::UniformScaling) = 2 diff --git a/stdlib/LinearAlgebra/test/uniformscaling.jl b/stdlib/LinearAlgebra/test/uniformscaling.jl index c544736f9feac..88565262af239 100644 --- a/stdlib/LinearAlgebra/test/uniformscaling.jl +++ b/stdlib/LinearAlgebra/test/uniformscaling.jl @@ -60,7 +60,7 @@ end end @testset "det and logdet" begin - @test det(I) === true + @test det(I) === Int8(1) @test det(1.0I) === 1.0 @test det(0I) === 0 @test det(0.0I) === 0.0 @@ -79,7 +79,7 @@ let @test ndims(J) == 2 @test transpose(J) == J @test J * [1 0; 0 1] == conj(*(adjoint(J), [1 0; 0 1])) # ctranpose (and A(c)_mul_B) - @test I + I === UniformScaling(2) # + + @test I + I === UniformScaling(Int8(2)) # + @test inv(I) == I @test inv(J) == UniformScaling(inv(λ)) @test cond(I) == 1 @@ -103,7 +103,7 @@ let I22 = Matrix(I, size(A)) @test @inferred(A + I) == A + I22 @test @inferred(I + A) == A + I22 - @test @inferred(I - I) === UniformScaling(0) + @test @inferred(I - I) === UniformScaling(Int8(0)) @test @inferred(B - I) == B - I22 @test @inferred(I - B) == I22 - B @test @inferred(A - I) == A - I22 diff --git a/stdlib/SparseArrays/test/sparse.jl b/stdlib/SparseArrays/test/sparse.jl index c8e5ebd8b5acb..014f6e9172d75 100644 --- a/stdlib/SparseArrays/test/sparse.jl +++ b/stdlib/SparseArrays/test/sparse.jl @@ -583,7 +583,7 @@ end @testset "findall" begin # issue described in https://groups.google.com/d/msg/julia-users/Yq4dh8NOWBQ/GU57L90FZ3EJ - A = sparse(I, 5, 5) + A = sparse(Diagonal(trues(5))) @test findall(A) == findall(x -> x == true, A) == findall(Array(A)) # Non-stored entries are true @test findall(x -> x == false, A) == findall(x -> x == false, Array(A))