[710] | 1 | #include "fftservintf.h"
|
---|
| 2 |
|
---|
| 3 |
|
---|
| 4 |
|
---|
| 5 | /* --Methode-- */
|
---|
| 6 | FFTServerInterface::FFTServerInterface(string info)
|
---|
| 7 | {
|
---|
| 8 | _info = info;
|
---|
| 9 | _fgnorm = false;
|
---|
| 10 | }
|
---|
| 11 |
|
---|
| 12 | /* --Methode-- */
|
---|
| 13 | FFTServerInterface::~FFTServerInterface()
|
---|
| 14 | {
|
---|
| 15 | }
|
---|
| 16 |
|
---|
| 17 | /* --Methode-- */
|
---|
| 18 | void FFTServerInterface::FFTForward(TVector< complex<r_8> > const &, TVector< complex<r_8> > &)
|
---|
| 19 | {
|
---|
| 20 | throw ForbiddenError("FFTServer::FFTForward(TVector...) Unsupported operation !");
|
---|
| 21 | }
|
---|
| 22 |
|
---|
| 23 | /* --Methode-- */
|
---|
| 24 | void FFTServerInterface::FFTBackward(TVector< complex<r_8> > const &, TVector< complex<r_8> > &)
|
---|
| 25 | {
|
---|
| 26 | throw ForbiddenError("FFTServer::FFTBackward(TVector...) Unsupported operation !");
|
---|
| 27 | }
|
---|
| 28 |
|
---|
| 29 | /* --Methode-- */
|
---|
| 30 | void FFTServerInterface::FFTForward(TVector< r_8 > const &, TVector< complex<r_8> > &)
|
---|
| 31 | {
|
---|
| 32 | throw ForbiddenError("FFTServer::FFTForward(TVector...) Unsupported operation !");
|
---|
| 33 | }
|
---|
| 34 |
|
---|
| 35 | /* --Methode-- */
|
---|
| 36 | void FFTServerInterface::FFTBackward(TVector< complex<r_8> > const &, TVector< r_8 > &)
|
---|
| 37 | {
|
---|
| 38 | throw ForbiddenError("FFTServer::FFTBackward(TVector...) Unsupported operation !");
|
---|
| 39 | }
|
---|
| 40 |
|
---|
| 41 | /* --Methode-- */
|
---|
| 42 | void FFTServerInterface::FFTForward(TMatrix< complex<r_8> > const &, TMatrix< complex<r_8> > &)
|
---|
| 43 | {
|
---|
| 44 | throw ForbiddenError("FFTServer::FFTForward(TMatrix...) Unsupported operation !");
|
---|
| 45 | }
|
---|
| 46 |
|
---|
| 47 | /* --Methode-- */
|
---|
| 48 | void FFTServerInterface::FFTBackward(TMatrix< complex<r_8> > const &, TMatrix< complex<r_8> > &)
|
---|
| 49 | {
|
---|
| 50 | throw ForbiddenError("FFTServer::FFTBackward(TMatrix...) Unsupported operation !");
|
---|
| 51 | }
|
---|
| 52 |
|
---|
| 53 | /* --Methode-- */
|
---|
| 54 | void FFTServerInterface::FFTForward(TMatrix< r_8 > const &, TMatrix< complex<r_8> > &)
|
---|
| 55 | {
|
---|
| 56 | throw ForbiddenError("FFTServer::FFTForward(TMatrix...) Unsupported operation !");
|
---|
| 57 | }
|
---|
| 58 |
|
---|
| 59 | /* --Methode-- */
|
---|
| 60 | void FFTServerInterface::FFTBackward(TMatrix< complex<r_8> > const &, TMatrix< r_8 > &)
|
---|
| 61 | {
|
---|
| 62 | throw ForbiddenError("FFTServer::FFTBackward(TMatrix...) Unsupported operation !");
|
---|
| 63 | }
|
---|
| 64 |
|
---|
| 65 |
|
---|
| 66 | // ----------------- Transforme pour les float -------------------
|
---|
| 67 |
|
---|
| 68 | /* --Methode-- */
|
---|
| 69 | void FFTServerInterface::FFTForward(TVector< complex<r_4> > const &, TVector< complex<r_4> > &)
|
---|
| 70 | {
|
---|
| 71 | throw ForbiddenError("FFTServer::FFTForward(TVector r_4 ... ) Unsupported operation !");
|
---|
| 72 | }
|
---|
| 73 |
|
---|
| 74 | /* --Methode-- */
|
---|
| 75 | void FFTServerInterface::FFTBackward(TVector< complex<r_4> > const &, TVector< complex<r_4> > &)
|
---|
| 76 | {
|
---|
| 77 | throw ForbiddenError("FFTServer::FFTBackward(TVector r_4 ... ) Unsupported operation !");
|
---|
| 78 | }
|
---|
| 79 |
|
---|
| 80 | /* --Methode-- */
|
---|
| 81 | void FFTServerInterface::FFTForward(TVector< r_4 > const &, TVector< complex<r_4> > &)
|
---|
| 82 | {
|
---|
| 83 | throw ForbiddenError("FFTServer::FFTForward(TVector r_4 ... ) Unsupported operation !");
|
---|
| 84 | }
|
---|
| 85 |
|
---|
| 86 | /* --Methode-- */
|
---|
| 87 | void FFTServerInterface::FFTBackward(TVector< complex<r_4> > const &, TVector< r_4 > &)
|
---|
| 88 | {
|
---|
| 89 | throw ForbiddenError("FFTServer::FFTBackward(TVector r_4 ... ) Unsupported operation !");
|
---|
| 90 | }
|
---|
| 91 |
|
---|
| 92 | /* --Methode-- */
|
---|
| 93 | void FFTServerInterface::FFTForward(TMatrix< complex<r_4> > const &, TMatrix< complex<r_4> > &)
|
---|
| 94 | {
|
---|
| 95 | throw ForbiddenError("FFTServer::FFTForward(TMatrix r_4 ... ) Unsupported operation !");
|
---|
| 96 | }
|
---|
| 97 |
|
---|
| 98 | /* --Methode-- */
|
---|
| 99 | void FFTServerInterface::FFTBackward(TMatrix< complex<r_4> > const &, TMatrix< complex<r_4> > &)
|
---|
| 100 | {
|
---|
| 101 | throw ForbiddenError("FFTServer::FFTBackward(TMatrix r_4 ... ) Unsupported operation !");
|
---|
| 102 | }
|
---|
| 103 |
|
---|
| 104 | /* --Methode-- */
|
---|
| 105 | void FFTServerInterface::FFTForward(TMatrix< r_4 > const &, TMatrix< complex<r_4> > &)
|
---|
| 106 | {
|
---|
| 107 | throw ForbiddenError("FFTServer::FFTForward(TMatrix r_4 ... ) Unsupported operation !");
|
---|
| 108 | }
|
---|
| 109 |
|
---|
| 110 | /* --Methode-- */
|
---|
| 111 | void FFTServerInterface::FFTBackward(TMatrix< complex<r_4> > const &, TMatrix< r_4 > &)
|
---|
| 112 | {
|
---|
| 113 | throw ForbiddenError("FFTServer::FFTBackward(TMatrix r_4 ... ) Unsupported operation !");
|
---|
| 114 | }
|
---|
| 115 |
|
---|
| 116 |
|
---|
| 117 | // Methodes pour reordonner les donnees
|
---|
| 118 |
|
---|
| 119 | /* --Methode-- */
|
---|
| 120 | void FFTServerInterface::ReShapetoReal( TVector< complex<r_8> > const & in, TVector< r_8 > & out)
|
---|
| 121 | {
|
---|
| 122 | int N = in.NElts();
|
---|
| 123 | out.ReSize(in.NElts()*2);
|
---|
| 124 | out(0) = in(0).real();
|
---|
| 125 | if (in(in.NElts()-1).imag() == 0) {
|
---|
| 126 | for(int i=1; i<in.NElts(); i++)
|
---|
| 127 | out(i) = in(i).real();
|
---|
| 128 |
|
---|
| 129 | for(int i=1; i<in.NElts(); i++)
|
---|
| 130 | out(i+in.NElts()-1) = in(in.NElts()-i-1).imag();
|
---|
| 131 |
|
---|
| 132 | }
|
---|
| 133 | else {
|
---|
| 134 | for(int i=1; i<in.NElts(); i++)
|
---|
| 135 | out(i) = in(i).real();
|
---|
| 136 | for(int i=1; i<in.NElts(); i++)
|
---|
| 137 | out(i+in.NElts()-1) = in(in.NElts()-i).imag();
|
---|
| 138 | }
|
---|
| 139 | }
|
---|
| 140 | /* --Methode-- */
|
---|
| 141 | void FFTServerInterface::ReShapetoReal( TVector< complex<r_4> > const & in, TVector< r_4 > & out)
|
---|
| 142 | {
|
---|
| 143 | int N = in.NElts();
|
---|
| 144 | out.ReSize(in.NElts()*2);
|
---|
| 145 | out(0) = in(0).real();
|
---|
| 146 | if (in(in.NElts()-1).imag() == 0) {
|
---|
| 147 | for(int i=1; i<in.NElts(); i++)
|
---|
| 148 | out(i) = in(i).real();
|
---|
| 149 |
|
---|
| 150 | for(int i=1; i<in.NElts(); i++)
|
---|
| 151 | out(i+in.NElts()-1) = in(in.NElts()-i-1).imag();
|
---|
| 152 |
|
---|
| 153 | }
|
---|
| 154 | else {
|
---|
| 155 | for(int i=1; i<in.NElts(); i++)
|
---|
| 156 | out(i) = in(i).real();
|
---|
| 157 | for(int i=1; i<in.NElts(); i++)
|
---|
| 158 | out(i+in.NElts()-1) = in(in.NElts()-i).imag();
|
---|
| 159 | }
|
---|
| 160 | }
|
---|
| 161 |
|
---|
| 162 |
|
---|
| 163 | /* --Methode-- */
|
---|
| 164 | void FFTServerInterface::ReShapetoCompl(TVector< r_8 > const & in, TVector< complex<r_8> > & out)
|
---|
| 165 | {
|
---|
| 166 | int N = in.NElts();
|
---|
| 167 | out.ReSize(N/2+1);
|
---|
| 168 | out(0) = complex<r_8> (in(0),0.);
|
---|
| 169 |
|
---|
| 170 | if(in.NElts()%2 !=0) {
|
---|
| 171 | for(int k=1;k<=N/2+1;k++) {
|
---|
| 172 | out(k) = complex<r_8> (in(k),in(N-k));
|
---|
| 173 | }
|
---|
| 174 | }
|
---|
| 175 | else {
|
---|
| 176 | for(int k=1;k<N/2;k++) {
|
---|
| 177 | out(k) = complex<r_8> (in(k),in(N-k));
|
---|
| 178 | }
|
---|
| 179 | out(N/2) = complex<r_8> (in(N/2),0.);
|
---|
| 180 | }
|
---|
| 181 |
|
---|
| 182 | }
|
---|
| 183 |
|
---|
| 184 | /* --Methode-- */
|
---|
| 185 | void FFTServerInterface::ReShapetoCompl(TVector< r_4 > const & in, TVector< complex<r_4> > & out)
|
---|
| 186 | {
|
---|
| 187 | int N = in.NElts();
|
---|
| 188 | out.ReSize(N/2+1);
|
---|
| 189 | out(0) = complex<r_4> (in(0),0.);
|
---|
| 190 |
|
---|
| 191 | if(in.NElts()%2 !=0) {
|
---|
| 192 | for(int k=1;k<=N/2+1;k++) {
|
---|
| 193 | out(k) = complex<r_4> (in(k),in(N-k));
|
---|
| 194 | }
|
---|
| 195 | }
|
---|
| 196 | else {
|
---|
| 197 | for(int k=1;k<N/2;k++) {
|
---|
| 198 | out(k) = complex<r_4> (in(k),in(N-k));
|
---|
| 199 | }
|
---|
| 200 | out(N/2) = complex<r_4> (in(N/2),0.);
|
---|
| 201 | }
|
---|
| 202 |
|
---|
| 203 | }
|
---|
| 204 |
|
---|