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

Conversation

1e9abhi1e10
Copy link
Contributor

This PR adds the benchmarks for the subresultants PRS method.
Related Issue:
#88

See sympy/sympy#25442

@1e9abhi1e10
Copy link
Contributor Author

1e9abhi1e10 commented Aug 26, 2023

@oscarbenjamin These errors occurs, Do We need to change these?

asv run --config asv.conf.actions.json
  shell: /usr/bin/bash -e {0}
  env:
    pythonLocation: /opt/hostedtoolcache/Python/[3](https://github.com/sympy/sympy_benchmarks/actions/runs/5982262043/job/16231134344?pr=97#step:6:3).10.12/x6[4](https://github.com/sympy/sympy_benchmarks/actions/runs/5982262043/job/16231134344?pr=97#step:6:4)
    LD_LIBRARY_PATH: /opt/hostedtoolcache/Python/3.10.12/x[6](https://github.com/sympy/sympy_benchmarks/actions/runs/5982262043/job/16231134344?pr=97#step:6:6)4/lib
Couldn't load asv.plugins.mamba because
No module named 'mamba'
Couldn't load asv.plugins.virtualenv because
No module named 'packaging'
· Unknown environment type 'virtualenv'
· No environments selected
Error: Process completed with exit code 1.

@oscarbenjamin
Copy link
Contributor

These errors occurs, Do We need to change these?

This is because of the new asv release. I'm not sure if this is fixed now.

@oscarbenjamin
Copy link
Contributor

Looks like it still fails.

@1e9abhi1e10 1e9abhi1e10 closed this Sep 2, 2023
@1e9abhi1e10 1e9abhi1e10 reopened this Sep 2, 2023
@1e9abhi1e10 1e9abhi1e10 reopened this Sep 10, 2023
benchmarks/polys.py Outdated Show resolved Hide resolved
benchmarks/polys.py Outdated Show resolved Hide resolved
benchmarks/polys.py Outdated Show resolved Hide resolved
benchmarks/polys.py Outdated Show resolved Hide resolved
@oscarbenjamin
Copy link
Contributor

The domain should just be returned by the make_poly function like:

return f, g, d, syms, ZZ

benchmarks/polys.py Outdated Show resolved Hide resolved
@1e9abhi1e10 1e9abhi1e10 reopened this Sep 14, 2023
Comment on lines 182 to 191
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

@oscarbenjamin
Copy link
Contributor

Why is x being passed here:

expected_gcd = gcd(f, g, x)

@oscarbenjamin oscarbenjamin merged commit 4c72b99 into sympy:master Sep 14, 2023
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants