Skip to content

convert two methods to libsingular in affine subscheme #38367

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

Open
wants to merge 5 commits into
base: develop
Choose a base branch
from
Open
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
29 changes: 24 additions & 5 deletions src/sage/schemes/affine/affine_subscheme.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@
# ****************************************************************************

from sage.categories.fields import Fields
from sage.libs.singular.function import (singular_function,
lib as singular_lib,
get_printlevel, set_printlevel)
from sage.libs.singular.option import opt_verb
from sage.schemes.generic.algebraic_scheme import AlgebraicScheme_subscheme

from .affine_morphism import SchemeMorphism_polynomial_affine_subscheme_field
Expand Down Expand Up @@ -415,15 +419,22 @@ def intersection_multiplicity(self, X, P):
Iloc = R.ideal([f(chng_coords) for f in I.gens()])
Jloc = R.ideal([f(chng_coords) for f in J.gens()])
# compute the intersection multiplicity with Serre's Tor formula using Singular
from sage.interfaces.singular import singular
singular.lib("homolog.lib")
singular_lib("homolog.lib")
Tor = singular_function("Tor")
std = singular_function("std")
hilb = singular_function("hilb")
saved_printlevel = get_printlevel()
set_printlevel(-1)
opt_verb['not_warn_sb'] = True
i = 0
s = 0
t = sum(singular.Tor(i, Iloc, Jloc).std().hilb(2).sage())
t = sum(hilb(std(Tor(i, Iloc, Jloc)), 2))
while t != 0:
s += (-1)**i * t
i += 1
t = sum(singular.Tor(i, Iloc, Jloc).std().hilb(2).sage())
t = sum(hilb(std(Tor(i, Iloc, Jloc)), 2))
opt_verb.reset_default()
set_printlevel(saved_printlevel)
return s

def multiplicity(self, P):
Expand Down Expand Up @@ -497,7 +508,15 @@ def multiplicity(self, P):
chng_coords = [AA.gens()[i] + P[i] for i in range(AA.dimension_relative())]
R = AA.coordinate_ring().change_ring(order='negdegrevlex')
I = R.ideal([f(chng_coords) for f in self.defining_polynomials()])
return singular.mult(singular.std(I)).sage()
std = singular_function("std")
mult = singular_function("mult")
saved_printlevel = get_printlevel()
set_printlevel(-1)
opt_verb['not_warn_sb'] = True
result = mult(std(I))
opt_verb.reset_default()
set_printlevel(saved_printlevel)
return result


class AlgebraicScheme_subscheme_affine_field(AlgebraicScheme_subscheme_affine):
Expand Down
Loading