FLINT3.7.0-dev

_gr_vec_apply_2x2, _gr_vec_apply_2x2_generic

Synopsis#include <flint/gr_vec.h>
int _gr_vec_apply_2x2(gr_ptr u, gr_ptr v, slong stride, slong len, gr_srcptr M, gr_ctx_t ctx)source
int _gr_vec_apply_2x2_generic(gr_ptr u, gr_ptr v, slong stride, slong len, gr_srcptr M, gr_ctx_t ctx)source

Applies the 2×22 \times 2 matrix MM, given row by row as a vector of length 4, to the pairs of elements of u and v: (ui,vi)←(M0ui+M1vi,  M2ui+M3vi)(u_i, v_i) \gets (M_0 u_i + M_1 v_i,\; M_2 u_i + M_3 v_i) for 0≤i<n0 \le i < n, where nn = len and uiu_i, viv_i are the elements at offset i⋅si \cdot s for ss = stride (in elements). With MM a plane rotation this is the rot operation of the BLAS, the building block of the QR algorithm (Numerical eigenvalues); the general form also serves Schur reordering. The vectors must not overlap and MM must not alias them.

This is the ring method GR_METHOD_VEC_APPLY_2X2. Since each new pair depends on both old elements, the generic version computes each pair into temporaries with two dot products of length 2 and does not rely on _gr_vec_dot allowing its output to overlap its inputs. The plain complex dfloat rings override it with a SIMD kernel (_d2c_vec_apply_2x2 and so on), which drops the products by the parts of MM that are exactly zero.

Cite this page

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