-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathqr.cpp
27 lines (24 loc) · 915 Bytes
/
qr.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
/******************************************************************************
Copyright (C) 2013 Karel Ha <[email protected]>
Distributed under the terms of the GNU General Public License (GPL)
as published by the Free Software Foundation; either version 2 of
the License, or (at your option) any later version.
http://www.gnu.org/licenses/
******************************************************************************/
#include "all.hpp"
#include<cmath>
#include<iomanip>
int main(int argc, const char* argv[]) {
cout << "================QR factorization==============" << endl;
Matrix<> A, R;
SqrMtrx<> Q;
cin >> A;
A.QR(Q, R);
cout << setprecision(4);
cout << "Q:\n" << Q << endl;
cout << "R:\n" << R << endl;
cout << "A:\n" << A << endl;
cout << "Q * R:\n" << Q * R << endl;
cout << "===============/QR factorization==============" << endl;
return 0;
}