@@ -460,8 +460,8 @@ Base.length(p::AbstractPolynomial) = length(coeffs(p))
460
460
461
461
Returns the size of the polynomials coefficients, along axis `i` if provided.
462
462
"""
463
- Base. size (p:: AbstractPolynomial ) = size ( coeffs (p))
464
- Base. size (p:: AbstractPolynomial , i:: Integer ) = size (coeffs (p), i)
463
+ Base. size (p:: AbstractPolynomial ) = ( length (p), )
464
+ Base. size (p:: AbstractPolynomial , i:: Integer ) = i <= 1 ? size (p)[i] : 1
465
465
Base. eltype (p:: AbstractPolynomial{T} ) where {T} = T
466
466
# in analogy with polynomial as a Vector{T} with different operations defined.
467
467
Base. eltype (:: Type{<:AbstractPolynomial} ) = Float64
@@ -470,7 +470,7 @@ _eltype(::Type{<:AbstractPolynomial}) = nothing
470
470
_eltype (:: Type{<:AbstractPolynomial{T}} ) where {T} = T
471
471
function _eltype (P:: Type{<:AbstractPolynomial} , p:: AbstractPolynomial )
472
472
T′ = _eltype (P)
473
- T = T′ == nothing ? eltype (p) : T′
473
+ T = T′ === nothing ? eltype (p) : T′
474
474
T
475
475
end
476
476
Base. iszero (p:: AbstractPolynomial ) = all (iszero, p)
@@ -706,7 +706,7 @@ Returns an iterator over the terms, `pᵢ⋅basis(p,i)`, of the polynomial for e
706
706
monomials (p) = Monomials (p)
707
707
function Base. iterate (v:: Monomials , state... )
708
708
y = iterate (pairs (v. p), state... )
709
- y == nothing && return nothing
709
+ y === nothing && return nothing
710
710
kv, s = y
711
711
return (kv[2 ]* basis (v. p, kv[1 ]), s)
712
712
end
@@ -723,18 +723,18 @@ _indeterminate(::Type{P}) where {P <: AbstractPolynomial} = nothing
723
723
_indeterminate (:: Type{P} ) where {T, X, P <: AbstractPolynomial{T,X} } = X
724
724
function indeterminate (:: Type{P} ) where {P <: AbstractPolynomial }
725
725
X = _indeterminate (P)
726
- X == nothing ? :x : X
726
+ X === nothing ? :x : X
727
727
end
728
728
indeterminate (p:: P ) where {P <: AbstractPolynomial } = _indeterminate (P)
729
729
function indeterminate (PP:: Type{P} , p:: AbstractPolynomial{T,Y} ) where {P <: AbstractPolynomial , T,Y}
730
730
X = _indeterminate (PP)
731
- X == nothing && return Y
731
+ X === nothing && return Y
732
732
assert_same_variable (X,Y)
733
733
return X
734
- # X = _indeterminate(PP) == nothing ? indeterminate(p) : _indeterminate(PP)
734
+ # X = _indeterminate(PP) === nothing ? indeterminate(p) : _indeterminate(PP)
735
735
end
736
736
function indeterminate (PP:: Type{P} , x:: Symbol ) where {P <: AbstractPolynomial }
737
- X = _indeterminate (PP) == nothing ? x : _indeterminate (PP)
737
+ X = _indeterminate (PP) === nothing ? x : _indeterminate (PP)
738
738
end
739
739
740
740
#=
@@ -761,7 +761,7 @@ Base.zero(p::P, var=indeterminate(p)) where {P <: AbstractPolynomial} = zero(P,
761
761
Returns a representation of 1 as the given polynomial.
762
762
"""
763
763
Base. one (:: Type{P} ) where {P<: AbstractPolynomial } = throw (ArgumentError (" No default method defined" )) # no default method
764
- Base. one (:: Type{P} , var:: SymbolLike ) where {P <: AbstractPolynomial } = one (⟒ (P){eltype (P), Symbol (var == nothing ? :x : var)})
764
+ Base. one (:: Type{P} , var:: SymbolLike ) where {P <: AbstractPolynomial } = one (⟒ (P){eltype (P), Symbol (var === nothing ? :x : var)})
765
765
Base. one (p:: P , var= indeterminate (p)) where {P <: AbstractPolynomial } = one (P, var)
766
766
767
767
Base. oneunit (:: Type{P} , args... ) where {P <: AbstractPolynomial } = one (P, args... )
0 commit comments