STK++ 0.9.13
tutoAddingCols.cpp File Reference
#include "STKpp.h"
Include dependency graph for tutoAddingCols.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 3 of file tutoAddingCols.cpp.

4{
5 ArrayXX A(4, Range(0,2));
6 Law::Normal law(1.,2.);
7 A.rand(law);
8 stk_cout << _T("A =\n") << A;
9 // Adding a column with value 5
10 A.pushFrontCols(Const::VectorX(4)*5);
11 // insert an uninitialized columns at place 2
12 A.insertCols(2, 2);
13 // set x^2 and x^3 with x in columns 1
14 A.col(2) = A.col(1).square();
15 A.col(3) = A.col(1).cube();
16 // add an uninitialized columns at the end
17 A.pushBackCols(1);
18 // set x^2 with x in columns 4
19 A.col(5) = A.col(4).square();
20 stk_cout << _T("A =\n") << A;
21 // do the same with a vector
22 VectorX B(4); B << 1, 3, 5, 6;
23 stk_cout << _T("B = ") << B.transpose();
24 // insert 1 uninitialized element in place 2
25 B.insertElt(2); B[2] = 3; // set value to 3
26 stk_cout << _T("B = ") << B.transpose();
27}
#define stk_cout
Standard stk output stream.
#define _T(x)
Let x unmodified.
Define the constant point.
Normal distribution law.
The MultidimRegression class allows to regress a multidimensional output variable among a multivariat...
TRange< UnknownSize > Range
Definition STK_Range.h:59

References _T, STK::IArray2D< Derived >::col(), STK::IArray2D< Derived >::insertCols(), STK::Array2DVector< Type_ >::insertElt(), STK::IArray2D< Derived >::pushBackCols(), STK::IArray2D< Derived >::pushFrontCols(), STK::ArrayBase< Derived >::rand(), stk_cout, and STK::ArrayBase< Derived >::transpose().