Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 18 additions & 16 deletions doc/source/flint.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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`
Expand Down Expand Up @@ -116,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`.
Expand All @@ -152,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`.


Expand Down Expand Up @@ -200,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.
Expand All @@ -223,21 +225,21 @@ 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
"w" for use with an :type:`mp_limb_t` type. This modifier can be used with
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
Expand Down
5 changes: 5 additions & 0 deletions doc/source/fmpq.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
--------------------------------------------------------------------------------

Expand Down
4 changes: 2 additions & 2 deletions doc/source/fmpz.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
5 changes: 5 additions & 0 deletions doc/source/fmpz_mat.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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``
Expand Down
2 changes: 1 addition & 1 deletion doc/source/fmpz_mod_mat.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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``.

Expand Down
4 changes: 2 additions & 2 deletions doc/source/fmpz_mpoly.rst
Original file line number Diff line number Diff line change
Expand Up @@ -892,15 +892,15 @@ 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*.

.. function:: void fmpz_mpoly_vec_init(fmpz_mpoly_vec_t vec, slong len, const fmpz_mpoly_ctx_t ctx)

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.

Expand Down
2 changes: 1 addition & 1 deletion doc/source/fq_default_mat.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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``.

Expand Down
2 changes: 1 addition & 1 deletion doc/source/nmod_vec.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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::

Expand Down
3 changes: 3 additions & 0 deletions doc/source/ulong_extras.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down