File tree Expand file tree Collapse file tree 2 files changed +10
-2
lines changed
Expand file tree Collapse file tree 2 files changed +10
-2
lines changed Original file line number Diff line number Diff line change @@ -1350,7 +1350,7 @@ function issymmetric(A::AbstractMatrix)
13501350 return true
13511351end
13521352
1353- issymmetric (x:: Number ) = x == x
1353+ issymmetric (x:: Number ) = ! isnan (x)
13541354
13551355"""
13561356 ishermitian(A) -> Bool
@@ -1389,7 +1389,7 @@ function ishermitian(A::AbstractMatrix)
13891389 return true
13901390end
13911391
1392- ishermitian (x:: Number ) = (x == conj (x) )
1392+ ishermitian (x:: Number ) = issymmetric (x) && isreal (x )
13931393
13941394# helper function equivalent to `iszero(v)`, but potentially without the fast exit feature
13951395# of `all` if this improves performance
Original file line number Diff line number Diff line change 943943 @test B == A2
944944end
945945
946+ @testset " issymmetric/ishermitian for Numbers" begin
947+ fsym (x) = Val (issymmetric (x))
948+ @test @inferred (fsym (2 )) isa Val{true }
949+ @test @inferred (fsym (2im )) isa Val{true }
950+ fherm (x) = Val (ishermitian (x))
951+ @test @inferred (fherm (2 )) isa Val{true }
952+ end
953+
946954end # module TestGeneric
You can’t perform that action at this time.
0 commit comments