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

◆ main()

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

Definition at line 80 of file operatortest.cc.

References CODE, DUMP, aff::dump_array(), OPERATORTEST_VERSION, section(), and aff::subarray().

81 {
82  cout << OPERATORTEST_VERSION << endl;
83 
84  section("Test array operators", '=');
85  section("Normal array with unary operator");
86  CODE(aff::Array<double> A(4,4));
87  CODE(A=14.);
88  CODE(dump_array(A));
89  CODE(A+=500.);
90  CODE(dump_array(A));
91 
92  section("Access through subarray");
93  CODE(aff::Array<double> Asub=aff::subarray(A)(2,3)(2,3));
94  CODE(Asub/=200);
95  CODE(dump_array(A));
96 
97  section("binary operator");
99  CODE(B=A*5);
100  CODE(dump_array(B));
101 
102  section("test implicit type conversion");
103  CODE(B=10.);
104  CODE(dump_array(B));
105  CODE(B*=0.2);
106  CODE(dump_array(B));
107  CODE(B*=4L);
108  CODE(dump_array(B));
109  CODE(B*=0xa0);
110  CODE(dump_array(B));
111 
112  section("test advanced type conversion");
113  CODE(aff::Array<std::complex<double> > C(3,3);)
114  CODE(C=std::complex<double>(14.,2.);)
115  CODE(dump_array(C));
116  CODE(C*=0.2);
117  CODE(dump_array(C));
118 
119  section("test binary operator with constant input");
121  CODE(aff::Array<double> E(D*2.));
122  CODE(dump_array(E));
123 
124  section("mixed implicit operations");
125  CODE(dump_array((D*5.)-12L));
126 
127  section("Test series operators", '=');
128  section("test scalar operators");
129  CODE(aff::Series<double> F(-3,3));
130  CODE(F=5.);
131  DUMP(F);
132  CODE(F/=25.);
133  DUMP(F);
134 
135  section("test vector operators");
137  CODE(G=5.);
138  DUMP(G);
139  DUMP(F+G);
141  CODE(H=F+G);
142  DUMP(H);
143  CODE(H -= F);
144  DUMP(H);
145  DUMP((H *= G + 0.2) + 0.2);
146  DUMP(H);
147  DUMP(100+H);
148  DUMP(H+100);
149  CODE(const aff::Series<double> CH(H));
150  DUMP(CH+100);
151  DUMP(CH -= 10);
152  DUMP(CH);
153 }
#define DUMP(A)
Dump any object through its dump function.
Definition: dump_macros.h:62
aff::util::Subarray< C > subarray(const C &c)
Wrapper function to select correct type.
Definition: subarray.h:163
void section(const char *s, const char l='-')
print headline
Definition: operatortest.cc:54
#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
#define OPERATORTEST_VERSION
Definition: operatortest.cc:35
Full multi-dimensional array functionality.This is the full array class template. It adds no addition...
Definition: array.h:151
A base class for time series and spectra.
Definition: series.h:266
Array base classThis is a multidimensional (array) container that uses a strided memory layout (Fortr...
Definition: array.h:172
Here is the call graph for this function: