FLINT3.7.0-dev

gr_mat_qr, gr_mat_lq, gr_mat_lq_generic, gr_mat_lq_gso, gr_mat_lq_recursive

Synopsis#include <flint/gr_mat.h>
int gr_mat_qr(gr_mat_t Q, gr_mat_t R, const gr_mat_t A, gr_ctx_t ctx)source
int gr_mat_lq(gr_mat_t L, gr_mat_t Q, const gr_mat_t A, gr_ctx_t ctx)source
int gr_mat_lq_generic(gr_mat_t L, gr_mat_t Q, const gr_mat_t A, gr_ctx_t ctx)source
int gr_mat_lq_gso(gr_mat_t L, gr_mat_t Q, const gr_mat_t A, gr_ctx_t ctx)source
int gr_mat_lq_recursive(gr_mat_t L, gr_mat_t Q, const gr_mat_t A, gr_ctx_t ctx)source

Compute a reduced QR decomposition A = QR of an m \times n matrix of full column rank (m \ge n; Q is m \times n with orthonormal columns and R is n \times n upper triangular), or the transposed LQ decomposition A = LQ of a matrix of full row rank (m \le n; L is m \times m lower triangular and Q is m \times n with orthonormal rows).

The entries should be real (a subfield of \mathbb{R} or real floating-point numbers); for other rings the functions may succeed but the normalisations need not be meaningful. A full QR decomposition with a square Q is obtained by extending Q with an orthonormal basis of the complement and padding R (or L) with zeros. The gso algorithm is Gram-Schmidt orthogonalisation of the rows and the recursive algorithm a block recursion that benefits from fast matrix multiplication. gr_mat_qr is a wrapper of the LQ decomposition, which works on rows because the matrices are stored by rows. gr_mat_lq calls the ring method GR_METHOD_MAT_LQ (overridden by nfloat). Aliasing of A and Q is handled in place; aliasing of A with R or L uses a temporary copy. The functions return GR_DOMAIN for incompatible shapes, rank-deficient input, or when the divisions or square roots of the normalisation are not possible in the ring.

Cite this page

The FLINT team, “gr_mat_qr, gr_mat_lq, gr_mat_lq_generic, gr_mat_lq_gso, gr_mat_lq_recursive (gr_mat.h),” FLINT: Fast Library for Number Theory, documentation, version 3.7.0-dev, 2026. https://flintlib.org/doc/gr_mat/gr_mat_qr.html (generated 2026-10-20).