GR_TMP_INIT, GR_TMP_INIT2, GR_TMP_INIT3, GR_TMP_INIT4, GR_TMP_INIT5, GR_TMP_CLEAR, GR_TMP_CLEAR2, GR_TMP_CLEAR3, GR_TMP_CLEAR4, GR_TMP_CLEAR5
#include <flint/gr.h>GR_TMP_INIT(x1, ctx)sourceGR_TMP_INIT2(x1, x2, ctx)sourceGR_TMP_INIT3(x1, x2, x3, ctx)sourceGR_TMP_INIT4(x1, x2, x3, x4, ctx)sourceGR_TMP_INIT5(x1, x2, x3, x4, x5, ctx)sourceGR_TMP_CLEAR(x1, ctx)sourceGR_TMP_CLEAR2(x1, x2, ctx)sourceGR_TMP_CLEAR3(x1, x2, x3, ctx)sourceGR_TMP_CLEAR4(x1, x2, x3, x4, ctx)sourceGR_TMP_CLEAR5(x1, x2, x3, x4, x5, ctx)sourceAllocate one to five temporary elements contiguously on the stack with alloca, initialised to zero, and assign their addresses to the gr_ptr variables x1, ...; the matching GR_TMP_CLEAR macro clears them. An INIT and a CLEAR macro must match exactly.
The memory is reclaimed only when the enclosing function returns, so these macros must not be used inside a loop: allocate before the loop, move the loop body to a separate function, or use the heap. Elements are expected to be small (a few kilobytes at most), which holds for all built-in rings.
Guides#
- Using ca (
ca) - Getting started with generic rings
- Getting started (
gr_dft) - Working with power series rings (
gr_series) - Using mpn_mod (
mpn_mod) - Getting started with nfloat (
nfloat)
The FLINT team, “GR_TMP_INIT, GR_TMP_INIT2, GR_TMP_INIT3, GR_TMP_INIT4, GR_TMP_INIT5, GR_TMP_CLEAR, GR_TMP_CLEAR2, GR_TMP_CLEAR3, GR_TMP_CLEAR4, GR_TMP_CLEAR5 (gr.h),” FLINT: Fast Library for Number Theory, documentation, version 3.7.0-dev, 2026. https://flintlib.org/doc/gr/GR_TMP_INIT.html (generated 2026-10-20).
@misc{flint-doc-gr-GR-TMP-INIT,
author = {{The FLINT team}},
title = {{GR\_TMP\_INIT, GR\_TMP\_INIT2, GR\_TMP\_INIT3, GR\_TMP\_INIT4, GR\_TMP\_INIT5, GR\_TMP\_CLEAR, GR\_TMP\_CLEAR2, GR\_TMP\_CLEAR3, GR\_TMP\_CLEAR4, GR\_TMP\_CLEAR5 (gr.h)}},
howpublished = {FLINT: Fast Library for Number Theory, documentation, version 3.7.0-dev},
year = {2026},
url = {https://flintlib.org/doc/gr/GR_TMP_INIT.html},
note = {Generated 2026-10-20}
}