Skip to content

Commit 9d8e01e

Browse files
committed
Option to restore old behaviour for point on variaty (change breaks pseudo-random seeding)
1 parent e06dd28 commit 9d8e01e

2 files changed

Lines changed: 5 additions & 2 deletions

File tree

syngular/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
UNICODEPOWERS = True # noqa, True or False
1919
NORMALIZE_POWERS_PATTERNS = () # eg. re.compile(r"(mt)(\d+)") will force mt2 to be treated as mt^2
2020
USE_ELLIPSIS_FOR_PRINT = False # noqa, toggles ellipsis in for str. Use locally for prints only.
21+
POINT_ON_VARIETY_RANDOM_SOLUTION = True # noqa, if False, will use the first root, otherwise a (seeded) random one is picked.
2122

2223
__all__ = [
2324
"__version__",

syngular/variety.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -251,8 +251,10 @@ def point_on_variety(self, field, base_point={}, directions=None, valuations=tup
251251
check_solutions(oSemiNumericalIdeal.groebner_basis, root_dicts, field) # they may be stricter then wanted for mpc.
252252

253253
try:
254-
# root_dict = root_dicts[0]
255-
root_dict = random.sample(root_dicts, 1)[0]
254+
if not syngular.POINT_ON_VARIETY_RANDOM_SOLUTION:
255+
root_dict = root_dicts[0]
256+
else:
257+
root_dict = random.sample(root_dicts, 1)[0]
256258
except (IndexError, ValueError):
257259
if not field.is_algebraically_closed:
258260
raise RootNotInFieldError(f"Got root_dicts: {root_dicts}, for lex Groebner basis:\n{oSemiNumericalIdeal.groebner_basis}.")

0 commit comments

Comments
 (0)