STK++ 0.9.13
tutoAddingRows.cpp
Go to the documentation of this file.
1#include "STKpp.h"
2using namespace STK;
3int main(int argc, char *argv[])
4{
5 ArrayXX A(Range(0,2), 4);
6 Law::Normal law(1.,2.);
7 A.rand(law);
8 stk_cout << _T("A =\n") << A;
9 // Adding a column with 1
11 // Insert 2 uninitialize rows at place 2
12 A.insertRows(2, 2);
13 // Set x^2 and x^3 with x in row 1
14 A.row(2) = A.row(1).square();
15 A.row(3) = A.row(1).cube();
16 // Add 2 unitialized rows
17 A.pushBackRows(2);
18 // Set x^2 and x^3 with x in row 4
19 A.row(5) = A.row(4).square();
20 A.row(6) = A.row(4).cube();
21 stk_cout << _T("A =\n") << A;
22
23 PointX B(4); B << 1, 3, 5, 6;
24 stk_cout << _T("B =\n") << B;
25 // insert an unitialized element at place 2
26 B.insertElt(2); B[2] = 3; // set value to 3
27 stk_cout << _T("B =\n") << B;
28}
#define stk_cout
Standard stk output stream.
#define _T(x)
Let x unmodified.
This file include all the header files of the STK++ project.
void insertElt(int pos, int n=1)
Insert n elts at the position pos of the container.
Derived & rand(Law::IUnivLaw< Type > const &law)
set random values to this using a distribution law given by the user.
Define the constant point.
void pushBackRows(int n=1)
Add n rows to the array.
Row row(int i) const
access to a part of a row.
void pushFrontRows(int n=1)
Insert n rows in front of the array.
void insertRows(int pos, int n=1)
Insert n rows at position pos in the array If pos is outside the range of a column,...
Normal distribution law.
The namespace STK is the main domain space of the Statistical ToolKit project.
TRange< UnknownSize > Range
Definition STK_Range.h:59
int main(int argc, char *argv[])