Skip to content

Commit

Permalink
python/sage_helper.py: Move imports from nsagetools here
Browse files Browse the repository at this point in the history
  • Loading branch information
mkoeppe committed Jan 1, 2025
1 parent 2ded24e commit be964e4
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 18 deletions.
8 changes: 6 additions & 2 deletions python/sage_helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,11 @@ def sage_method(function):
from sage.all import (cached_method, real_part, imag_part, round, ceil, floor, log,
CDF, ComplexField, NumberField, PolynomialRing, identity_matrix)
from sage.all import VectorSpace
from sage.all import ComplexBallField, exp, sin, block_matrix, prime_range
from sage.all import ComplexBallField, exp, sin, block_matrix, prime_range, det
from sage.all import LaurentPolynomialRing, AbelianGroup, GroupAlgebra
except ImportError:
# Modularized Sage library
from sage.algebras.group_algebra import GroupAlgebra
from sage.arith.misc import gcd, xgcd
from sage.combinat.subset import powerset
from sage.functions.hyperbolic import arccosh
Expand All @@ -46,11 +48,12 @@ def sage_method(function):
ceil,
floor)
from sage.functions.trig import sin
from sage.groups.abelian_gps.abelian_group import AbelianGroup
from sage.matrix.constructor import Matrix as matrix
from sage.matrix.matrix_space import MatrixSpace
from sage.matrix.special import block_matrix, identity_matrix
from sage.misc.cachefunc import cached_method
from sage.misc.functional import log, round, sqrt
from sage.misc.functional import det, log, round, sqrt
from sage.misc.misc_c import prod
from sage.modules.free_module import VectorSpace
from sage.modules.free_module_element import free_module_element as vector
Expand All @@ -64,6 +67,7 @@ def sage_method(function):
from sage.rings.infinity import Infinity
from sage.rings.integer import Integer
from sage.rings.integer_ring import ZZ
from sage.rings.polynomial.laurent_polynomial_ring import LaurentPolynomialRing
from sage.rings.number_field.number_field import NumberField
from sage.rings.polynomial.polynomial_ring_constructor import PolynomialRing
from sage.rings.rational import Rational
Expand Down
18 changes: 2 additions & 16 deletions python/snap/nsagetools.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,22 +5,8 @@
from ..sage_helper import _within_sage, sage_method

if _within_sage:
import sage
from sage.rings.integer_ring import Z as ZZ
from sage.modules.free_module_element import free_module_element as vector
from sage.matrix.constructor import Matrix as matrix
from sage.matrix.special import block_matrix
from sage.matrix.special import identity_matrix
from sage.arith.misc import GCD as gcd
from sage.misc.misc_c import prod
from sage.misc.functional import det
from sage.matrix.matrix_space import MatrixSpace
from sage.groups.abelian_gps.abelian_group import AbelianGroup
from sage.algebras.group_algebra import GroupAlgebra
from sage.structure.sage_object import SageObject
from sage.rings.polynomial.polynomial_ring_constructor import PolynomialRing
from sage.rings.polynomial.laurent_polynomial_ring import LaurentPolynomialRing

from ..sage_helper import ZZ, vector, matrix, block_matrix, identity_matrix, gcd, prod, det
from ..sage_helper import MatrixSpace, PolynomialRing, SageObject, AbelianGroup, GroupAlgebra
from .polished_reps import polished_holonomy, MatrixRepresentation
Id2 = MatrixSpace(ZZ, 2)(1)
else:
Expand Down

0 comments on commit be964e4

Please sign in to comment.