FLINT3.7.0-dev

gr_ctx_struct, gr_ctx_t

Synopsis#include <flint/gr.h>
gr_ctx_struct
gr_ctx_t

A context object representing a mathematical structure R. A gr_ctx_t is an array of length one of gr_ctx_struct, so that it is passed by reference. The structure has the fields

  • data: GR_CTX_STRUCT_DATA_BYTES (six words) of storage for the parameters of the ring, for example a modulus, a precision, or a pointer to a base ring or to heap-allocated data;
  • which_ring: a code of type gr_which_structure identifying the implementation;
  • sizeof_elem: the size of an element in bytes;
  • methods: a pointer to the method table;
  • size_limit: a bound on the size of elements (for example a number of terms), beyond which some rings refuse operations with GR_UNABLE; WORD_MAX for most rings.

Contexts are not passed as const, so that a ring can keep mutable data such as caches or a table of discovered zero divisors.

Guides#

Cite this page

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