tstest.cc 2.37 KB
Newer Older
thomas.forbriger's avatar
thomas.forbriger committed
1
2
3
4
5
/*! \file tstest.cc
 * \brief test time series modules
 * 
 * ----------------------------------------------------------------------------
 * 
6
 * $Id: tstest.cc,v 1.3 2006-06-29 07:11:42 tforb Exp $
thomas.forbriger's avatar
thomas.forbriger committed
7
8
9
10
11
12
 * \author Thomas Forbriger
 * \date 20/12/2003
 * 
 * test time series modules
 * 
 * Copyright (c) 2003 by Thomas Forbriger (BFO Schiltach) 
thomas.forbriger's avatar
thomas.forbriger committed
13
14
15
16
17
18
 *
 * ----
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version. 
thomas.forbriger's avatar
thomas.forbriger committed
19
 * 
thomas.forbriger's avatar
thomas.forbriger committed
20
21
22
23
24
25
26
27
28
29
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 * 
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 * ----
 *
thomas.forbriger's avatar
thomas.forbriger committed
30
31
 * REVISIONS and CHANGES 
 *  - 20/12/2003   V1.0   Thomas Forbriger
32
33
 *  - 27/06/2006   V1.1   did not work anymore; deleted old code and filled
 *                        with convolution test
thomas.forbriger's avatar
thomas.forbriger committed
34
35
36
37
 * 
 * ============================================================================
 */
#define TSTEST_VERSION \
38
  "TSTEST   V1.1   test time series modules"
thomas.forbriger's avatar
thomas.forbriger committed
39
#define TSTEST_CVSID \
40
  "$Id: tstest.cc,v 1.3 2006-06-29 07:11:42 tforb Exp $"
thomas.forbriger's avatar
thomas.forbriger committed
41
42
43
44

#include <iostream>
#include <tsxx.h>
#include <aff/dump.h>
45
#include <tsxx/convolve.h>
thomas.forbriger's avatar
thomas.forbriger committed
46
47
48
49
50
51
52

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

int main(int iargc, char* argv[])
{
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
  {
    aff::Series<double> a(-2,2), b(-3,3), c, d;
    cout << endl;
    cout << "convolution test 1" << endl;
    for (int i=a.f(); i<=a.l(); ++i) { a(i)=i; }
    for (int i=b.f(); i<=b.l(); ++i) { b(i)=i; }
    DUMP( a );
    DUMP( b );
    DUMP( ts::convolve(a,b) );
    c=a;
    c.shift(-c.f());
    DUMP( c );
    DUMP( ts::convolve(c,b) );
    d=b;
    d.shift(-d.f());
    DUMP( d );
    DUMP( ts::convolve(c,d) );
  }

  {
    aff::Series<double> a(-2,2), b(-3,3);
    cout << endl;
    cout << "convolution test 2" << endl;
    for (int i=a.f(); i<=a.l(); ++i) { a(i)=1; }
    for (int i=b.f(); i<=b.l(); ++i) { b(i)=1; }
    DUMP( a );
    DUMP( b );
    DUMP( ts::convolve(a,b) );
  }
thomas.forbriger's avatar
thomas.forbriger committed
82
83
84
}

/* ----- END OF tstest.cc ----- */