qrDecomposition

Performs QR decomposition on a sparse matrix.

QR decomposition factors a matrix A into the product of an orthogonal matrix Q and an upper triangular matrix R, such that A = QR.

This implementation uses the Gram-Schmidt process adapted for sparse matrices. It's more straightforward than Householder reflections and easier to debug.

This implementation is optimized for sparse matrices by:

  1. Efficiently extracting columns from the sparse matrix

  2. Avoiding unnecessary operations on zero elements

  3. Returning sparse matrices as the result

Return

A Pair of matrices (Q, R) representing the orthogonal and upper triangular matrices.

Parameters

matrix

The sparse matrix to decompose.