Skip to content

Commit

Permalink
Change formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
jlapeyre committed May 9, 2021
1 parent 8ba6c73 commit 45e2cf3
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 11 deletions.
18 changes: 9 additions & 9 deletions src/base_applications.jl
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
### It may be necessary to instead replace the `Base` and `LinearAlgebra` functions
### if `IsApprox` is widely adopted.

#### isone, iszero
### isone, iszero

isone(x, approx_test::AbstractApprox=Equal()) = isapprox(approx_test, x, one(x))
iszero(x, approx_test::AbstractApprox=Equal()) = isapprox(approx_test, x, zero(x))
Expand Down Expand Up @@ -50,7 +50,7 @@ end
return true
end

#### ishermitian, issymmetric
### ishermitian, issymmetric

# The call `ishermitian(A::AbstractMatrix, B::AbstractMatrix) lowers
# to exactly the same code as that in LinearAlgebra
Expand Down Expand Up @@ -91,13 +91,13 @@ end

issymmetric(x::Number, approx_test::AbstractApprox=Equal()) = isapprox(approx_test, x, x)

#### isreal
### isreal

# complex.jl
isreal(x::Real, approx_test::AbstractApprox=Equal()) = true
isreal(z::Complex, approx_test::AbstractApprox=Equal()) = iszero(imag(z), approx_test)

#### isinteger
### isinteger

# This must be changed if this is integrated into Base
isinteger(x) = isinteger(x, Equal())
Expand All @@ -109,11 +109,11 @@ isinteger(x::Rational, ::Equal) = Base.isinteger(x)
isinteger(x::Integer, ::AbstractApprox=Equal()) = true

# floatfuncs.jl
# The original is x - trunc(x) == 0. So this implementation might differ
# from the stock version of isinteger for some user's subtype of AbstractFloat.
# We choose to this implementation because the default relative tolerance is
# reasonable. That is, `isapprox(approx_test, x - trunc(x), 0)` requires
# specifying `atol`.
## The original is x - trunc(x) == 0. So this implementation might differ
## from the stock version of isinteger for some user's subtype of AbstractFloat.
## We choose to this implementation because the default relative tolerance is
## reasonable. That is, `isapprox(approx_test, x - trunc(x), 0)` requires
## specifying `atol`.
isinteger(x::AbstractFloat, approx_test::AbstractApprox=Equal()) = isapprox(approx_test, x, trunc(x))

# complex.jl
Expand Down
4 changes: 2 additions & 2 deletions src/other_applications.jl
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,10 @@ Return `true` if `x` is approximately greater than zero.
"""
isposdef(x::Number) = isposdef(x, Equal())
isposdef(x::Real, ::Equal) = x > zero(x)
# For methods other than `Equal`, x can be zero or negative
## For methods other than `Equal`, x can be zero or negative
isposdef(x::Number, approx_test::AbstractApprox) = ispossemidef(x, approx_test)

# For both positive definite and positive semidefinite
## For both positive definite and positive semidefinite
function _isposdef(m::AbstractMatrix, approx_test::AbstractApprox, posdeffunc)
! ishermitian(m, approx_test) && return false
evs = LinearAlgebra.eigvals(LinearAlgebra.Hermitian(m))
Expand Down

0 comments on commit 45e2cf3

Please sign in to comment.