@@ -592,15 +592,19 @@ Bit packing
592592 ``bit_size ``, negating the coefficients before packing
593593 if ``negate `` is set to `-1 `.
594594
595- .. function :: int _fmpz_poly_bit_unpack(fmpz * poly, slong len , nn_srcptr arr, flint_bitcnt_t bit_size, int negate)
595+ .. function :: int _fmpz_poly_bit_unpack(fmpz * poly, slong nlo, slong nhi , nn_srcptr arr, flint_bitcnt_t bit_size, int negate)
596596
597- Unpacks the polynomial of given length from the array as packed into
597+ Unpacks the polynomial of given length ` nhi ` from the array as packed into
598598 fields of the given ``bit_size ``, finally negating the coefficients
599599 if ``negate `` is set to `-1 `. Returns borrow, which is nonzero if a
600600 leading term with coefficient `\pm1 ` should be added at
601- position ``len `` of ``poly ``.
601+ position ``nhi `` of ``poly ``.
602+
603+ If `nlo ` is zero, all coefficients are unpacked; otherwise the
604+ coefficients in the range `[nlo, nhi) ` are unpacked and written to
605+ indices `[0, nhi-nlo) ` in ``poly ``.
602606
603- .. function :: void _fmpz_poly_bit_unpack_unsigned(fmpz * poly, slong len , nn_srcptr arr, flint_bitcnt_t bit_size)
607+ .. function :: void _fmpz_poly_bit_unpack_unsigned(fmpz * poly, slong nlo, slong nhi , nn_srcptr arr, flint_bitcnt_t bit_size)
604608
605609 Unpacks the polynomial of given length from the array as packed into
606610 fields of the given ``bit_size ``. The coefficients are assumed to
@@ -669,19 +673,24 @@ Multiplication
669673 remainder to the corresponding coefficients of the product of ``poly1 ``
670674 and ``poly2 ``.
671675
672- .. function :: void _fmpz_poly_mulmid_classical(fmpz * res, const fmpz * poly1, slong len1, const fmpz * poly2, slong len2)
676+ .. function :: void _fmpz_poly_mulmid_classical(fmpz * res, const fmpz * poly1, slong len1, const fmpz * poly2, slong len2, slong nlo, slong nhi)
677+ void _fmpz_poly_mulmid_KS(fmpz * res, const fmpz * poly1, slong len1, const fmpz * poly2, slong len2, slong nlo, slong nhi)
678+ void _fmpz_poly_mulmid_SS(fmpz * res, const fmpz * poly1, slong len1, const fmpz * poly2, slong len2, slong nlo, slong nhi)
679+ void _fmpz_poly_mulmid(fmpz * res, const fmpz * poly1, slong len1, const fmpz * poly2, slong len2, slong nlo, slong nhi)
673680
674- Sets ``res `` to the middle `` len1 - len2 + 1 `` coefficients of
675- the product of ``(poly1, len1) `` and ``(poly2, len2) ``, i.e. the
676- coefficients from degree `` len2 - 1 `` to ``len1 - 1 `` inclusive.
677- Assumes that `` len1 >= len2 > 0 ` `.
681+ Sets ``( res, nhi - nlo) `` to the coefficients at indices ` [nlo, nhi) `
682+ in the full product of ``(poly1, len1) `` and ``(poly2, len2) ``.
683+ Assumes that `` len1 `` and ``len2 `` are positive and that
684+ ` 0 \le nlo < nhi \le len1 + len2 - 1 `.
678685
679686.. function :: void fmpz_poly_mulmid_classical(fmpz_poly_t res, const fmpz_poly_t poly1, const fmpz_poly_t poly2)
687+ void fmpz_poly_mulmid_KS(fmpz_poly_t res, const fmpz_poly_t poly1, const fmpz_poly_t poly2)
688+ void fmpz_poly_mulmid_SS(fmpz_poly_t res, const fmpz_poly_t poly1, const fmpz_poly_t poly2)
689+ void fmpz_poly_mulmid(fmpz_poly_t res, const fmpz_poly_t poly1, const fmpz_poly_t poly2)
680690
681- Sets ``res `` to the middle ``len(poly1) - len(poly2) + 1 ``
682- coefficients of ``poly1 * poly2 ``, i.e. the coefficient from degree
683- ``len2 - 1 `` to ``len1 - 1 `` inclusive. Assumes that
684- ``len1 >= len2 ``.
691+ Sets ``res `` to the polynomial formed by the coefficients at indices `[nlo, nhi) `
692+ in the product of ``poly1 `` and ``poly2 ``. Equivalently, compute
693+ `[(poly1 \cdot poly2) \bmod x^{nhi}] / x^{nlo} `.
685694
686695.. function :: void _fmpz_poly_mul_karatsuba(fmpz * res, const fmpz * poly1, slong len1, const fmpz * poly2, slong len2)
687696
@@ -748,10 +757,10 @@ Multiplication
748757 Sets ``res `` to the lowest `n ` coefficients of the product of
749758 ``poly1 `` and ``poly2 ``.
750759
751- .. function :: void _fmpz_poly_mul_SS(fmpz * output , const fmpz * input1 , slong length1 , const fmpz * input2 , slong length2 )
760+ .. function :: void _fmpz_poly_mul_SS(fmpz * res , const fmpz * poly1 , slong len1 , const fmpz * poly2 , slong len2 )
752761
753- Sets ``(output, length1 + length2 - 1) `` to the product of
754- ``(input1, length1 ) `` and ``(input2, length2 ) ``.
762+ Sets ``(res, len1 + len2 - 1) `` to the product of
763+ ``(poly1, len1 ) `` and ``(poly2, len2 ) ``.
755764
756765 We must have ``len1 > 1 `` and ``len2 > 1 ``. Allows zero-padding
757766 of the two input polynomials. Supports aliasing of inputs and outputs.
@@ -761,7 +770,7 @@ Multiplication
761770 Sets ``res `` to the product of ``poly1 `` and ``poly2 ``. Uses the
762771 Schönhage-Strassen algorithm.
763772
764- .. function :: void _fmpz_poly_mullow_SS(fmpz * output , const fmpz * input1 , slong length1 , const fmpz * input2 , slong length2 , slong n)
773+ .. function :: void _fmpz_poly_mullow_SS(fmpz * res , const fmpz * poly1 , slong len1 , const fmpz * poly2 , slong len2 , slong n)
765774
766775 Sets ``(res, n) `` to the lowest `n ` coefficients of the product of
767776 ``(poly1, len1) `` and ``(poly2, len2) ``.
@@ -783,7 +792,6 @@ Multiplication
783792 zero-padding of the two input polynomials. Does not support aliasing
784793 between the inputs and the output.
785794
786-
787795.. function :: void fmpz_poly_mul(fmpz_poly_t res, const fmpz_poly_t poly1, const fmpz_poly_t poly2)
788796
789797 Sets ``res `` to the product of ``poly1 `` and ``poly2 ``. Chooses
0 commit comments