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

ToricVarieties: Toric morphisms #1460

Merged
merged 3 commits into from
Oct 31, 2022

Conversation

HereAround
Copy link
Member

@HereAround HereAround commented Jul 14, 2022

This PR achieves the following:

  1. Implement basic functionality for toric morphisms.
  2. For a given toric morphism, it computes the induced maps on the torusinvariant Weil divisors and the Cartier divisors.
  3. It implements the Cox variety and the quotient morphism from the Cox variety to the toric variety in question.

@HereAround HereAround marked this pull request as draft July 14, 2022 19:10
@HereAround HereAround added the enhancement New feature or request label Jul 15, 2022
@HereAround HereAround force-pushed the ToricMorphisms branch 4 times, most recently from 5bf931f to 4d3891f Compare July 15, 2022 12:15
@HereAround HereAround force-pushed the ToricMorphisms branch 5 times, most recently from 68cdbe3 to beade5c Compare July 21, 2022 10:20
@HereAround HereAround force-pushed the ToricMorphisms branch 3 times, most recently from 2d15000 to 2480c5a Compare September 1, 2022 03:18
@HereAround HereAround force-pushed the ToricMorphisms branch 8 times, most recently from 46df69e to 4b1e10a Compare October 25, 2022 11:46
@HereAround HereAround marked this pull request as ready for review October 25, 2022 11:49
@HereAround HereAround changed the title ToricVarieties: Toric morphisms (Draft) ToricVarieties: Toric morphisms Oct 25, 2022
@HereAround
Copy link
Member Author

I just rebased to the latest master.

Copy link
Member

@lkastner lkastner left a comment

Choose a reason for hiding this comment

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

Please avoid high nesting levels and long functions. If funtions become too long they should probably be broken up into shorter logical parts.

Comment on lines 117 to 110
for i in 1:nrows(images_of_rays)
for j in 1:length(codomain_variety_max_cones)
if contains(codomain_variety_max_cones[j], [images_of_rays[i,k] for k in 1:ncols(images_of_rays)])
rayimage_maxcones_incidence_list[i] = j
break
end
end
end
Copy link
Member

Choose a reason for hiding this comment

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

This is duplicating a lot of checks, isn't it? Also I believe Max said that there is a way to avoid nested for loops, I think you can just separate the two params with a comma.

Copy link
Member

Choose a reason for hiding this comment

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

Nevermind, I was just confused. Can you not write something like images_of_rays[i,:]?

Copy link
Member

Choose a reason for hiding this comment

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

Also what if a ray is contained in several maximal cones?

Comment on lines 112 to 140
images_of_rays = domain_variety_rays * matrix(grid_morphism(tm))

# for each image ray, find a max cone in the codomain toric variety which contains it
codomain_variety_max_cones = maximal_cones(codomain_variety)
rayimage_maxcones_incidence_list = [0 for i in 1:nrows(images_of_rays)]
for i in 1:nrows(images_of_rays)
for j in 1:length(codomain_variety_max_cones)
if contains(codomain_variety_max_cones[j], [images_of_rays[i,k] for k in 1:ncols(images_of_rays)])
rayimage_maxcones_incidence_list[i] = j
break
end
end
end

# form list of rays which are in maximal cones of the codomain variety
codomain_variety_maxcone_ray_incidence = ray_indices(maximal_cones(codomain_variety))
r = rank(character_lattice(codomain_variety))
codomain_variety_rays_in_cones = []
for i in 1:length(codomain_variety_max_cones)
matrix = zeros(Int,nrows(codomain_variety_rays),ncols(codomain_variety_rays))
for j in 1:nrows(codomain_variety_rays)
if codomain_variety_maxcone_ray_incidence[i,j]
for k in 1:ncols(codomain_variety_rays)
matrix[j,k] = codomain_variety_rays[j,k]
end
end
end
push!(codomain_variety_rays_in_cones, matrix)
end
Copy link
Member

Choose a reason for hiding this comment

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

You can actually use IncidenceMatrix from Oscar and build an incidence matrix for the image rays in the target fan in hopefully less code along the lines of

julia> fc = normal_fan(cube(2));

julia> fh = normal_fan(hexagon);

julia> rh = collect(rays(fh))
6-element Vector{RayVector{fmpq}}:
 [1, 0]
 [0, 1]
 [1, -1]
 [-1, 1]
 [-1, 0]
 [0, -1]

julia> mc = collect(maximal_cones(fc))
4-element Vector{Cone{fmpq}}:
 A polyhedral cone in ambient dimension 2
 A polyhedral cone in ambient dimension 2
 A polyhedral cone in ambient dimension 2
 A polyhedral cone in ambient dimension 2

julia> image_incidences = IncidenceMatrix(nrays(fh), n_maximal_cones(fc))
6×4 IncidenceMatrix
[]
[]
[]
[]
[]
[]


julia> for i in 1:nrays(fh), j in 1:n_maximal_cones(fc)
       image_incidences[i,j] = contains(mc[j], rh[i])
       end

julia> image_incidences
6×4 IncidenceMatrix
[1, 3]
[1, 2]
[3]
[2]
[2, 4]
[3, 4]

Does this maybe simplify this method?

end
end

# return the map
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
# return the map

Isn't this obvious from the line below starting with return?

Comment on lines 144 to 157
for i in 1:nrows(images_of_rays)
current_row = images_of_rays[i,:]
solution = false
matrix_multiplier = 1
while !solution
r = matrix_multiplier * current_row
matrix_multiplier = matrix_multiplier + 1
m = matrix(ZZ,codomain_variety_rays_in_cones[rayimage_maxcones_incidence_list[i]])
solution = can_solve(transpose(m), transpose(r))
if solution
current_row = solve(transpose(m), transpose(r))
current_row = transpose(current_row)
end
end
Copy link
Member

Choose a reason for hiding this comment

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

Why not while !can_solve(...)? Also the matrix_multiplier seems unneeded. You could just add images_of_rays[i,:] to current_row and addition might be faster than multiplication.

@HereAround HereAround marked this pull request as draft October 28, 2022 21:51
@HereAround
Copy link
Member Author

Thank you @lkastner for the detailed review. Based on your feedback, I believe there is a need to rethink and also redesign a couple of things here, in particular the function for the map between the torus invariant divisor class groups. Hence, I have reverted this PR into a draft for the time being. More shortly.

@HereAround HereAround marked this pull request as ready for review October 31, 2022 18:10
@HereAround
Copy link
Member Author

Thank you @lkastner. I merge.

@HereAround HereAround merged commit 1c0fce2 into oscar-system:master Oct 31, 2022
@HereAround HereAround deleted the ToricMorphisms branch October 31, 2022 18:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants