|
18 | 18 | #include "gr_vec.h" |
19 | 19 | #include "gr_poly.h" |
20 | 20 | #include "gr_generic.h" |
| 21 | +#include "gr_special.h" |
21 | 22 |
|
22 | 23 | static const char * default_var = "x"; |
23 | 24 |
|
@@ -325,6 +326,17 @@ polynomial_i(gr_poly_t res, gr_ctx_t ctx) |
325 | 326 | return status; |
326 | 327 | } |
327 | 328 |
|
| 329 | +int |
| 330 | +polynomial_pi(gr_poly_t res, gr_ctx_t ctx) |
| 331 | +{ |
| 332 | + int status; |
| 333 | + gr_poly_fit_length(res, 1, POLYNOMIAL_ELEM_CTX(ctx)); |
| 334 | + _gr_poly_set_length(res, 1, POLYNOMIAL_ELEM_CTX(ctx)); |
| 335 | + status = gr_pi(res->coeffs, POLYNOMIAL_ELEM_CTX(ctx)); |
| 336 | + _gr_poly_normalise(res, POLYNOMIAL_ELEM_CTX(ctx)); |
| 337 | + return status; |
| 338 | +} |
| 339 | + |
328 | 340 | int |
329 | 341 | polynomial_gen(gr_poly_t res, gr_ctx_t ctx) |
330 | 342 | { |
@@ -692,7 +704,6 @@ gr_method_tab_input _gr_poly_methods_input[] = |
692 | 704 | {GR_METHOD_ZERO, (gr_funcptr) polynomial_zero}, |
693 | 705 | {GR_METHOD_ONE, (gr_funcptr) polynomial_one}, |
694 | 706 | {GR_METHOD_NEG_ONE, (gr_funcptr) polynomial_neg_one}, |
695 | | - {GR_METHOD_I, (gr_funcptr) polynomial_i}, |
696 | 707 |
|
697 | 708 | {GR_METHOD_GEN, (gr_funcptr) polynomial_gen}, |
698 | 709 | {GR_METHOD_GENS, (gr_funcptr) gr_generic_gens_single}, |
@@ -742,6 +753,9 @@ gr_method_tab_input _gr_poly_methods_input[] = |
742 | 753 | {GR_METHOD_EUCLIDEAN_REM, (gr_funcptr) polynomial_euclidean_rem}, |
743 | 754 | {GR_METHOD_EUCLIDEAN_DIVREM, (gr_funcptr) polynomial_euclidean_divrem}, |
744 | 755 |
|
| 756 | + {GR_METHOD_I, (gr_funcptr) polynomial_i}, |
| 757 | + {GR_METHOD_PI, (gr_funcptr) polynomial_pi}, |
| 758 | + |
745 | 759 | {GR_METHOD_CANONICAL_ASSOCIATE, (gr_funcptr) polynomial_canonical_associate}, |
746 | 760 | {GR_METHOD_GCD, (gr_funcptr) polynomial_gcd}, |
747 | 761 |
|
|
0 commit comments