FLINT3.7.0-dev

gr_abs2

Synopsis#include <flint/gr.h>
int gr_abs2(gr_ptr res, gr_srcptr x, gr_ctx_t ctx)source

Sets res to the squared absolute value ∣x∣2|x|^2: xxˉx \bar{x} in a subring of C\mathbb{C}, which stays in the ring and needs no square root (unlike gr_abs), and x2x^2 in an ordered ring. Numerical algorithms that only compare or scale by magnitudes should use this rather than gr_abs.

The default method (gr_generic_abs2) squares the result of gr_abs; the real and complex floating-point and ball rings, fmpzi, qqbar and the generic complex rings compute a sum of squares directly.

Cite this page

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