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

Cleanup some code related to dim(I) == -inf checks #4571

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all 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
12 changes: 6 additions & 6 deletions experimental/Schemes/src/Resolution_structure.jl
Original file line number Diff line number Diff line change
Expand Up @@ -150,8 +150,8 @@ function _exceptional_divisor_non_embedded(f::MixedBlowUpSequence)
ex_div_list = exceptional_divisor_list(f)
C = WeilDivisor(scheme(ex_div_list[1]),ZZ)
for i in 2:length(ex_div_list)
dim(ex_div_list[i]) == -inf && continue # kick out empty ones
C = C + weil_divisor(ex_div_list[i])
dim(ex_div_list[i]) === -inf && continue # kick out empty ones
C += weil_divisor(ex_div_list[i])
end

f.exceptional_divisor = C
Expand All @@ -165,11 +165,11 @@ function _exceptional_divisor_non_embedded(f::BlowUpSequence)
C = CartierDivisor(ambient_scheme(ex_div_list[1]),ZZ)
for i in 1:length(ex_div_list)
# do we want to introduce is_empty for divisors?
dim(ideal_sheaf(ex_div_list[i])) == -inf && continue # kick out empty ones
dim(ideal_sheaf(ex_div_list[i])) === -inf && continue # kick out empty ones
# caution: dim(CartierDivisor) is not computed,
# but inferred
# ==> need to pass to ideal_sheaf first
C = C + cartier_divisor(ex_div_list[i])
C += cartier_divisor(ex_div_list[i])
end

f.exceptional_divisor_on_X = C
Expand All @@ -190,8 +190,8 @@ function exceptional_locus(f::MixedBlowUpSequence)
# they might even have the wrong dimension
C = AlgebraicCycle(scheme(ex_div_list[1]),ZZ) # ==> we cannot expect to obtain a divisor, only a cycle
for E in ex_div_list
dim(E) != -inf || continue # kick out empty ones
C = C + algebraic_cycle(E)
dim(E) === -inf && continue # kick out empty ones
C += algebraic_cycle(E)
end

return C
Expand Down
37 changes: 18 additions & 19 deletions src/AlgebraicGeometry/Schemes/CoveredSchemes/Objects/Attributes.jl
Original file line number Diff line number Diff line change
Expand Up @@ -165,28 +165,27 @@ has_name(X::AbsCoveredScheme) = has_attribute(X, :name)
########################################################################
# Auxiliary attributes #
########################################################################
function dim(X::AbsCoveredScheme)
if !has_attribute(X, :dim)
d = -inf
is_equidimensional=true
for U in patches(default_covering(X))
e = dim(U)
if e > d
d == -inf || (is_equidimensional=false)
d = e
@attr Union{Int, NegInf} function dim(X::AbsCoveredScheme)
d = -inf
is_equidimensional=true
for U in patches(default_covering(X))
e = dim(U)
if e > d
if d !== -inf
is_equidimensional = false
end
d = e
end
set_attribute!(X, :dim, d)
if !is_equidimensional
# the above is not an honest check for equidimensionality,
# because in each chart the output of `dim` is only the
# supremum of all components. Thus we can only infer
# non-equidimensionality in case this is already visible
# from comparing the different charts
set_attribute!(X, :is_equidimensional, false)
end
end
return get_attribute(X, :dim)::Union{Int, NegInf}
if !is_equidimensional
# the above is not an honest check for equidimensionality,
# because in each chart the output of `dim` is only the
# supremum of all components. Thus we can only infer
# non-equidimensionality in case this is already visible
# from comparing the different charts
set_attribute!(X, :is_equidimensional, false)
end
return d
end

@attr Any function singular_locus_reduced(X::AbsCoveredScheme)
Expand Down
6 changes: 3 additions & 3 deletions src/Rings/mpoly-affine-algebras.jl
Original file line number Diff line number Diff line change
Expand Up @@ -151,11 +151,11 @@ julia> L = monomial_basis(A)
function monomial_basis(A::MPolyQuoRing)
@req coefficient_ring(A) isa AbstractAlgebra.Field "The coefficient ring must be a field"
is_finite_dimensional_vector_space(A) || throw(InfiniteDimensionError())
I = A.I
G = standard_basis(I)
if dim(I) == -inf # I is the whole ring
if is_trivial(A)
return elem_type(base_ring(A))[]
end
I = A.I
G = standard_basis(I)
si = Singular.kbase(singular_generators(G, G.ord))
return gens(MPolyIdeal(base_ring(I), si))
end
Expand Down
1 change: 0 additions & 1 deletion test/Rings/mpolyquo-localizations.jl
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
I = ideal(R, f)
Q, p = quo(R, I)
S = Oscar.MPolyComplementOfKPointIdeal(R, [QQ(1), QQ(0), QQ(1), QQ(0)])
T = Oscar.MPolyComplementOfKPointIdeal(R, [QQ(0), QQ(0), QQ(0), QQ(0)])
L, _ = localization(Q, S)
a = L(x)
b = L(y)
Expand Down
Loading