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

Rename isweighted -> is_weighted #2953

Merged
merged 2 commits into from
Oct 28, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/AlgebraicGeometry/Miscellaneous/basics.jl
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ function weights(P::ProjSpc)
return Int[x[1] for x = P.Rx.d]
end

function isweighted(P::ProjSpc)
function is_weighted(P::ProjSpc)
return !all(x->isone(x[1]), P.Rx.d)
Comment on lines +48 to 49
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I find this method problematic -- why is a projective space in which all weights are 1 "not weighted" ?

end

Expand Down Expand Up @@ -173,7 +173,7 @@ function normalize!(a::ProjSpcElem{ZZRingElem})
end

function Base.hash(a::ProjSpcElem, u::UInt=UInt(123432))
if isweighted(parent(a))
if is_weighted(parent(a))
return u
end
normalize!(a)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ function normalize!(a::AbsProjectiveRationalPoint{ZZRingElem})
end

function Base.hash(a::AbsProjectiveRationalPoint, u::UInt=UInt(123432))
if isweighted(codomain(a))
if is_weighted(codomain(a))
return u
end
normalize!(a)
Expand Down
4 changes: 2 additions & 2 deletions src/Rings/orderings.jl
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ export is_global
export is_local
export is_mixed
export is_total
export isweighted
export is_weighted
export lex
export matrix_ordering
export monomial_ordering
Expand Down Expand Up @@ -124,7 +124,7 @@ function _unique_var_indices(a::AbstractVector{<:MPolyRingElem})
return z
end

function isweighted(ord::Symbol)
function is_weighted(ord::Symbol)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I find this method problematic: in how far is a symbol weighted? This is perhaps OK for an internal helper, but not for something we export. I would suggest to call this _is_weighted

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have the impression that this function should be removed completely. It is not used (apparently it was used originally for a show method) and monomial orderings should not be represented by symbols nowadays. So if the functionality is needed, there should be a is_weighted(::MonomialOrdering) in my opinion.

It looks like one could easily implement this with

is_weighted(::MonomialOrdering) = false
is_weighted(::WSymbOrdering) = true

but no guarantee.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The reason why I opened this PR is that I need this for #2936. Users should be able to provide an ordering via symbol as an input there. So please don't remove

return ord == :wdeglex || ord == :wdegrevlex ||
ord == :negwdeglex || ord == :negwdegrevlex
end
Expand Down
1 change: 1 addition & 0 deletions src/exports.jl
Original file line number Diff line number Diff line change
Expand Up @@ -869,6 +869,7 @@ export is_unital
export is_vertical_k_separation
export is_very_ample
export is_weakly_connected
export is_weighted
export is_welldefined
export is_z_graded
export is_zero
Expand Down
Loading