flint icon indicating copy to clipboard operation
flint copied to clipboard

Pretty parser for nmod_poly?

Open Sander80 opened this issue 1 year ago • 5 comments

Greetings! In the documentation and in the code there seem to be missing a "pretty format parser" for univariate modular polynomials. For multivariate there is a nmod_mpoly_set_str_pretty, but there is no analogue for univariate, only a parser for a special format. Is this intentional? Or perhaps there is a fast workaround to use a multivariate parser and then to translate nmod_mpoly_t into nmod_poly_t? A term cycle with nmod_poly_set_coeff_ui but is not this an overkill?

Sander80 avatar Apr 16 '24 07:04 Sander80

Until we add such a function, I suggest parsing to a multivariate using nmod_mpoly_set_str_pretty and converting using nmod_mpoly_get_nmod_poly.

fredrik-johansson avatar Apr 16 '24 10:04 fredrik-johansson

Sorry, cannot find nmod_mpoly_get_nmod_poly, which function did you mean?

Sander80 avatar Apr 16 '24 10:04 Sander80

It's apparently undocumented, but it's defined here: https://github.com/flintlib/flint/blob/90931337cf49fee23db7de578863f11878f291f9/src/nmod_mpoly.h#L490

fredrik-johansson avatar Apr 16 '24 10:04 fredrik-johansson

I see, thank you!

Sander80 avatar Apr 16 '24 10:04 Sander80

Works fine! Univariate functions like Evaluate are much faster that "multivariate with 1 variable"

Sander80 avatar Apr 16 '24 14:04 Sander80