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

Prefer symbols over strings as indeterminants #4158

Open
wants to merge 10 commits into
base: master
Choose a base branch
from

Conversation

lgoettgens
Copy link
Member

@lgoettgens lgoettgens commented Sep 27, 2024

@lkastner @HereAround could you have a look if the attributes coordinate_names and coordinate_names_of_torus in the toric varieties could be changed to Vector{Symbol} instead of Vector{String} to reduce the allocations from copying this around and passing it to polynomial_ring etc? (moved to #4159)

@lgoettgens
Copy link
Member Author

@benlorenz is this failure something similar to what you work around in #4153 or is a genuine failure?

alternative inputs: Test Failed at /Users/aaruni/Desktop/oscar-runners/runner-1/_work/Oscar.jl/Oscar.jl/test/PolyhedralGeometry/subdivision_of_points.jl:17
 Expression: collect(maximal_cells(square_by_incidence)) == collect(maximal_cells(square_by_weights))
 Evaluated: [[1, 2, 3], [2, 3, 4]] == [[2, 3, 4], [1, 2, 3]]

https://github.com/oscar-system/Oscar.jl/actions/runs/11072577996/job/30767135768?pr=4158#step:9:1856

@@ -61,7 +61,7 @@ function global_tate_model(base::NormalToricVariety,
vs2 = collect(keys(defining_section_parametrization))
@req all(in(["a1", "a2", "a3", "a4", "a6"]), vs2) "Only the Tate sections a1, a2, a3, a4, a6 must be parametrized"

gens_base_names = [string(g) for g in gens(cox_ring(base))]
gens_base_names = [string(g) for g in symbols(cox_ring(base))]
Copy link
Member Author

Choose a reason for hiding this comment

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

@HereAround pinging you to make you aware that symbols(::MPolyRing) exists. In many of these cases you probably don't even need to convert to strings afterwards, but I kept it like this if I didn't see an obvious way to change the below code

@benlorenz
Copy link
Member

@benlorenz is this failure something similar to what you work around in #4153 or is a genuine failure?

alternative inputs: Test Failed at /Users/aaruni/Desktop/oscar-runners/runner-1/_work/Oscar.jl/Oscar.jl/test/PolyhedralGeometry/subdivision_of_points.jl:17
 Expression: collect(maximal_cells(square_by_incidence)) == collect(maximal_cells(square_by_weights))
 Evaluated: [[1, 2, 3], [2, 3, 4]] == [[2, 3, 4], [1, 2, 3]]

oscar-system/Oscar.jl/actions/runs/11072577996/job/30767135768?pr=4158#step:9:1856

I only noticed (and now fixed) those in polyhedron.jl so far but this is similar and I will do another PR soon.

@test collect(maximal_cells(square_by_incidence)) ==
collect(maximal_cells(square_by_weights))
@test issetequal(collect(maximal_cells(square_by_incidence)),
collect(maximal_cells(square_by_weights)))
Copy link
Member Author

Choose a reason for hiding this comment

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

@benlorenz I added this already here to try to get CI green eventually

Copy link
Member

Choose a reason for hiding this comment

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

Ok, thanks! The collect should be unnecessary now but I can take care of that later.
For the cases in polyhedron.jl a rerun usually fixed it.

@lgoettgens lgoettgens force-pushed the lg/prefer-symbols branch 2 times, most recently from 0784fd0 to ef891b7 Compare September 27, 2024 16:20
Copy link
Collaborator

@afkafkafk13 afkafkafk13 left a comment

Choose a reason for hiding this comment

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

The Algebraic Geometry/Commutative Algebra part looks good provided tests pass -- with the exception that I did not look at toric stuff (because you already pinged @HereAround ) and IntersectionTheory should be pinged as well.

if !isempty(intersect(non_zeros, findall(!iszero, bir_sequence.weights_alpha[c])))
if !isdisjoint(non_zeros, findall(!iszero, bir_sequence.weights_alpha[c]))
Copy link
Collaborator

Choose a reason for hiding this comment

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

This change is not in the scope of the description of the PR, but it makes sense. Did it sneek in from somewhere else and you want to leave it in?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants