10#include "backends/seq/impl.hpp"
11#include "backends/lapack/impl.hpp"
31 for (
idx i = 0; i < m; ++i)
32 for (
idx j = 0; j < m; ++j)
33 y[i] += f.
Q(j, i) * b[j];
36 for (
idx i = n; i-- > 0;) {
38 for (
idx j = i + 1; j < n; ++j)
39 xv[i] -= f.
R(i, j) * xv[j];
Dense row-major matrix with optional GPU storage.
constexpr idx rows() const noexcept
constexpr idx cols() const noexcept
QRResult qr(const Matrix &A)
QRResult qr(const Matrix &A)
void qr_solve(const QRResult &f, const Vector &b, Vector &x)
Solve the least-squares problem min ||A*x - b||_2.
Backend
Selects which backend handles a linalg operation.
@ lapack
LAPACKE – industry-standard factorizations, SVD, eigen.
QRResult qr(const Matrix &A, Backend backend=lapack_backend)
QR factorization of an mxn matrix A (m >= n) via Householder reflections.
QR factorization via Householder reflections.
Result of a QR factorization: A = Q * R.
Matrix R
mxn upper triangular