Decomposition qrdecomposition - CyrilB1531/lodestar GitHub Wiki

Development build. This page describes main, not a released package. The latest published Lodestar.Decomposition is 0.2.0 — read its documentation.

HomeDecompositionFactorization

QrDecomposition

A thin QR factorization of a dense matrix, by Householder reflections.

public sealed class QrDecomposition

PropertiesRowCount and ColumnCount are the shape of the matrix that was factorized. Q is the orthonormal factor, row-major and RowCount × ColumnCount; R is the upper-triangular factor, row-major and ColumnCount square.

Example — factorize, then read the factors back.

using Lodestar.Decomposition;

// A 3 x 2 matrix, row-major.
double[] matrix = [1.0, 2.0, 3.0, 4.0, 5.0, 7.0];

QrDecomposition qr = QrDecomposition.Householder(matrix, rowCount: 3, columnCount: 2);

int q = qr.Q.Count;             // => 6
int r = qr.R.Count;             // => 4
double belowDiagonal = qr.R[2]; // => 0

Remarksthin, not full. For an m × n matrix with m ≥ n, Q is m × n with orthonormal columns rather than m × m, and R is n × n. That is the shape a least-squares solve wants, and the one numpy.linalg.qr(mode="reduced") returns.

This package writes its own QR because Math.NET was refused on freshness (decision 0004), and the kernel is published now because a second package needs it rather than a second copy of it. The LU and the one-sided Jacobi SVD beside it stay internal — nothing has asked for them.

Applies to — net10.0, netstandard2.0.

See alsoQrDecomposition.Householder, TruncatedSvd.

Members

Member What it does
QrDecomposition.Householder Factorizes a row-major matrix by Householder reflections.