diff --git a/Project.toml b/Project.toml index 7807bdca..59f35223 100644 --- a/Project.toml +++ b/Project.toml @@ -1,7 +1,7 @@ name = "TaylorSeries" uuid = "6aa5eb33-94cf-58f4-a9d0-e4b2c4fc25ea" repo = "https://github.com/JuliaDiff/TaylorSeries.jl.git" -version = "0.12.1" +version = "0.12.2" [deps] LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e" diff --git a/src/other_functions.jl b/src/other_functions.jl index 4fee86ea..20d9617c 100644 --- a/src/other_functions.jl +++ b/src/other_functions.jl @@ -10,15 +10,15 @@ for T in (:Taylor1, :HomogeneousPolynomial, :TaylorN) ## real, imag, conj and ctranspose ## for f in (:real, :imag, :conj) - @eval ($f)(a::$T) = $T(($f).(a.coeffs), a.order) + @eval ($f)(a::$T) = $T($f(a.coeffs), a.order) end @eval adjoint(a::$T) = conj(a) ## isinf and isnan ## - @eval isinf(a::$T) = any( isinf.(a.coeffs) ) + @eval isinf(a::$T) = any(isinf, a.coeffs) - @eval isnan(a::$T) = any( isnan.(a.coeffs) ) + @eval isnan(a::$T) = any(isnan, a.coeffs) end diff --git a/test/manyvariables.jl b/test/manyvariables.jl index acacf6d3..bcbe9104 100644 --- a/test/manyvariables.jl +++ b/test/manyvariables.jl @@ -114,9 +114,14 @@ using LinearAlgebra @test xH == convert(HomogeneousPolynomial{Float64},xH) @test HomogeneousPolynomial(xH) == xH @test HomogeneousPolynomial(0,0) == 0 + @test (@inferred conj(xH)) == (@inferred adjoint(xH)) + @test (@inferred real(xH)) == xH xT = TaylorN(xH, 17) yT = TaylorN(Int, 2, order=17) + @test (@inferred conj(xT)) == (@inferred adjoint(xT)) + @test (@inferred real(xT)) == (xT) zeroT = zero( TaylorN([xH],1) ) + @test (@inferred imag(xT)) == (zeroT) @test zeroT.coeffs == zeros(HomogeneousPolynomial{Int}, 1) @test size(xH) == (2,) @test firstindex(xH) == 1 @@ -376,8 +381,8 @@ using LinearAlgebra @test (1+xT)^(3//2) == ((1+xT)^0.5)^3 @test real(xH) == xH @test imag(xH) == zero(xH) - @test conj(im*yH) == (im*yH)' - @test conj(im*yT) == (im*yT)' + @test (@inferred conj(im*yH)) == (@inferred adjoint(im*yH)) + @test (@inferred conj(im*yT)) == (@inferred adjoint(im*yT)) @test real( exp(1im * xT)) == cos(xT) @test getcoeff(convert(TaylorN{Rational{Int}},cos(xT)),(4,0)) == 1//factorial(4) diff --git a/test/mixtures.jl b/test/mixtures.jl index 0c7e08fe..084156ea 100644 --- a/test/mixtures.jl +++ b/test/mixtures.jl @@ -100,8 +100,8 @@ using LinearAlgebra end @test string(t1N*t1N) == " 1.0 x₁² + 𝒪(‖x‖³) + ( 2.0 x₁ + 𝒪(‖x‖³)) t + ( 1.0 + 𝒪(‖x‖³)) t² + ( 2.0 x₂² + 𝒪(‖x‖³)) t³ + 𝒪(t⁴)" - @test !isnan(tN1) - @test !isinf(tN1) + @test !(@inferred isnan(tN1)) + @test !(@inferred isinf(tN1)) @test mod(tN1+1,1.0) == 0+tN1 @test mod(tN1-1.125,2) == 0.875+tN1 @@ -185,10 +185,10 @@ using LinearAlgebra @test typeof(xx) == Taylor1{TaylorN{Float64}} @test eltype(xx) == Taylor1{TaylorN{Float64}} @test TS.numtype(xx) == TaylorN{Float64} - @test !isnan(xx) - @test !isnan(δx) - @test !isinf(xx) - @test !isinf(δx) + @test !(@inferred isnan(xx)) + @test !(@inferred isnan(δx)) + @test !(@inferred isinf(xx)) + @test !(@inferred isinf(δx)) @test +xx == xx @test -xx == 0 - xx @test xx/1.0 == 1.0*xx @@ -297,8 +297,8 @@ using LinearAlgebra @test P ≈ P Q = deepcopy(P) Q[2][2] = Taylor1([NaN, Inf]) - @test isnan(Q) - @test isinf(Q) + @test (@inferred isnan(Q)) + @test (@inferred isinf(Q)) @test !isfinite(Q) Q[2][2] = P[2][2]+sqrt(eps())/2 @test isapprox(P, Q, rtol=1.0) diff --git a/test/onevariable.jl b/test/onevariable.jl index ad8d270f..08bdfa1c 100644 --- a/test/onevariable.jl +++ b/test/onevariable.jl @@ -148,8 +148,8 @@ Base.iszero(::SymbNumber) = false @test TaylorSeries.findlast(zt) == -1 @test iszero(zero(t)) @test !iszero(one(t)) - @test isinf(Taylor1([typemax(1.0)])) - @test isnan(Taylor1([typemax(1.0), NaN])) + @test @inferred isinf(Taylor1([typemax(1.0)])) + @test @inferred isnan(Taylor1([typemax(1.0), NaN])) @test constant_term(2.0) == 2.0 @test constant_term(t) == 0