Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix all uses of Val #1664

Merged
merged 19 commits into from
Apr 12, 2024
Merged
Prev Previous commit
Next Next commit
Fix is_gen
  • Loading branch information
lgoettgens committed Apr 10, 2024
commit a3f14f85d91a72f077ffad0c9d1200727aa352a7
1 change: 1 addition & 0 deletions src/Deprecations.jl
Original file line number Diff line number Diff line change
Expand Up @@ -54,3 +54,4 @@ end
import .Generic: exponent_vector; @deprecate exponent_vector(a::Generic.MPoly{T}, i::Int, ::Type{Val{ord}}) where {T <: RingElement, ord} exponent_vector(a, i, Val(ord))
import .Generic: exponent; @deprecate exponent(a::Generic.MPoly{T}, i::Int, j::Int, ::Type{Val{ord}}) where {T <: RingElement, ord} exponent(a, i, j, Val(ord))
import .Generic: set_exponent_vector!; @deprecate set_exponent_vector!(a::Generic.MPoly{T}, i::Int, exps::Vector{Int}, ::Type{Val{ord}}) where {T <: RingElement, ord} set_exponent_vector!(a, i, exps, Val(ord))
import .Generic: is_gen; @deprecate is_gen(x::Generic.MPoly{T}, ::Type{Val{ord}}) where {T <: RingElement, ord} is_gen(x, Val(ord))
8 changes: 4 additions & 4 deletions src/generic/MPoly.jl
Original file line number Diff line number Diff line change
Expand Up @@ -596,7 +596,7 @@ function Base.hash(x::MPoly{T}, h::UInt) where {T <: RingElement}
return b
end

function is_gen(x::MPoly{T}, ::Type{Val{:lex}}) where {T <: RingElement}
function is_gen(x::MPoly{T}, ::Val{:lex}) where {T <: RingElement}
exps = x.exps
N = size(exps, 1)
for k = 1:N
Expand All @@ -616,12 +616,12 @@ function is_gen(x::MPoly{T}, ::Type{Val{:lex}}) where {T <: RingElement}
return false
end

function is_gen(x::MPoly{T}, ::Type{Val{:deglex}}) where {T <: RingElement}
function is_gen(x::MPoly{T}, ::Val{:deglex}) where {T <: RingElement}
N = size(x.exps, 1)
return x.exps[N, 1] == UInt(1)
end

function is_gen(x::MPoly{T}, ::Type{Val{:degrevlex}}) where {T <: RingElement}
function is_gen(x::MPoly{T}, ::Val{:degrevlex}) where {T <: RingElement}
N = size(x.exps, 1)
return x.exps[N, 1] == UInt(1)
end
Expand All @@ -639,7 +639,7 @@ function is_gen(x::MPoly{T}) where {T <: RingElement}
if !isone(coeff(x, 1))
return false
end
return is_gen(x, Val{parent(x).ord})
return is_gen(x, Val(internal_ordering(parent(x))))
end

@doc raw"""
Expand Down