The source code and dockerfile for the GSW2024 AI Lab.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
This repo is archived. You can view files and clone it, but cannot push or open issues/pull-requests.

29 lines
769 B

2 months ago
  1. from . import gmp
  2. from .gmp import *
  3. def numerator(x):
  4. if type(x) == gmp.RationalFunction or type(x) == gmp.Rational or type(x) == gmp.FactorizedRationalFunction:
  5. return x.numerator
  6. else:
  7. return x
  8. def denominator(x):
  9. if type(x) == gmp.RationalFunction or type(x) == gmp.Rational or type(x) == gmp.FactorizedRationalFunction:
  10. return x.denominator
  11. else:
  12. return 1
  13. def expand(x):
  14. if type(x) == gmp.FactorizedRationalFunction:
  15. return x.rational_function()
  16. if type(x) == gmp.FactorizedPolynomial:
  17. return x.polynomial()
  18. return x
  19. factorization_cache = gmp._FactorizationCache()
  20. def create_factorized_polynomial(polynomial):
  21. return gmp.FactorizedPolynomial(polynomial, factorization_cache)