From c123f785dce15feaa2681b615aaf51561ae795be Mon Sep 17 00:00:00 2001 From: Vincent Delecroix Date: Sat, 14 Oct 2023 10:35:05 +0200 Subject: [PATCH 1/4] proper declaration for FLINT_BIT_COUNT --- doc/source/flint.rst | 6 ++++-- doc/source/fmpq.rst | 5 +++++ doc/source/fmpz_mat.rst | 5 +++++ 3 files changed, 14 insertions(+), 2 deletions(-) diff --git a/doc/source/flint.rst b/doc/source/flint.rst index e3efe136d6..287ee183d3 100644 --- a/doc/source/flint.rst +++ b/doc/source/flint.rst @@ -31,8 +31,10 @@ to avoid problems with integer promotion. Similar to the previous macro, ``FLINT_MAX(x, y)`` returns the maximum of `x` and `y`. -The function ``FLINT_BIT_COUNT(x)`` returns the number of binary bits -required to represent an ``ulong x``. If `x` is zero, returns `0`. +.. function:: mp_limb_t FLINT_BIT_COUNT(mp_limb_t x) + + Returns the number of binary bits required to represent an ``ulong x``. If + `x` is zero, returns `0`. Derived from this there are the two macros ``FLINT_FLOG2(x)`` and ``FLINT_CLOG2(x)`` which, for any `x \geq 1`, compute `\lfloor \log_2 x \rfloor` diff --git a/doc/source/fmpq.rst b/doc/source/fmpq.rst index 93913dfffa..2555690d6d 100644 --- a/doc/source/fmpq.rst +++ b/doc/source/fmpq.rst @@ -45,6 +45,11 @@ Types, macros and constants An array of length 1 of fmpq's. This is used to pass fmpq's around by reference without fuss, similar to the way mpq_t's work. +.. function:: fmpz * fmpq_numref(const fmpq_t x) + fmpz * fmpq_denref(const fmpq_t x) + + Returns respectively a pointer to the numerator and denominator of x. + Memory management -------------------------------------------------------------------------------- diff --git a/doc/source/fmpz_mat.rst b/doc/source/fmpz_mat.rst index 8a00cc8367..844ecd3406 100644 --- a/doc/source/fmpz_mat.rst +++ b/doc/source/fmpz_mat.rst @@ -97,6 +97,11 @@ Basic assignment and manipulation Initialises the matrix ``mat`` to the same size as ``src`` and sets it to a copy of ``src``. +.. function:: slong fmpz_mat_nrows(const fmpz_mat_t mat) + slong fmpz_mat_ncols(const fmpz_mat_t mat) + + Returns respectively the number of rows and columns of the matrix. + .. function:: void fmpz_mat_swap(fmpz_mat_t mat1, fmpz_mat_t mat2) Swaps two matrices. The dimensions of ``mat1`` and ``mat2`` From 343e4c36edb34f6dd469cbfb6a70a585fe09effa Mon Sep 17 00:00:00 2001 From: Vincent Delecroix Date: Sat, 14 Oct 2023 10:37:23 +0200 Subject: [PATCH 2/4] proper declaration for n_factor_init --- doc/source/ulong_extras.rst | 3 +++ 1 file changed, 3 insertions(+) diff --git a/doc/source/ulong_extras.rst b/doc/source/ulong_extras.rst index a3b41d2eaa..a8a152725e 100644 --- a/doc/source/ulong_extras.rst +++ b/doc/source/ulong_extras.rst @@ -1071,6 +1071,9 @@ Square root and perfect power testing Factorisation -------------------------------------------------------------------------------- +.. function:: void n_factor_init(n_factor_t * factors) + + Initializes factors. .. function:: int n_remove(ulong * n, ulong p) From b37081b4822580cdc392f2013e1980fd8fb38f5b Mon Sep 17 00:00:00 2001 From: Vincent Delecroix Date: Sat, 14 Oct 2023 10:37:11 +0200 Subject: [PATCH 3/4] fix NMOD_VEC_DOT --- doc/source/nmod_vec.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/source/nmod_vec.rst b/doc/source/nmod_vec.rst index 02f6b6e140..4617030f09 100644 --- a/doc/source/nmod_vec.rst +++ b/doc/source/nmod_vec.rst @@ -134,7 +134,7 @@ Dot products this function returns the precise limb size of ``len`` times ``(mod.n - 1) ^ 2``. -.. function:: macro NMOD_VEC_DOT(res, i, len, expr1, expr2, mod, nlimbs) +.. macro:: NMOD_VEC_DOT(res, i, len, expr1, expr2, mod, nlimbs) Effectively performs the computation:: From 97fe9ac62b1251a334cb054c04856ca44037b527 Mon Sep 17 00:00:00 2001 From: Vincent Delecroix Date: Sat, 14 Oct 2023 10:36:54 +0200 Subject: [PATCH 4/4] fix spacings --- doc/source/flint.rst | 28 ++++++++++++++-------------- doc/source/fmpz.rst | 4 ++-- doc/source/fmpz_mod_mat.rst | 2 +- doc/source/fmpz_mpoly.rst | 4 ++-- doc/source/fq_default_mat.rst | 2 +- 5 files changed, 20 insertions(+), 20 deletions(-) diff --git a/doc/source/flint.rst b/doc/source/flint.rst index 287ee183d3..6c3881e10b 100644 --- a/doc/source/flint.rst +++ b/doc/source/flint.rst @@ -118,20 +118,20 @@ internal representation of numbers (using limb arrays). Allocation Functions ----------------------------------------------- -.. function:: void * flint_malloc(size_t size) +.. function:: void * flint_malloc(size_t size) Allocate ``size`` bytes of memory. -.. function:: void * flint_realloc(void * ptr, size_t size) +.. function:: void * flint_realloc(void * ptr, size_t size) Reallocate an area of memory previously allocated by :func:`flint_malloc`, :func:`flint_realloc`, or :func:`flint_calloc`. -.. function:: void * flint_calloc(size_t num, size_t size) +.. function:: void * flint_calloc(size_t num, size_t size) Allocate ``num`` objects of ``size`` bytes each, and zero the allocated memory. -.. function :: void flint_free(void * ptr) +.. function:: void flint_free(void * ptr) Free a section of memory allocated by :func:`flint_malloc`, :func:`flint_realloc`, or :func:`flint_calloc`. @@ -154,7 +154,7 @@ Random Numbers The random state is not initialised. .. function:: void flint_rand_free(flint_rand_s * state) - + Frees a random state object as allocated using :func:`flint_rand_alloc`. @@ -202,7 +202,7 @@ Thread functions Assumes that the Flint thread pool is already set up. The function returns the old number of worker threads that can be started. - + The function can only be used to reduce the number of workers that can be started from a thread. It cannot be used to increase the number. If a higher number is passed, the function has no effect. @@ -225,10 +225,10 @@ Thread functions Input/Output ----------------- -.. function:: int flint_printf(const char * str, ...) - int flint_vprintf(const char * str, va_list ap) - int flint_fprintf(FILE * f, const char * str, ...) - int flint_sprintf(char * s, const char * str, ...) +.. function:: int flint_printf(const char * str, ...) + int flint_vprintf(const char * str, va_list ap) + int flint_fprintf(FILE * f, const char * str, ...) + int flint_sprintf(char * s, const char * str, ...) These are equivalent to the standard library functions ``printf``, ``vprintf``, ``fprintf``, and ``sprintf`` with an additional length modifier @@ -236,10 +236,10 @@ Input/Output format specifiers "d", "x", or "u", thereby outputting the limb as a signed decimal, hexadecimal, or unsigned decimal integer. - -.. function:: int flint_scanf(const char * str, ...) - int flint_fscanf(FILE * f, const char * str, ...) - int flint_sscanf(const char * s, const char * str, ...) + +.. function:: int flint_scanf(const char * str, ...) + int flint_fscanf(FILE * f, const char * str, ...) + int flint_sscanf(const char * s, const char * str, ...) These are equivalent to the standard library functions ``scanf``, ``fscanf``, and ``sscanf`` with an additional length modifier "w" for diff --git a/doc/source/fmpz.rst b/doc/source/fmpz.rst index 89c5da3aa0..1f1cc6fb9f 100644 --- a/doc/source/fmpz.rst +++ b/doc/source/fmpz.rst @@ -409,13 +409,13 @@ Conversion where `X = 2^{FLINT\_BITS}`, sets the corresponding elements of ``out`` so that this is true. It is assumed that ``n > 0``. -.. function::void fmpz_get_signed_ui_array(ulong * out, slong n, const fmpz_t in) +.. function:: void fmpz_get_signed_ui_array(ulong * out, slong n, const fmpz_t in) Retrieves the value of `in` modulo `2^{n * FLINT\_BITS}` and puts the `n` words of the result in ``out[0], ..., out[n-1]``. This will give a signed two's complement representation of `in` (assuming `in` doesn't overflow the array). -.. function::void fmpz_get_signed_uiui(ulong * hi, ulong * lo, const fmpz_t in) +.. function:: void fmpz_get_signed_uiui(ulong * hi, ulong * lo, const fmpz_t in) Retrieves the value of `in` modulo `2^{2 * FLINT\_BITS}` and puts the high and low words into ``*hi`` and ``*lo`` respectively. diff --git a/doc/source/fmpz_mod_mat.rst b/doc/source/fmpz_mod_mat.rst index 8039837827..dcb6004d13 100644 --- a/doc/source/fmpz_mod_mat.rst +++ b/doc/source/fmpz_mod_mat.rst @@ -168,7 +168,7 @@ Conversions Set ``A`` to the matrix ``B`` reducing modulo the modulus of ``A``. -.. function:: void fmpz_mod_mat_get_fmpz_mat(fmpz_mat_t A, const fmpz_mod_mat_t B) +.. function:: void fmpz_mod_mat_get_fmpz_mat(fmpz_mat_t A, const fmpz_mod_mat_t B) Set ``A`` to a lift of ``B``. diff --git a/doc/source/fmpz_mpoly.rst b/doc/source/fmpz_mpoly.rst index 97586d9106..8d3b1c9c0a 100644 --- a/doc/source/fmpz_mpoly.rst +++ b/doc/source/fmpz_mpoly.rst @@ -892,7 +892,7 @@ Vectors A type holding a vector of :type:`fmpz_mpoly_t`. -.. macro:: fmpz_mpoly_vec_entry(vec, i) +.. macro:: fmpz_mpoly_vec_entry(vec, i) Macro for accessing the entry at position *i* in *vec*. @@ -900,7 +900,7 @@ Vectors Initializes *vec* to a vector of length *len*, setting all entries to the zero polynomial. -.. function::void fmpz_mpoly_vec_clear(fmpz_mpoly_vec_t vec, const fmpz_mpoly_ctx_t ctx) +.. function:: void fmpz_mpoly_vec_clear(fmpz_mpoly_vec_t vec, const fmpz_mpoly_ctx_t ctx) Clears *vec*, freeing its allocated memory. diff --git a/doc/source/fq_default_mat.rst b/doc/source/fq_default_mat.rst index be1e899cb8..78f0c84b83 100644 --- a/doc/source/fq_default_mat.rst +++ b/doc/source/fq_default_mat.rst @@ -49,7 +49,7 @@ Basic properties and manipulation Sets the entry in ``mat`` in row `i` and column `j` to ``x``. -.. function:: void fq_default_mat_entry_set_fmpz(fq_default_mat_t mat, slong i, slong j, const fmpz_t x, const fq_default_ctx_t ctx) +.. function:: void fq_default_mat_entry_set_fmpz(fq_default_mat_t mat, slong i, slong j, const fmpz_t x, const fq_default_ctx_t ctx) Sets the entry in ``mat`` in row `i` and column `j` to ``x``.