operatortest.cc 1.79 KB
Newer Older
thomas.forbriger's avatar
thomas.forbriger committed
1
2
3
4
5
/*! \file operatortest.cc
 * \brief test operator functions
 * 
 * ----------------------------------------------------------------------------
 * 
thomas.forbriger's avatar
thomas.forbriger committed
6
 * $Id: operatortest.cc,v 1.2 2004-02-10 11:45:29 tforb Exp $
thomas.forbriger's avatar
thomas.forbriger committed
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
 * \author Thomas Forbriger
 * \date 10/02/2004
 * 
 * test operator functions
 * 
 * Copyright (c) 2004 by Thomas Forbriger (BFO Schiltach) 
 * 
 * REVISIONS and CHANGES 
 *  - 10/02/2004   V1.0   Thomas Forbriger
 * 
 * ============================================================================
 */
#define OPERATORTEST_VERSION \
  "OPERATORTEST   V1.0   test operator functions"
#define OPERATORTEST_CVSID \
thomas.forbriger's avatar
thomas.forbriger committed
22
  "$Id: operatortest.cc,v 1.2 2004-02-10 11:45:29 tforb Exp $"
thomas.forbriger's avatar
thomas.forbriger committed
23
24

#include <iostream>
thomas.forbriger's avatar
thomas.forbriger committed
25
#include <complex>
thomas.forbriger's avatar
thomas.forbriger committed
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
#include <aff/array.h>
#include <aff/dump.h>
#include <aff/arrayoperators.h>

using std::cout;
using std::cerr;
using std::endl;

/*! \example tests/operatortest.cc
 *
 * Here you can learn how to use operators with aff classes.
 *
 * This test program gives an example of the usage of the following classes,
 * functions, and preprocessor macros:
 *   - aff::Array
 *   - aff::ConstArray
 *   - aff::dump
 *   - aff::dump_array
 *   - #DUMP
 *   - #CODE
 *
 * \sa tests/operatortest.cc
 */

int main(int iargc, char* argv[])
{
  cout << OPERATORTEST_VERSION << endl;
  cout << OPERATORTEST_CVSID << endl;

  CODE(aff::Array<double> A(3,3);)
  CODE(A=14.;)
  CODE(dump_array(A));
  CODE(aff::Array<double> B = A * 5.;)
  CODE(dump_array(B));
  CODE(B*=0.2);
thomas.forbriger's avatar
thomas.forbriger committed
61
62
63
64
65
66
67
68
69
70
  CODE(B*=4L);
  CODE(B*=0xa0);
  CODE(dump_array(B));
  CODE(aff::Array<std::complex<double> > C(3,3);)
  CODE(C=std::complex<double>(14.,2.);)
  CODE(dump_array(C));
  CODE(C*=0.2);
  CODE(dump_array(C));
  CODE(aff::ConstArray<double> D(B));
  CODE(aff::Array<double> E(D*50.));
thomas.forbriger's avatar
thomas.forbriger committed
71
72
73
74
  CODE(dump_array(B));
}

/* ----- END OF operatortest.cc ----- */