gr_transformed_mpn_set, gr_transformed_mpn_get, gr_transformed_mpn_get_destructive, gr_transformed_mpn_get_limbs, gr_transformed_mpn_get_limbs_bound
#include <flint/gr.h>int gr_transformed_mpn_get(nn_ptr z, slong zn, slong * zn_out, int * sign, gr_srcptr x, gr_ctx_t ctx)sourceint gr_transformed_mpn_get_destructive(nn_ptr z, slong zn, slong * zn_out, int * sign, gr_ptr x, gr_ctx_t ctx)sourceConversions by limb arrays with an explicit sign. gr_transformed_mpn_set converts the integer \pm(a_0, \ldots, a_{an-1}) in, failing with GR_DOMAIN if it does not fit the context. The get functions write the absolute value to z, its length to *zn_out and the sign to *sign; the destructive form may consume the element, skipping a copy of the transform. gr_transformed_mpn_get_limbs returns the number of limbs the reconstruction of x needs, which exceeds the length of the value by the length of the top CRT coefficient, and gr_transformed_mpn_get_limbs_bound an upper bound over every element of the context.
A window of at least gr_transformed_mpn_get_limbs limbs receives the reconstruction directly, without staging or copying. A shorter window is also accepted: the ring stages the conversion in its own scratch and copies the result out, succeeding whenever the value fits in zn limbs and returning GR_DOMAIN otherwise. For the destructive form that refusal comes with the element already consumed, so it cannot be retried. Limbs of z above *zn_out are zeroed. Callers converting into an fmpz or into a window of get_limbs limbs need not consult get_limbs_bound; a caller that wants a buffer of its own should size it from that bound rather than from its own model of the representation.
The FLINT team, “gr_transformed_mpn_set, gr_transformed_mpn_get, gr_transformed_mpn_get_destructive, gr_transformed_mpn_get_limbs, gr_transformed_mpn_get_limbs_bound (gr.h),” FLINT: Fast Library for Number Theory, documentation, version 3.7.0-dev, 2026. https://flintlib.org/doc/gr/gr_transformed_mpn_set.html (generated 2026-10-20).
@misc{flint-doc-gr-gr-transformed-mpn-set,
author = {{The FLINT team}},
title = {{gr\_transformed\_mpn\_set, gr\_transformed\_mpn\_get, gr\_transformed\_mpn\_get\_destructive, gr\_transformed\_mpn\_get\_limbs, gr\_transformed\_mpn\_get\_limbs\_bound (gr.h)}},
howpublished = {FLINT: Fast Library for Number Theory, documentation, version 3.7.0-dev},
year = {2026},
url = {https://flintlib.org/doc/gr/gr_transformed_mpn_set.html},
note = {Generated 2026-10-20}
}