_gr_vec_sum, _gr_vec_product
#include <flint/gr_vec.h>Set res to the sum, respectively the product, of the len entries; the empty sum is 0 and the empty product 1 (methods GR_METHOD_VEC_SUM, GR_METHOD_VEC_PRODUCT).
The defaults are _gr_vec_sum_generic and _gr_vec_product_generic. In finite rings they add or multiply from left to right. In other rings, where entries can grow, the sum of more than 100 entries uses binary splitting with basecase length 100, and the product of more than 20 entries binary splitting with basecase length 20, or, for more than 500 entries in a thread-safe ring, parallel binary splitting with basecase length 500. Balanced binary splitting computes a product of n integers of b bits each in O(M(nb) \log n) time instead of the O(n^2 b) of the left-to-right loop, and similarly sums of fractions; see Binary splitting and product trees.
Guides#
The FLINT team, “_gr_vec_sum, _gr_vec_product (gr_vec.h),” FLINT: Fast Library for Number Theory, documentation, version 3.7.0-dev, 2026. https://flintlib.org/doc/gr_vec/_gr_vec_sum.html (generated 2026-10-20).
@misc{flint-doc-gr-vec-gr-vec-sum,
author = {{The FLINT team}},
title = {{\_gr\_vec\_sum, \_gr\_vec\_product (gr\_vec.h)}},
howpublished = {FLINT: Fast Library for Number Theory, documentation, version 3.7.0-dev},
year = {2026},
url = {https://flintlib.org/doc/gr_vec/_gr_vec_sum.html},
note = {Generated 2026-10-20}
}