Skip to content

Commit 3473f0c

Browse files
Merge pull request #2312 from mezzarobba/shiftless
Shift equivalence, dispersion, and shiftless decomposition of generic polynomials
2 parents 55fbf97 + 915ba64 commit 3473f0c

16 files changed

+1296
-0
lines changed

doc/source/gr.rst

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -230,6 +230,14 @@ that the value is not computable:
230230

231231
.. function:: void truth_println(truth_t x)
232232

233+
.. function:: truth_t gr_in_domain(int status)
234+
235+
Returns ``T_TRUE`` when ``status`` is ``GR_SUCCESS``, ``T_FALSE`` when ``GR_DOMAIN`` is set but ``GR_UNABLE`` is not, and ``T_UNKNOWN`` otherwise.
236+
237+
.. function:: int gr_check(truth_t t)
238+
239+
Maps ``T_TRUE`` to ``GR_SUCCESS``, ``T_FALSE`` to ``GR_DOMAIN``, and ``T_UNKNOWN`` to ``GR_UNABLE``.
240+
233241
Context operations
234242
-------------------------------------------------------------------------------
235243

doc/source/gr_poly.rst

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -780,6 +780,82 @@ TODO: currently only fields of characteristic 0 are supported.
780780

781781
Sets *res* to the squarefreepart of *poly*.
782782

783+
Shift equivalence
784+
-------------------------------------------------------------------------------
785+
786+
.. function:: truth_t gr_poly_shift_equivalent(fmpz_t shift, const gr_poly_t p, const gr_poly_t q, gr_ctx_t ctx)
787+
788+
Returns whether there exists an integer *n* such that `p(x + n) = q(x)`. If
789+
the result is ``T_TRUE`` and *shift* is not ``NULL``, *shift* is set to
790+
such an *n*.
791+
792+
.. function:: int gr_poly_leading_taylor_shift(gr_ptr shift, const gr_poly_t p, const gr_poly_t q, gr_ctx_t ctx)
793+
794+
Computes (if possible) *s* such that `p(x+s) = q(x)(1+O(x^2))`.
795+
796+
.. function:: int gr_poly_dispersion_resultant(fmpz_t disp, gr_vec_t disp_set, const gr_poly_t f, const gr_poly_t g, gr_ctx_t ctx);
797+
int gr_poly_dispersion_factor(fmpz_t disp, gr_vec_t disp_set, const gr_poly_t f, const gr_poly_t g, gr_ctx_t ctx);
798+
int gr_poly_dispersion(fmpz_t disp, gr_vec_t disp_set, const gr_poly_t f, const gr_poly_t g, gr_ctx_t ctx);
799+
800+
Computes the dispersion and/or the dispersion set of *f* and *g*.
801+
802+
The dispersion set of two polynomials *f* and *g* (over a unique
803+
factorization domain of characteristic zero) is the set of nonnegative
804+
integers *n* such that `f(x + n)` and `g(x)` have a nonconstant common
805+
factor. The dispersion is the largest element of the dispersion set.
806+
807+
The output variables *disp* and/or *disp_set* can be ``NULL``, in which case
808+
the corresponding result is not stored.
809+
When the dispersion set is empty, *disp* is left unchanged.
810+
The elements of *disp_set* are sorted in increasing order.
811+
812+
The *factor* version uses the algorithm described in [ManWright1994]_.
813+
The *resultant* version computes the integer roots of a bivariate resultant
814+
and is mainly intended for testing.
815+
816+
.. function:: int gr_poly_dispersion_from_factors(fmpz_t disp, gr_vec_t disp_set, const gr_vec_t ffac, const gr_vec_t gfac, gr_ctx_t ctx);
817+
818+
Same as :func:`gr_poly_dispersion_factor` for nonzero *f* and *g* but takes
819+
as input their nonconstant irreducible factors (without multiplicities)
820+
instead of the polynomials themselves.
821+
822+
.. function:: int gr_poly_shiftless_decomposition_factor(gr_ptr c, gr_vec_t slfac, gr_vec_t slshifts, gr_vec_t slmult, const gr_poly_t f, gr_ctx_t ctx)
823+
int gr_poly_shiftless_decomposition(gr_ptr c, gr_vec_t slfac, gr_vec_t slshifts, gr_vec_t slmult, const gr_poly_t f, gr_ctx_t ctx)
824+
825+
826+
Computes a decomposition of *f* of the form
827+
828+
.. math:: c \prod_i \prod_j g_i(x + h_{i,j})^{e_{i,j}}
829+
830+
where
831+
832+
* `c` is a constant,
833+
* the `g_i` are squarefree polynomials of degree at least one,
834+
* `g_i(x)` and `g_j(x + h)` (with `i \neq j`) are coprime for all
835+
`h \in \mathbb Z`,
836+
* `g_i(x)` and `g_i(x + h)` are coprime for all nonzero `h \in \mathbb Z`,
837+
* `e_{i,j}` and `h_{i,j}` are integers with `e_{i,j} \geq 1`
838+
and `0 = h_{i,1} < h_{i,2} < \cdots`.
839+
840+
The output variable *slfac* must be initialized to a vector of polynomials
841+
of the same type as *f*. The other two output vectors *slshift* and
842+
*slmult* must be initialized to vectors *of vectors* with entries of type
843+
*fmpz*.
844+
845+
The *factor* version computes an irreducible factorization and sorts the
846+
factors into shift-equivalence classes.
847+
848+
No algorithm avoiding a full irreducible factorization is currently
849+
implemented.
850+
851+
.. function:: int _gr_poly_shiftless_decomposition_from_factors(gr_vec_t slfac, gr_vec_t slshifts, gr_vec_t slmult, const gr_vec_t fac, const gr_vec_t mult, gr_ctx_t ctx)
852+
int gr_poly_shiftless_decomposition_from_factors(gr_vec_t slfac, gr_vec_t slshifts, gr_vec_t slmult, const gr_vec_t fac, const gr_vec_t mult, gr_ctx_t ctx)
853+
854+
Same as :func:`gr_poly_shiftless_decomposition_factor` but takes as input
855+
an irreducible factorization (*fac*, *mult*) of *f* (without the
856+
prefactor *c*). The underscore method does not support aliasing of *slfac*
857+
with *fac*.
858+
783859
Roots
784860
-------------------------------------------------------------------------------
785861

