AFF --- A container for numbers (array) by Friederich and Forbriger.

◆ main()

int main ( int  iargc,
char *  argv[] 
)

Definition at line 61 of file functionstest.cc.

References aff::func::absmax(), aff::func::avg(), CODE, aff::dump_array(), aff::func::histo(), aff::func::max(), aff::func::min(), aff::func::rms(), aff::func::sqrsum(), aff::subarray(), and aff::func::sum().

62 {
63  CODE( typedef aff::Array<double> Tarray );
64  CODE( Tarray A(3,4) );
65  CODE( A=5 );
66  CODE( Tarray::Tcoc AC=A );
67  CODE( subarray(A)(1,1)(2,4)=2. );
68  CODE( subarray(A)(2,3)(1,2)=1. );
69  CODE( subarray(A)(2,3)(3,4)=-7. );
70  CODE( dump_array(A) );
71  CODE( cout << aff::func::avg(A) << endl );
72  CODE( cout << aff::func::rms(A) << endl );
73  CODE( cout << aff::func::max(A) << endl );
74  CODE( cout << aff::func::min(A) << endl );
75  CODE( cout << aff::func::absmax(A) << endl );
76  CODE( cout << aff::func::min(AC) << endl );
77  CODE( cout << aff::func::sum(A) << endl );
78  CODE( cout << aff::func::sqrsum(A) << endl );
80  CODE( Tmap mymap=aff::func::histo(A) );
81  CODE( typedef Tmap::const_iterator Tmapit );
82  CODE( for (Tmapit i=mymap.begin(); i!=mymap.end(); ++i) \
83  { cout << i->first << "\t" << i->second << endl; } );
84  CODE( Tvalmap avalmap );
85  CODE( avalmap[-4.]=1 );
86  CODE( avalmap[1.]=2 );
87  CODE( avalmap[2.]=3 );
88  CODE( avalmap[5.]=4 );
90  aff::func::valmap<aff::Array>(A, avalmap) );
91  CODE( dump_array(B) );
92 }
C::Tvalue avg(const C &c)
Definition: avg.h:90
C::Tvalue sum(const C &c)
Definition: sum.h:89
C::Tvalue min(const C &c)
Definition: min.h:90
aff::util::Subarray< C > subarray(const C &c)
Wrapper function to select correct type.
Definition: subarray.h:163
C::Tvalue rms(const C &c)
Definition: rms.h:91
aff::func::util::Extracthisto< C >::Tmap histo(const C &c)
Definition: histo.h:91
#define CODE(C)
Dump code and execute (works like echo)
Definition: dump_macros.h:82
void dump_array(const ConstArray< T > &array, const Tdim &i=(Strided::Mmax_dimen-1), std::ostream &os=std::cout)
Dump array values.
Definition: dump_array.h:157
C::Tvalue sqrsum(const C &c)
Definition: sqrsum.h:90
C::Tvalue absmax(const C &c)
Definition: absmax.h:98
Full multi-dimensional array functionality.This is the full array class template. It adds no addition...
Definition: array.h:151
std::map< Tvalue, int > Tmap
Definition: histo.h:63
C::Tvalue max(const C &c)
Definition: max.h:89
std::map< double, int > Tvalmap
Here is the call graph for this function: