STK++ 0.9.13
tutoCenteringAnArray.cpp
Go to the documentation of this file.
1#include "STKpp.h"
2using namespace STK;
3int main(int argc, char *argv[])
4{
5 CArrayXX A(100, 5);
6 Law::Normal law(1,2);
7 A.rand(law);
8 // call column statistical functions
9 stk_cout << _T("min(A) =") << Stat::min(A);
10 stk_cout << _T("max(A) =") << Stat::max(A);
11 stk_cout << _T("max(A.abs()) =") << Stat::max(A.abs());
12 stk_cout << _T("mean(A) =") << Stat::mean(A);
13 // center the array
14 stk_cout << _T("\nCentering...\n\n");
15 A -= Const::VectorX(100) * Stat::mean(A);
16 // call column statistical functions with all the columns of A centered
17 stk_cout << _T("min(A) =") << Stat::min(A);
18 stk_cout << _T("max(A) =") << Stat::max(A);
19 stk_cout << _T("max(A.abs()) =") << Stat::max(A.abs());
20 stk_cout << _T("mean(A) =") << Stat::mean(A);
21}
#define stk_cout
Standard stk output stream.
#define _T(x)
Let x unmodified.
This file include all the header files of the STK++ project.
Derived & rand(Law::IUnivLaw< Type > const &law)
set random values to this using a distribution law given by the user.
UnaryOperator< AbsOp< Type >, Derived > abs() const
Normal distribution law.
hidden::FunctorTraits< Derived, MaxOp >::Row max(Derived const &A)
Compute the maximal(s) value(s) of A.
hidden::FunctorTraits< Derived, MeanOp >::Row mean(Derived const &A)
Compute the mean(s) value(s) of A.
hidden::FunctorTraits< Derived, MinOp >::Row min(Derived const &A)
Compute the minimal(s) value(s) of A.
Vector< Real, UnknownSize > VectorX
The namespace STK is the main domain space of the Statistical ToolKit project.
int main(int argc, char *argv[])