doc/source/references.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -223,6 +223,8 @@ References
223223
224224
.. [Lüb2004] \F. Lübeck, "Conway polynomials for finite fields", RTWH Aachen, https://www.math.rwth-aachen.de/~Frank.Luebeck/data/ConwayPol/index.html, (accessed 2024-01-12)
225225
226+
.. [ManWright1994] \Y.-K. Man and F. J. Wright. "Fast polynomial dispersion computation and its application to indefinite summation". Proceedings of the International Symposium on Symbolic and Algebraic Computation (1994), 175-180. https://doi.org/10.1145/190347.190413
227+
226228
.. [MN2019] \P. Molin and C. Neurohr, "Computing period matrices and the Abel--Jacobi map of superelliptic curves", Math. Comp. 88:316 (2019), 847--888.
227229
228230
.. [MP2006] \M. Monagan and R. Pearce. "Rational simplification modulo a polynomial ideal". Proceedings of the 2006 international symposium on Symbolic and algebraic computation - ISSAC '06. https://doi.org/10.1145/1145768.1145809

src/gr.h

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,28 @@ GR_INLINE truth_t truth_not(truth_t x)
5151
return T_UNKNOWN;
5252
}
5353

54+
GR_INLINE truth_t gr_in_domain(int status)
55+
{
56+
if (status == GR_SUCCESS)
57+
return T_TRUE;
58+
else if (status & GR_UNABLE)
59+
return T_UNKNOWN;
60+
else if (status & GR_DOMAIN)
61+
return T_FALSE;
62+
else
63+
return T_UNKNOWN;
64+
}
65+
66+
GR_INLINE int gr_check(truth_t t)
67+
{
68+
if (t == T_TRUE)
69+
return GR_SUCCESS;
70+
else if (t == T_FALSE)
71+
return GR_DOMAIN;
72+
else
73+
return GR_UNABLE;
74+
}
75+
5476
GR_INLINE void truth_println(truth_t x)
5577
{
5678
if (x == T_TRUE) flint_printf("T_TRUE\n");

src/gr_poly.h

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -429,6 +429,22 @@ WARN_UNUSED_RESULT int gr_poly_evaluate_vec_iter(gr_vec_t ys, const gr_poly_t po
429429
int gr_poly_factor_squarefree(gr_ptr c, gr_vec_t fac, gr_vec_t exp, const gr_poly_t F, gr_ctx_t ctx);
430430
int gr_poly_squarefree_part(gr_poly_t res, const gr_poly_t poly, gr_ctx_t ctx);
431431

432+
/* Shift factorization */
433+
434+
WARN_UNUSED_RESULT int gr_poly_leading_taylor_shift(gr_ptr shift, const gr_poly_t p, const gr_poly_t q, gr_ctx_t ctx);
435+
436+
truth_t gr_poly_shift_equivalent(fmpz_t shift, const gr_poly_t p, const gr_poly_t q, gr_ctx_t ctx);
437+
438+
WARN_UNUSED_RESULT int gr_poly_dispersion_resultant(fmpz_t disp, gr_vec_t disp_set, const gr_poly_t f, const gr_poly_t g, gr_ctx_t ctx);
439+
WARN_UNUSED_RESULT int gr_poly_dispersion_from_factors(fmpz_t disp, gr_vec_t disp_set, const gr_vec_t ffac, const gr_vec_t gfac, gr_ctx_t ctx);
440+
WARN_UNUSED_RESULT int gr_poly_dispersion_factor(fmpz_t disp, gr_vec_t disp_set, const gr_poly_t f, const gr_poly_t g, gr_ctx_t ctx);
441+
WARN_UNUSED_RESULT int gr_poly_dispersion(fmpz_t disp, gr_vec_t disp_set, const gr_poly_t f, const gr_poly_t g, gr_ctx_t ctx);
442+
443+
WARN_UNUSED_RESULT int _gr_poly_shiftless_decomposition_from_factors(gr_vec_t slfac, gr_vec_t slshifts, gr_vec_t slmult, const gr_vec_t fac, const gr_vec_t mult, gr_ctx_t ctx);
444+
WARN_UNUSED_RESULT int gr_poly_shiftless_decomposition_from_factors(gr_vec_t slfac, gr_vec_t slshifts, gr_vec_t slmult, const gr_vec_t fac, const gr_vec_t mult, gr_ctx_t ctx);
445+
WARN_UNUSED_RESULT int gr_poly_shiftless_decomposition_factor(gr_ptr c, gr_vec_t slfac, gr_vec_t slshifts, gr_vec_t slmult, const gr_poly_t pol, gr_ctx_t ctx);
446+
WARN_UNUSED_RESULT int gr_poly_shiftless_decomposition(gr_ptr c, gr_vec_t slfac, gr_vec_t slshifts, gr_vec_t slmult, const gr_poly_t pol, gr_ctx_t ctx);
447+
432448
/* Roots */
433449

434450
int _gr_poly_refine_roots_aberth(gr_ptr w, gr_srcptr f, gr_srcptr f_prime, slong deg, gr_srcptr z, int progressive, gr_ctx_t ctx);

0 commit comments

Comments
 (0)