sage: Ensure that constraints are always fastfracs

Even if they are constants created in the formula functions. We now
lift integer constants to fastfracs.
This commit is contained in:
Tim Ruffing 2022-02-04 15:06:58 +01:00
parent d8d54859ed
commit ebb1beea78
2 changed files with 5 additions and 0 deletions

View File

@ -164,6 +164,9 @@ class constraints:
def negate(self):
return constraints(zero=self.nonzero, nonzero=self.zero)
def map(self, fun):
return constraints(zero={fun(k): v for k, v in self.zero.items()}, nonzero={fun(k): v for k, v in self.nonzero.items()})
def __add__(self, other):
zero = self.zero.copy()
zero.update(other.zero)

View File

@ -251,6 +251,8 @@ def check_symbolic_jacobian_weierstrass(name, A, B, branches, formula):
ret = True
for branch in range(branches):
assumeFormula, assumeBranch, pC = formula(branch, pA, pB)
assumeBranch = assumeBranch.map(lift)
assumeFormula = assumeFormula.map(lift)
pC.X = lift(pC.X)
pC.Y = lift(pC.Y)
pC.Z = lift(pC.Z)