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=QRA = QR of an m×nm \times n matrix of full column rank (m≥nm \ge n; QQ is m×nm \times n with orthonormal columns and RR is n×nn \times n upper triangular), or the transposed LQ decomposition A=LQA = LQ of a matrix of full row rank (m≤nm \le n; LL is m×mm \times m lower triangular and QQ is m×nm \times n with orthonormal rows).

The entries should be real (a subfield of R\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 QQ is obtained by extending QQ with an orthonormal basis of the complement and padding RR (or LL) 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 AA and QQ is handled in place; aliasing of AA with RR or LL 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-11-02).