python - sympy.geometry Point class is working slow -
i have code reads unstructured mesh. wrote wrappers around geometric entities of sympy.geometry
such as:
class point: def __init__(self, x, y, parent_mesh): self.shape = sympy.geometry.point(x,y) self.parent_mesh = parent_mesh self.parent_cell = list()
everything works fine initialization of sympy.geometry.point
takes lot of time each point
. actually, code did not finish execution thousands of points. similar code written in c++ finished in few seconds. without code fast enough (i removed , timed). read possible reason sympy.geometry
converts floating point numbers rationals precision. there way (flag) speed sympy.geometry
not need exact precision?
take @ point
class documentation, specifically, in 1 of first examples:
floats automatically converted rational unless evaluate flag
false
.
so, pass flag named evaluate
during initialization of point
classes:
self.shape = sympy.geometry.point(x,y, evaluate=false)
which apparently signals you're after.
Comments
Post a Comment