STK++ 0.9.13
tutoLeastSquare.cpp File Reference
#include <STKpp.h>
Include dependency graph for tutoLeastSquare.cpp:

Go to the source code of this file.

Functions

int main (int argc, char **argv)
 

Function Documentation

◆ main()

int main ( int  argc,
char **  argv 
)

Definition at line 4 of file tutoLeastSquare.cpp.

5{
6 CArrayXX y(1000,3), x(1000,5), beta(5,3);
7 Law::Normal l(0,1);
8 x.rand(l);
9 beta << 0, 1, 2,
10 2, 3, 4,
11 2, 1, 6,
12 0, 3,-1,
13 3,-1, 1;
14 y = x * beta + CArrayXX(1000, 3).rand(l);
15 stk_cout << "STK++ MultiLeastSquare:\n";
16 stk_cout << "-----------------------\n";
18 stk_cout << "beta matrix:\n";
19 stk_cout << ols.x();
20 stk_cout << "\nlapack MultiLeastSquare:\n";
21 stk_cout << "------------------------\n";
23 stk_cout << "beta matrix:\n";
24 stk_cout << ls.x();
25 return 0;
26}
#define stk_cout
Standard stk output stream.
Derived & rand(Law::IUnivLaw< Type > const &law)
set random values to this using a distribution law given by the user.
virtual bool run()
run the computations.
Normal distribution law.
The MultidimRegression class allows to regress a multidimensional output variable among a multivariat...
The class MultiLeastSQquare solve the least square problem when the response b is multidimensional.
CArray< Real, UnknownSize, UnknownSize, Arrays::by_col_ > CArrayXX
Definition STK_CArray.h:50

References STK::ArrayBase< Derived >::rand(), STK::ILeastSquare< Derived >::run(), stk_cout, and STK::ILeastSquare< Derived >::x().