FLINT3.7.0-dev

flint_mpq_init_set_readonly, flint_mpq_clear_readonly

Synopsis#include <flint/fmpq.h>
void flint_mpq_init_set_readonly(mpq_t z, const fmpq_t f)source
void flint_mpq_clear_readonly(mpq_t z)source

Make the uninitialised mpq_t z a read-only view of f, without copying large components, and release it. f must not change while z is in use, and z must not be modified. Declared only if gmp.h is included before any FLINT header.

The intended use is to pass an fmpq_t to a function that takes an mpq_t argument:

fmpq_t f;
...
{
    mpq_t z;

    flint_mpq_init_set_readonly(z, f);
    foo(..., z);
    flint_mpq_clear_readonly(z);
}
Cite this page

The FLINT team, “flint_mpq_init_set_readonly, flint_mpq_clear_readonly (fmpq.h),” FLINT: Fast Library for Number Theory, documentation, version 3.7.0-dev, 2026. https://flintlib.org/doc/fmpq/flint_mpq_init_set_readonly.html (generated 2026-10-20).