Skip to content

Commit f23f7fe

Browse files
authored
Refine mres resolution length check for Singular
Adjust handling of mres to account for trailing zero module in Singular.
1 parent aa27703 commit f23f7fe

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

src/sage/geometry/hyperplane_arrangement/arrangement.py

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3472,7 +3472,20 @@ def is_free(self, algorithm='singular') -> bool:
34723472
if algorithm == "singular":
34733473
# TODO: Implement this using libSingular
34743474
mres = self.defining_polynomial().jacobian_ideal()._singular_().mres(0)
3475-
return len(mres) <= 2
3475+
# Newer versions of Singular include a trailing zero module (R^0).
3476+
# Check if the last element is trivial and exclude it from the count.
3477+
resolution_length = len(mres)
3478+
if resolution_length > 0:
3479+
try:
3480+
sing = mres.parent()
3481+
last_elem = mres[resolution_length]
3482+
# Check if this element is the zero module using size()
3483+
size_val = int(sing.eval(f"size({last_elem.name()})"))
3484+
if size_val == 0: # Trailing zero module
3485+
resolution_length -= 1
3486+
except:
3487+
pass
3488+
return resolution_length <= 2
34763489
elif algorithm == "BC":
34773490
return self.derivation_module_free_chain() is not None
34783491
else:

0 commit comments

Comments
 (0)