Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use Int8(1) instead of true in I #29596

Closed
wants to merge 1 commit into from
Closed
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
2 changes: 1 addition & 1 deletion stdlib/LinearAlgebra/src/uniformscaling.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 3 additions & 3 deletions stdlib/LinearAlgebra/test/uniformscaling.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion stdlib/SparseArrays/test/sparse.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down