2#include "../../Matrix.h"
13 size_t num_rows = A.
rows();
16 auto Q =
zeros(num_rows, num_rows);
19 for(
size_t i_a = 0; i_a < num_cols; i_a++) {
20 auto a = A.
GetSlice(0, num_rows - 1, i_a, i_a);
22 for(
size_t i = 0; i < col; i++) {
23 auto q = Q.
GetSlice(0, num_rows - 1, i, i);
24 auto proj = (q.Transpose() * a)(0, 0) * q;
27 auto e = 1.0 /
norm(u) * u;
28 Q.SetSlice(0, e.rows() - 1, col, col, e);
31 return std::make_pair(Q, Q.Transpose() * A);
size_t rows() const
Definition: Matrix.h:193
size_t columns() const
Definition: Matrix.h:198
Matrix GetSlice(size_t rowStart) const
Definition: Matrix.h:609
double norm(const Matrix< double > &in)
Matrix< double > zeros(size_t rows, size_t columns, size_t elements=1)
std::pair< Matrix< double >, Matrix< double > > qr(const Matrix< double > &A)
Definition: qr.h:12