flintlib / flint

FLINT (Fast Library for Number Theory)
http://www.flintlib.org
GNU Lesser General Public License v3.0
404 stars 236 forks source link

Pretty parser for nmod_poly? #1923

Open Sander80 opened 2 months ago

Sander80 commented 2 months ago

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?

fredrik-johansson commented 2 months ago

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.

Sander80 commented 2 months ago

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

fredrik-johansson commented 2 months ago

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

Sander80 commented 2 months ago

I see, thank you!

Sander80 commented 2 months ago

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