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

Replace type declarations #2981

Merged
merged 3 commits into from
Nov 5, 2023
Merged
Show file tree
Hide file tree
Changes from 2 commits
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
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,8 @@ given by the pullback function
(y//z) -> 0
```
"""
function covering_morphism(f::AbsCoveredSchemeMorphism)::CoveringMorphism
return covering_morphism(underlying_morphism(f))
function covering_morphism(f::AbsCoveredSchemeMorphism)
return covering_morphism(underlying_morphism(f))::CoveringMorphism
end

### generically derived getters
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ julia> integrate(cohomology_class(anticanonical_divisor_class(X))^3)
62
```
"""
function integrate(c::CohomologyClass)::QQFieldElem
function integrate(c::CohomologyClass)
# can only integrate if the variety is simplicial, complete
@req is_simplicial(toric_variety(c)) && is_complete(toric_variety(c)) "Integration only supported over complete and simplicial toric varieties"

Expand All @@ -97,30 +97,30 @@ function integrate(c::CohomologyClass)::QQFieldElem
intersection_dict = _intersection_form_via_exponents(toric_variety(c))
coeffs = coefficients(c)
expos = exponents(c)
integral = 0
integral = zero(QQ)
for i in 1:nrows(expos)
if expos[i, :] in keys(intersection_dict)
integral += coeffs[i] * intersection_dict[expos[i, :]]
end
end
return integral
return integral::QQFieldElem
end

# otherwise, proceed "by hand"
if is_trivial(c)
return 0
return zero(QQ)
end
poly = polynomial(c)
dict = homogeneous_components(poly)
elem = base_ring(parent(poly)).D([dim(toric_variety(c))])
if !(elem in keys(dict))
return 0
return zero(QQ)
end
top_form = dict[elem]
if iszero(top_form)
return 0
return zero(QQ)
end
n = AbstractAlgebra.leading_coefficient(top_form.f)
m = AbstractAlgebra.leading_coefficient(polynomial(volume_form(toric_variety(c))).f)
return QQFieldElem(n//m)
return QQFieldElem(ZZ(n),ZZ(m))
fingolfin marked this conversation as resolved.
Show resolved Hide resolved
end
6 changes: 3 additions & 3 deletions src/Rings/mpoly-affine-algebras.jl
Original file line number Diff line number Diff line change
Expand Up @@ -369,21 +369,21 @@ julia> hilbert_polynomial(A)
3*t + 1
```
"""
function hilbert_polynomial(A::MPolyQuoRing)::QQPolyRingElem
function hilbert_polynomial(A::MPolyQuoRing)
if iszero(A.I)
R = base_ring(A.I)
@req is_standard_graded(R) "The base ring must be standard ZZ-graded"
n = ngens(A)
Qt, t = QQ["t"]
b = one(parent(t))
b = one(Qt)
for i in QQ(1):QQ(n-1)
b = b * (t+i)
end
b = b/QQ(factorial(n-1))
return b
end
H = HilbertData(A.I)
return hilbert_polynomial(H)
return hilbert_polynomial(H)::QQPolyRingElem
end

@doc raw"""
Expand Down