STK++ 0.9.13
tutoQr.cpp
Go to the documentation of this file.
1#include <STKpp.h>
2using namespace STK;
4int main(int argc, char** argv)
5{
6 Array2D<Real> a(5,4);
7 a << 0, 1, 2, 3,
8 2, 3, 4, 5,
9 2, 1, 6, 7,
10 0, 3,-1, 2,
11 3,-1, 1, 1;
12 stk_cout << _T("STK++ QR decomposition:\n");
13 stk_cout << _T("-----------------------\n");
14 Qr q(a); q.run();
15 stk_cout << _T("R matrix:\n");
16 stk_cout << q.R();
17 ArrayXX QR = q.R();
19 stk_cout << _T("QR matrix:\n");
20 stk_cout << QR;
21 stk_cout << _T("\nlapack QR decomposition:\n");
22 stk_cout << _T("--------------------------\n");
23 lapack::Qr lq(a); lq.run();
24 stk_cout << _T("R matrix:\n");
25 stk_cout << lq.R();
26 QR = lq.R();
28 stk_cout << _T("QR matrix:\n");
29 stk_cout << QR;
30 return 0;
31}
#define stk_cout
Standard stk output stream.
#define _T(x)
Let x unmodified.
This file include all the header files of the STK++ project.
template two dimensional column (vertically) oriented Array.
virtual bool run()
Compute the QR decomposition.
Definition STK_IQr.h:227
Array const & Q() const
give the matrix Q of the QR decomposition.
Definition STK_IQr.h:155
ArrayUpperTriangularXX const & R() const
give the matrix R of the QR decomposition.
Definition STK_IQr.h:159
The class Qr perform the QR decomposition of an ArrayXX.
Definition STK_Qr.h:98
void applyLeftHouseholderArray(ArrayBase< Lhs > const &M, ArrayBase< Rhs > const &H)
left multiplication by a Householder array.
The namespace STK is the main domain space of the Statistical ToolKit project.
int main(int argc, char **argv)
Definition tutoQr.cpp:4