00001
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00029 #ifndef MIMOLIB_ARITH_H
00030 #define MIMOLIB_ARITH_H
00031
00032 #include <simthetic/basicdevicefactory.h>
00033 #include <simthetic/basicdevice.h>
00034 #include <simthetic/phbib.h>
00035 #include <simthetic/signals.h>
00036 #include <simthetic/phrand.h>
00037
00038 #include "matrix.h"
00039
00040
00041 using namespace simth;
00042
00043 namespace mimo {
00044
00067 class Multiply : public Device
00068 {
00069 protected:
00070 Multiply(int deviceID, DeviceSystemIntf* system,
00071 const simth::PropertyList& pl,
00072 unsigned input_ports);
00073 unsigned iports;
00074
00075 public:
00076 virtual void updateInputLengths();
00077 virtual void updateOutputLengths();
00078
00079 static void init(const std::string& fileName,
00080 Device** dev,
00081 DeviceSystemIntf* sysPtr,
00082 int ID,
00083 const std::string& regionQualifier);
00084 };
00085
00086
00087
00105 template<class seqTM, class seqTV>
00106 class MultiplyTM : public Multiply
00107 {
00108 public:
00109 MultiplyTM(int deviceID, DeviceSystemIntf* system,
00110 const simth::PropertyList& pl,
00111 unsigned input_ports, size_t dimension);
00112
00113 void process();
00114 };
00115
00116
00133 template<class seqTM>
00134 class SquareTM : public Multiply
00135 {
00136 public:
00137 SquareTM(int deviceID, DeviceSystemIntf* system,
00138 const simth::PropertyList& pl,
00139 unsigned input_ports, size_t dimension);
00140
00141 void process();
00142 };
00143
00144
00166 template<class seqTM, class seqTV>
00167 class MultiplyInvTM : public Multiply
00168 {
00169 public:
00170 MultiplyInvTM(int deviceID, DeviceSystemIntf* system,
00171 const simth::PropertyList& pl,
00172 size_t dim_in, size_t dim_out);
00173
00174 void process();
00175 };
00176
00177
00180 template<class seqT_in, class seqT_out>
00181 class CalcCapacity : public Device
00182 {
00183 protected:
00184 unsigned int rows, cols;
00185
00186 private:
00187 double noise;
00188
00189 public:
00190 CalcCapacity(int deviceID, DeviceSystemIntf* system,
00191 const PropertyList& pl);
00192
00196 void setSNR(double snr);
00197 void setNoisePower(double n) { noise = n; };
00198
00199 void updateInputLengths()
00200 {
00201 setInputLength(outputLength());
00202 };
00203 void updateOutputLengths()
00204 {
00205 setOutputLength(inputLength());
00206 };
00207
00208 void process();
00209 };
00210
00212 class CalcSVDValues : public Device
00213 {
00214 protected:
00215 unsigned int rows, cols, nr_svds;
00216
00217 public:
00218 CalcSVDValues(int deviceID, DeviceSystemIntf* system,
00219 const PropertyList& pl);
00220
00221 void updateInputLengths()
00222 { setInputLength(outputLength()); };
00223 void updateOutputLengths()
00224 { setOutputLength(inputLength()); };
00225
00226 void process();
00227 };
00228
00229
00230
00232 class CalcConditionNr : public Device
00233 {
00234 protected:
00235 unsigned int rows, cols;
00236
00237 public:
00238 CalcConditionNr(int deviceID, DeviceSystemIntf* system,
00239 const PropertyList& pl);
00240
00241 void updateInputLengths()
00242 { setInputLength(outputLength()); };
00243 void updateOutputLengths()
00244 { setOutputLength(inputLength()); };
00245
00246 void process();
00247 };
00248
00250 class CalcRank : public CalcConditionNr
00251 {
00252 public:
00253 CalcRank(int deviceID, DeviceSystemIntf* system,
00254 const PropertyList& pl);
00255 void process();
00256 };
00257
00258
00259
00262 template<class seqT_in, class seqT_out>
00263 class CalcMax : public Device
00264 {
00265 protected:
00266 unsigned int length;
00267
00268 public:
00269 CalcMax(int deviceID, DeviceSystemIntf* system,
00270 const PropertyList& pl);
00271
00272 void updateInputLengths()
00273 {
00274 setInputLength(outputLength());
00275 };
00276 void updateOutputLengths()
00277 {
00278 setOutputLength(inputLength());
00279 };
00280
00281 void process();
00282 };
00283
00284
00285
00286
00287
00288
00289 namespace Invert {
00290 void init(const std::string& fileName,
00291 Device** dev,
00292 DeviceSystemIntf* sysPtr,
00293 int ID,
00294 const std::string& regionQualifier);
00295 }
00296
00297
00298
00313 template<class seqT>
00314 class InvertTM : public Multiply
00315 {
00316 public:
00317 InvertTM(int deviceID, DeviceSystemIntf* system,
00318 const simth::PropertyList& pl,
00319 size_t dim1, size_t dim2);
00320
00321 void process();
00322 };
00323
00324
00327 class AwgnGenerator : public simth::Device
00328 {
00329 public:
00330
00331 AwgnGenerator(int deviceID, simth::DeviceSystemIntf* system,
00332 const simth::PropertyList& pl = simth::PropertyList());
00333
00334 ~AwgnGenerator();
00335
00336 virtual void process();
00337
00344 virtual void setSNR(double snr);
00345
00346 void updateInputLengths();
00347 void updateOutputLengths();
00348 void startOfSimulation();
00349
00350 private:
00351
00355 double getGauss() const;
00356
00359 simth::GaussRng gauss;
00360 };
00361
00362 }
00363
00364
00365 #endif