diff --git a/src/mono.jl b/src/mono.jl index 1fe95a0..c5cfea1 100644 --- a/src/mono.jl +++ b/src/mono.jl @@ -36,7 +36,7 @@ function MP.monomial(vars::Vector{Variable{V,M}}, z::Vector{Int}) where {V,M} return Monomial{V,M}(vars, z) end -iscomm(::Type{<:Monomial{V}}) where {V} = iscomm(V) +MP.is_commutative(::Type{<:Monomial{V}}) where {V} = iscomm(V) Monomial{V,M}() where {V,M} = Monomial{V,M}(Variable{V,M}[], Int[]) function Monomial(vars::TupOrVec{Variable{V,M}}, z::Vector{Int}) where {V,M} return Monomial{V,M}(vars, z) diff --git a/src/poly.jl b/src/poly.jl index 119d608..8380651 100644 --- a/src/poly.jl +++ b/src/poly.jl @@ -26,7 +26,7 @@ function Polynomial{V,M,T}(terms::AbstractVector{<:_Term{V,M}}) where {V,M,T} return Polynomial{V,M,T}(a, x) end -iscomm(::Type{Polynomial{V,M,T}}) where {V,M,T} = V, M +MP.is_commutative(::Type{Polynomial{V,M,T}}) where {V,M,T} = iscomm(V) function _zero_with_variables( ::Type{Polynomial{V,M,T}}, diff --git a/src/var.jl b/src/var.jl index faf0c21..ae2cf3c 100644 --- a/src/var.jl +++ b/src/var.jl @@ -209,16 +209,17 @@ end MP.monomial(v::Variable) = Monomial(v) MP.variables(v::Variable) = [v] -MP.exponents(v::Variable) = [1] +MP.exponents(::Variable) = [1] MP.ordering(v::Variable) = MP.ordering(typeof(v)) MP.ordering(::Type{Variable{V,M}}) where {V,M} = M -iscomm(::Type{Variable{C}}) where {C} = C +MP.is_commutative(::Type{Variable{V}}) where {V} = iscomm(V) +MP.is_commutative(::Type{<:Vector{<:Variable{V}}}) where {V} = iscomm(V) -Base.isreal(x::Variable{C}) where {C} = x.kind != COMPLEX && x.kind != CONJ -MP.isrealpart(x::Variable{C}) where {C} = x.kind == REAL_PART -MP.isimagpart(x::Variable{C}) where {C} = x.kind == IMAG_PART -MP.isconj(x::Variable{C}) where {C} = x.kind == CONJ +Base.isreal(x::Variable) = x.kind != COMPLEX && x.kind != CONJ +MP.isrealpart(x::Variable) = x.kind == REAL_PART +MP.isimagpart(x::Variable) = x.kind == IMAG_PART +MP.isconj(x::Variable) = x.kind == CONJ function MP.ordinary_variable(x::Variable) return x.kind == REAL || x.kind == COMPLEX ? x : Variable(x, COMPLEX) end