-
Notifications
You must be signed in to change notification settings - Fork 16
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
Fixed divrem bugs, added pseudo divrem #72
Conversation
…a constant by a polynomial.
@@ -669,7 +719,7 @@ void lp_polynomial_divrem(lp_polynomial_t* D, lp_polynomial_t* R, const lp_polyn | |||
lp_polynomial_set_context(D, A1->ctx); | |||
lp_polynomial_set_context(R, A1->ctx); | |||
|
|||
coefficient_divrem(D->ctx, &R->data, &R->data, &A1->data, &A2->data); | |||
coefficient_divrem(D->ctx, &D->data, &R->data, &A1->data, &A2->data); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice catch
@@ -220,7 +220,7 @@ void lp_polynomial_sub_mul(lp_polynomial_t* S, const lp_polynomial_t* A1, const | |||
* | |||
* and | |||
* | |||
* P in Z[y] | |||
* P in Z[x] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This conflicts with the comment of the coefficient_reduce method. Are you sure about this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I forgot to change this at coefficient_reduce as well.
@@ -159,4 +159,4 @@ def check_comparison(a1, a2, cmp, result, expected): | |||
p = functools.reduce(lambda x, y: x*y, sample, one) | |||
random.shuffle(sample) | |||
p = functools.reduce(lambda x, y: x/y, sample, p) | |||
polypy_test.check(p == 1) | |||
polypy_test.check(p == one) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nice catch
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
Thanks
coefficient_div
when dividing a constant by a non-constant polynomialcoefficient_divrem
when calling with two constant polynomialspolynomial_reduce
. Previously it expected lc divisibility rendering it just another divrem functionlp_polynomial_pdivrem
andlp_polynomial_spdivrem
for (sparse) pseudo division with remainder and added python bindings for itlp_polynomial_context
from polynomial.hdo {} while(0)
for multiple lines, use((void)0)
instead of empty command in release builds)