Skip to content

Commit 5eb8f29

Browse files
Merge pull request #2359 from fredrik-johansson/cov2
Improve test coverage of gr_series; minor fixes
2 parents 4012681 + 4d2c701 commit 5eb8f29

4 files changed

Lines changed: 489 additions & 293 deletions

File tree

src/gr/polynomial.c

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
#include "gr_vec.h"
1919
#include "gr_poly.h"
2020
#include "gr_generic.h"
21+
#include "gr_special.h"
2122

2223
static const char * default_var = "x";
2324

@@ -325,6 +326,17 @@ polynomial_i(gr_poly_t res, gr_ctx_t ctx)
325326
return status;
326327
}
327328

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+
328340
int
329341
polynomial_gen(gr_poly_t res, gr_ctx_t ctx)
330342
{
@@ -692,7 +704,6 @@ gr_method_tab_input _gr_poly_methods_input[] =
692704
{GR_METHOD_ZERO, (gr_funcptr) polynomial_zero},
693705
{GR_METHOD_ONE, (gr_funcptr) polynomial_one},
694706
{GR_METHOD_NEG_ONE, (gr_funcptr) polynomial_neg_one},
695-
{GR_METHOD_I, (gr_funcptr) polynomial_i},
696707

697708
{GR_METHOD_GEN, (gr_funcptr) polynomial_gen},
698709
{GR_METHOD_GENS, (gr_funcptr) gr_generic_gens_single},
@@ -742,6 +753,9 @@ gr_method_tab_input _gr_poly_methods_input[] =
742753
{GR_METHOD_EUCLIDEAN_REM, (gr_funcptr) polynomial_euclidean_rem},
743754
{GR_METHOD_EUCLIDEAN_DIVREM, (gr_funcptr) polynomial_euclidean_divrem},
744755

756+
{GR_METHOD_I, (gr_funcptr) polynomial_i},
757+
{GR_METHOD_PI, (gr_funcptr) polynomial_pi},
758+
745759
{GR_METHOD_CANONICAL_ASSOCIATE, (gr_funcptr) polynomial_canonical_associate},
746760
{GR_METHOD_GCD, (gr_funcptr) polynomial_gcd},
747761

0 commit comments

Comments
 (0)