|
247 | 247 | @test (P([NaN]) ≈ NaN) == (false) |
248 | 248 | @test (P([Inf]) ≈ P([Inf])) == ([Inf] ≈ [Inf]) # true |
249 | 249 | @test (P([Inf]) ≈ Inf) == (true) |
250 | | - @test (P([1,Inf]) ≈ P([0,Inf])) == ([1,Inf] ≈ [0,Inf]) # false |
251 | | - @test (P([1,NaN,Inf]) ≈ P([0,NaN, Inf])) == ([1,NaN,Inf] ≈ [0,NaN, Inf]) #false |
| 250 | + @test (P([1,Inf]) ≈ P([0,Inf])) == ([1,Inf] ≈ [0,Inf]) # false |
| 251 | + @test (P([1,NaN,Inf]) ≈ P([0,NaN, Inf])) == ([1,NaN,Inf] ≈ [0,NaN, Inf]) #false |
252 | 252 | @test (P([eps(), eps()]) ≈ P([0,0])) == ([eps(), eps()] ≈ [0,0]) # false |
253 | 253 | @test (P([1,eps(), 1]) ≈ P([1,0,1])) == ([1,eps(), 1] ≈ [1,0,1]) # true |
254 | 254 | @test (P([1,2]) ≈ P([1,2,eps()])) == ([1,2,0] ≈ [1,2,eps()]) |
|
431 | 431 | @test roots(pNULL) == [] |
432 | 432 | @test sort(roots(pR)) == [1 // 2, 3 // 2] |
433 | 433 |
|
| 434 | + @test roots(LaurentPolynomial([24,10,-15,0,1],-2:1,:z))≈[-4,-1,2,3] |
| 435 | + |
434 | 436 | A = [1 0; 0 1] |
435 | 437 | @test fromroots(A) == Polynomial(Float64[1, -2, 1]) |
436 | 438 | p = fromroots(P, A) |
|
511 | 513 | q = [3, p1] |
512 | 514 | if P != ImmutablePolynomial |
513 | 515 | @test q isa Vector{typeof(p1)} |
514 | | - @test p isa Vector{typeof(p2)} |
| 516 | + @test p isa Vector{typeof(p2)} |
515 | 517 | else |
516 | 518 | @test q isa Vector{P{eltype(p1)}} # ImmutablePolynomial{Int64,N} where {N}, different Ns |
517 | 519 | @test p isa Vector{P{eltype(p2)}} # ImmutablePolynomial{Int64,N} where {N}, different Ns |
|
651 | 653 | end |
652 | 654 |
|
653 | 655 | @test eltype(p1) == Int |
654 | | - for P in Ps |
| 656 | + for P in Ps |
655 | 657 | p1 = P([1,2,0,3]) |
656 | 658 | @test eltype(collect(p1)) <: P{Int} |
657 | 659 | @test eltype(collect(P{Float64}, p1)) <: P{Float64} |
|
754 | 756 | for n in (2,5,10,20,50, 100) |
755 | 757 | p = (x-1)^n * (x-2)^n * (x-3) |
756 | 758 | q = (x-1) * (x-2) * (x-4) |
757 | | - @test degree(gcd(p,q, method=:numerical)) == 2 |
| 759 | + @test degree(gcd(p,q, method=:numerical)) == 2 |
758 | 760 | end |
759 | 761 | end |
760 | 762 | end |
|
889 | 891 | @test typeof(p₁) == P{T,5} # conversion works |
890 | 892 | @test_throws InexactError P{T}(rand(5)) |
891 | 893 | end |
892 | | - end |
| 894 | + end |
893 | 895 |
|
894 | 896 | end |
0 commit comments