Skip to content

Commit

Permalink
update qr decomposition
Browse files Browse the repository at this point in the history
  • Loading branch information
pn authored and pn committed Feb 8, 2020
1 parent 7d50c5e commit 628ed05
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions include/qr_decomposition.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
#include "type.h"
#include "value_compare.h"
#include <cassert>
#include <cstdio>
#include <cstdlib>
#include <utility>

namespace pnmatrix {
Expand Down Expand Up @@ -36,6 +38,10 @@ MatrixType get_household_matrix(const MatrixType& vector) {

template<class MatrixType>
std::pair<MatrixType, MatrixType> QR(const MatrixType& matrix) {
if(matrix.get_row() <= matrix.get_column()) {
fprintf(stderr,"qr decomposition needs matrix(m > n)");
std::abort();
}
MatrixType R(matrix);
MatrixType Q = MatrixType::get_identity_matrix(matrix.get_row());
for (size_type i = 1; i <= matrix.get_column(); ++i) {
Expand Down

0 comments on commit 628ed05

Please sign in to comment.