Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add benchmarks for GCD when input is Gaussian Integer #97

Merged
merged 7 commits into from
Sep 14, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 4 additions & 21 deletions benchmarks/polys.py
Original file line number Diff line number Diff line change
Expand Up @@ -180,32 +180,15 @@ class _GaussianInteger(_GCDExample):
"""An example of Polynomial using Gaussian Integer"""

def make_poly(self, n):
x, y1, y2, y3, y4, y5, y6 = syms = symbols("x y1 y2 y3 y4 y5 y6")
x, y1, y2, y3, y4, y5 = syms = symbols("x y1 y2 y3 y4 y5")

d = (-x + I*y1)*n

f = ((-I*(x)**4 - (x)**3 + I*(x)**2 + (x) + -I*(y2 + 1) - y1*(y3 + 1) -
2*y1*y2 - 5*y1*(y2 + 1) - y1*(y3 + 1) -
I*y4 + I*y6 + -y1*(y2 + 1) - 3*y1*y3 - y1*(y3 + 1) - I*y5 -
2*y1*y2 - 7*y1*(y2 + 1) - 3*y1*y3 - 5*y1*(y3 + 1) - I*(y4 + y5) -
y1*y2 - 2*y1*(y2 + 1) - y1*y3 - 3*y1*(y3 + 1) - I*(-y4 + y5) +
y1*(y2 + 1) + -y1*y2 - 5*y1*y3 - y1*(y3 + 1) - I*y5 + -I*y6 -
3*y1*(y2 + 1) - y1*y3 - 7*y1*(y3 + 1) + I*y5 + -y1*y2 + y1*(y3 + 1)
+ 5*y1*(y3 + 1) + -y1*y2 - y1*(y2 + 1) - y1*y3 + y1*y2 + y1*y3 +
7*y1*(y3 + 1) + y1*(y2 + 1) + y1*y3)*d)

g = ((-I*(x)**4 - (x)**3 + I*(x)**2 + (x) + -I*(y2 + 1) - y1*(y3 + 1) -
7*y1*y2 - y1*(y2 + 1) - y1*(y3 + 1) -
I*y4 + I*y6 - y1*(y2 + 1) - 3*y1*y3 - y1*(y3 + 1) - I*y5 -
y1*y2 - 7*y1*(y2 + 1) - 5*y1*y3 - 2*y1*(y3 + 1) - I*(y4 + y5) -
3*y1*y2 - 5*y1*(y2 + 1) - 9*y1*y3 - 7*y1*(y3 + 1) -
I*(-y4 + y5) + y1*(y2 + 1) + -y1*y2 - y1*y3 - y1*(y3 + 1) -
I*y5 + -I*y6 + -y1*(y2 + 1) - y1*y3 - y1*(y3 + 1) + I*y5 - 3*y1*y2
+ y1*(y3 + 1) + y1*(y3 + 1) + -y1*y2 - y1*(y2 + 1) - y1*y3 +
y1*y2 + y1*y3 + y1*(y3 + 1) + y1*(y2 + 1) + y1*y3)*d)
f = (-I*x**n - 2*y1*y3 - I*(-y2 + n) - I*(y4 + y5))*d

return f, g, d, syms, ZZ_I
g = (-I*x**(n + 1) - 2*y1*(y3 + n) - I*(-y2 + n + 1) - I*(y4 + y5))*d

return f, g, d, syms, ZZ_I
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why has the example been changed?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In the revised example, I identified duplicate terms, and when I simplified the expression, it resulted in a shorter and more concise form


class _TimeOP:
"""
Expand Down