-
Notifications
You must be signed in to change notification settings - Fork 113
/
attributes.jl
150 lines (115 loc) · 4.49 KB
/
attributes.jl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
@doc raw"""
underlying_morphism(bl::ToricBlowdownMorphism)
Return the underlying toric morphism of a toric blowdown morphism.
Access to other attributes such as `domain`, `codomain`, `covering_morphism`
are executed via `underlying_morphism`.
# Examples
```jldoctest
julia> P3 = projective_space(NormalToricVariety, 3)
Normal toric variety
julia> blow_down_morphism = blow_up(P3, [0, 1, 1])
Toric blowdown morphism
julia> Oscar.underlying_morphism(blow_down_morphism)
Toric morphism
```
"""
underlying_morphism(bl::ToricBlowdownMorphism) = bl.toric_morphism
@doc raw"""
index_of_new_ray(bl::ToricBlowdownMorphism)
Return the index of the new ray used in the construction of the toric blowdown morphism.
# Examples
```jldoctest
julia> P3 = projective_space(NormalToricVariety, 3)
Normal toric variety
julia> blow_down_morphism = blow_up(P3, [0, 1, 1])
Toric blowdown morphism
julia> index_of_new_ray(blow_down_morphism)
5
```
"""
index_of_new_ray(bl::ToricBlowdownMorphism) = bl.index_of_new_ray
@doc raw"""
center(bl::ToricBlowdownMorphism)
Return the center of the toric blowdown morphism as ideal sheaf.
# Examples
```jldoctest
julia> P3 = projective_space(NormalToricVariety, 3)
Normal toric variety
julia> blow_down_morphism = blow_up(P3, [0, 1, 1])
Toric blowdown morphism
julia> center(blow_down_morphism)
Sheaf of ideals
on normal, smooth toric variety
with restrictions
1: Ideal (x_3_1, x_2_1)
2: Ideal (x_3_2, x_2_2)
3: Ideal (1)
4: Ideal (1)
```
"""
function center(bl::ToricBlowdownMorphism)
if !isdefined(bl, :center)
# TODO: The implementation below is highly inefficient. Improve it if you know how.
X = domain(bl)
S = cox_ring(X)
x = gens(S)
j = index_of_new_ray(bl)
I = ideal(S, x[j])
II = ideal_sheaf(X, I)
JJ = pushforward(bl, II)::IdealSheaf
bl.center = JJ
end
return bl.center
end
@doc raw"""
exceptional_divisor(bl::ToricBlowdownMorphism)
Return the exceptional divisor (as toric divisor) of the toric blowdown morphism.
# Examples
```jldoctest
julia> P3 = projective_space(NormalToricVariety, 3)
Normal toric variety
julia> blow_down_morphism = blow_up(P3, [0, 1, 1])
Toric blowdown morphism
julia> exceptional_divisor(blow_down_morphism)
Torus-invariant, cartier, prime divisor on a normal toric variety
```
"""
function exceptional_divisor(bl::ToricBlowdownMorphism)
if !isdefined(bl, :exceptional_divisor)
X = domain(bl)
S = cox_ring(X)
x = gens(S)
j = index_of_new_ray(bl)
help_list = [i == j ? 1 : 0 for i in 1:ngens(S)]
td = toric_divisor(X, help_list)
@assert is_cartier(td) "exceptional divisor must be Cartier"
@assert is_prime(td) "exceptional divisor must be prime"
bl.exceptional_divisor = td
end
return bl.exceptional_divisor
end
#########################################################################
# Forwarding attributes of toric morphisms based on `underlying_morphism`
#########################################################################
grid_morphism(bl::ToricBlowdownMorphism) = grid_morphism(underlying_morphism(bl))
morphism_on_torusinvariant_weil_divisor_group(bl::ToricBlowdownMorphism) = morphism_on_torusinvariant_weil_divisor_group(underlying_morphism(bl))
morphism_on_torusinvariant_cartier_divisor_group(bl::ToricBlowdownMorphism) = morphism_on_torusinvariant_cartier_divisor_group(underlying_morphism(bl))
morphism_on_class_group(bl::ToricBlowdownMorphism) = morphism_on_class_group(underlying_morphism(bl))
morphism_on_picard_group(bl::ToricBlowdownMorphism) = morphism_on_picard_group(underlying_morphism(bl))
#=
For the future, if traits seem better to forward methods as the ones immediately above (grid_morphism, morphism_on_torusinvariant_weil_divisor_group, etc.):
########################################################################
# Enabling the HasToricSubObjectTrait for ToricBlowdownMorphism #
########################################################################
HasToricSubObjectTrait(::Type{T}) where {T<:ToricBlowdownMorphism} = HasToricSubObjectTrait{ToricMorphism}()
toric_sub_object(bl::ToricBlowdownMorphism) = underlying_morphism(bl)
########################################################################
# Enabling the functionality in general #
########################################################################
function grid_morphism(phi::Any)
return _grid_morphism(HasToricSubObjectTrait(phi), phi)
end
function _grid_morphism(::HasToricSubObject, phi)
return grid_morphism(toric_sub_object(phi))
end
=#