Generative Fast Fourier Transforms (GFFT)  0.3
metacomplex.h
Go to the documentation of this file.
1 /***************************************************************************
2  * Copyright (C) 2007-2014 by Vladimir Mirnyy *
3  * *
4  * This program is free software; you can redistribute it and/or modify *
5  * it under the terms of the GNU General Public License as published by *
6  * the Free Software Foundation; either version 2 of the License, or *
7  * (at your option) any later version. *
8  * *
9  * This program is distributed in the hope that it will be useful, *
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of *
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
12  * GNU General Public License for more details. *
13  ***************************************************************************/
14 
15 #ifndef __metacomplex_h
16 #define __metacomplex_h
17 
22 #include <cmath>
23 
24 #include "srational.h"
25 
26 
27 
28 template<class Real, class Imag>
29 struct MComplex {
30  typedef Real Re;
31  typedef Imag Im;
32 };
33 
34 
35 template<class Re1, class Im1, class Re2, class Im2>
36 class Add<MComplex<Re1,Im1>, MComplex<Re2,Im2> > {
37  typedef typename Add<Re1,Re2>::Result Re;
38  typedef typename Add<Im1,Im2>::Result Im;
39 public:
40  typedef MComplex<Re,Im> Result;
41 };
42 
43 template<class Re1, class Im1, class Re2, class Im2>
44 class Sub<MComplex<Re1,Im1>, MComplex<Re2,Im2> > {
45  typedef typename Sub<Re1,Re2>::Result Re;
46  typedef typename Sub<Im1,Im2>::Result Im;
47 public:
48  typedef MComplex<Re,Im> Result;
49 };
50 
51 template<class Re1, class Im1, class Re2, class Im2>
52 class Mult<MComplex<Re1,Im1>, MComplex<Re2,Im2> > {
53  typedef typename Mult<Re1,Re2>::Result PRR;
54  typedef typename Mult<Im1,Im2>::Result PII;
55  typedef typename Mult<Im1,Re2>::Result PIR;
56  typedef typename Mult<Re1,Im2>::Result PRI;
57  typedef typename Sub<PRR,PII>::Result Re;
58  typedef typename Add<PIR,PRI>::Result Im;
59 public:
60  typedef MComplex<Re,Im> Result;
61 };
62 
63 
64 #endif /*__metacomplex_h*/

Generated on Mon Feb 10 2014 for Generative Fast Fourier Transforms (GFFT) by DoxyGen 1.8.3.1