Skip to content

Conversation

@fagu
Copy link
Contributor

@fagu fagu commented Nov 11, 2023

Some of the functions in nmod_poly_factor (sometimes) appended factors to the given factorization instead of replacing it. For example:

#include <cassert>
#include <flint/nmod_poly.h>
#include <flint/nmod_poly_factor.h>

int main() {
	nmod_poly_t f;
	nmod_poly_init(f, 5);
	nmod_poly_set_coeff_ui(f, 1, 1);
	nmod_poly_factor_t fac;
	nmod_poly_factor_init(fac);
	nmod_poly_factor_squarefree(fac, f);
	assert(fac->exp[0] == 1); // succeeds
	nmod_poly_factor_squarefree(fac, f);
	assert(fac->exp[0] == 1); // fails
	return 0;
}

The implementation of nmod_poly_factor_kaltofen_shoup assumed that nmod_poly_factor_distinct_deg appends the factors. I think either the documentation or the implementation of nmod_poly_factor_distinct_deg should be changed.

For nmod_poly_factor_equal_deg, I think a reasonable interpretation of the documentation is that the factors are appended, so I didn't change the behavior.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant