| [2615] | 1 | #include "sopnamsp.h" | 
|---|
| [585] | 2 | #include "machdefs.h" | 
|---|
|  | 3 | #include <stdlib.h> | 
|---|
|  | 4 | #include <typeinfo> | 
|---|
| [2322] | 5 | #include <iostream> | 
|---|
| [585] | 6 | #include <string> | 
|---|
|  | 7 | #include <complex> | 
|---|
|  | 8 |  | 
|---|
| [1224] | 9 | #include "datatype.h" | 
|---|
|  | 10 |  | 
|---|
| [585] | 11 | #include "tvector.h" | 
|---|
| [1207] | 12 | #include "objfitter.h" | 
|---|
| [585] | 13 | #include "nomtmatvecadapter.h" | 
|---|
| [1905] | 14 | #include "piyfxdrw.h" | 
|---|
| [585] | 15 | #include "pitvmaad.h" | 
|---|
|  | 16 |  | 
|---|
| [3222] | 17 | #include "cimage.h"       // Pour la prise en charge des Image<T> (Avr 2007) | 
|---|
| [3221] | 18 | #include "pimgadapter.h"  // Adaptateur de tableaux PIImage pour Image<T> | 
|---|
|  | 19 |  | 
|---|
| [810] | 20 | #include "fioarr.h" | 
|---|
| [585] | 21 |  | 
|---|
| [2999] | 22 | #include "nobjmgr.h" | 
|---|
| [585] | 23 |  | 
|---|
|  | 24 | //---------------------------------------------------------------- | 
|---|
|  | 25 | // Class Adaptateur d'objet (Pour NamedObjMgr) d'objet TMatrix<T> | 
|---|
|  | 26 | //---------------------------------------------------------------- | 
|---|
|  | 27 |  | 
|---|
|  | 28 |  | 
|---|
|  | 29 | /* --Methode-- */ | 
|---|
|  | 30 | template <class T> | 
|---|
|  | 31 | NOMAdapter_TMatrix<T>::NOMAdapter_TMatrix(TMatrix<T>* o) | 
|---|
|  | 32 | : NObjMgrAdapter(o) | 
|---|
|  | 33 | { | 
|---|
|  | 34 | mMtx = o; | 
|---|
|  | 35 | } | 
|---|
|  | 36 |  | 
|---|
|  | 37 | /* --Methode-- */ | 
|---|
|  | 38 | template <class T> | 
|---|
|  | 39 | NOMAdapter_TMatrix<T>::~NOMAdapter_TMatrix() | 
|---|
|  | 40 | { | 
|---|
|  | 41 | } | 
|---|
|  | 42 |  | 
|---|
|  | 43 | /* --Methode-- */ | 
|---|
|  | 44 | template <class T> | 
|---|
|  | 45 | NObjMgrAdapter* NOMAdapter_TMatrix<T>::Clone(AnyDataObj* o) | 
|---|
|  | 46 | { | 
|---|
|  | 47 | TMatrix<T>* m = dynamic_cast<TMatrix<T> *>(o); | 
|---|
|  | 48 | if (m) return ( new NOMAdapter_TMatrix<T>(m) ); | 
|---|
|  | 49 | return ( new NObjMgrAdapter(o) ); | 
|---|
|  | 50 | } | 
|---|
|  | 51 |  | 
|---|
|  | 52 | /* --Methode-- */ | 
|---|
|  | 53 | template <class T> | 
|---|
| [1165] | 54 | string NOMAdapter_TMatrix<T>::GetDataObjType() | 
|---|
| [585] | 55 | { | 
|---|
| [1165] | 56 | string type = "TMatrix< "; | 
|---|
|  | 57 |  | 
|---|
|  | 58 | TVector<T>* v = dynamic_cast<TVector<T> *>(mMtx); | 
|---|
|  | 59 | if (v != NULL) type = "TVector< "; | 
|---|
| [3221] | 60 | else { | 
|---|
|  | 61 | Image<T>* img = dynamic_cast<Image<T> *>(mMtx); | 
|---|
|  | 62 | if (img != NULL) type = "Image< "; | 
|---|
|  | 63 | } | 
|---|
| [1224] | 64 | // type +=  DecodeTypeIdName(typeid(T).name()); | 
|---|
| [1237] | 65 | type += DataTypeInfo<T>::getTypeName(); | 
|---|
| [1165] | 66 | type +=  " > "; | 
|---|
|  | 67 | return(type); | 
|---|
|  | 68 | } | 
|---|
|  | 69 |  | 
|---|
|  | 70 | /* --Methode-- */ | 
|---|
|  | 71 | template <class T> | 
|---|
| [1315] | 72 | AnyDataObj* NOMAdapter_TMatrix<T>::CloneDataObj(bool share) | 
|---|
| [1165] | 73 | { | 
|---|
| [585] | 74 | if (mMtx == NULL)  return(NULL); | 
|---|
|  | 75 | TVector<T>* v = dynamic_cast<TVector<T> *>(mMtx); | 
|---|
| [1315] | 76 | if (v != NULL) return( new TVector<T>(*v, share) ); | 
|---|
| [3221] | 77 | else { | 
|---|
|  | 78 | Image<T>* img = dynamic_cast<Image<T> *>(mMtx); | 
|---|
|  | 79 | if (img != NULL) return ( new Image<T>(*img, share) ); | 
|---|
|  | 80 | else return ( new TMatrix<T>(*mMtx, share) ); | 
|---|
| [585] | 81 | } | 
|---|
|  | 82 |  | 
|---|
| [3221] | 83 | } | 
|---|
|  | 84 |  | 
|---|
| [2999] | 85 | /* --Methode-- */ | 
|---|
|  | 86 | template <class T> | 
|---|
|  | 87 | string NOMAdapter_TMatrix<T>::GetInfoString(vector<string>& opts) | 
|---|
|  | 88 | { | 
|---|
|  | 89 | if (opts.size() == 0) return mMtx->InfoString(); | 
|---|
|  | 90 | else { | 
|---|
|  | 91 | if (opts[0] == "rank") return string("2"); | 
|---|
|  | 92 | else if (opts[0] == "sizes") { | 
|---|
|  | 93 | char buff[64]; | 
|---|
|  | 94 | TVector<T>* v = dynamic_cast<TVector<T> *>(mMtx); | 
|---|
|  | 95 | if (v != NULL) sprintf(buff, "%ld", (long)mMtx->Size()); | 
|---|
|  | 96 | else sprintf(buff, "%ld %ld", (long)mMtx->NRows(), (long)mMtx->NCols()); | 
|---|
|  | 97 | return string(buff); | 
|---|
|  | 98 | } | 
|---|
|  | 99 | else if ((opts[0] == "size") || (opts[0] == "nelts")) { | 
|---|
|  | 100 | char buff[32]; | 
|---|
|  | 101 | sprintf(buff, "%ld", (long)mMtx->Size()); | 
|---|
|  | 102 | return string(buff); | 
|---|
|  | 103 | } | 
|---|
| [3033] | 104 | else if ((opts[0] == "nrow") || (opts[0] == "nrows")) { | 
|---|
|  | 105 | char buff[32]; | 
|---|
|  | 106 | sprintf(buff, "%ld", (long)mMtx->NRows()); | 
|---|
|  | 107 | return string(buff); | 
|---|
|  | 108 | } | 
|---|
|  | 109 | else if ((opts[0] == "ncol") || (opts[0] == "ncols")) { | 
|---|
|  | 110 | char buff[32]; | 
|---|
|  | 111 | sprintf(buff, "%ld", (long)mMtx->NCols()); | 
|---|
|  | 112 | return string(buff); | 
|---|
|  | 113 | } | 
|---|
| [2999] | 114 | else if (opts[0] == "sum") { | 
|---|
|  | 115 | MuTyV mtv(mMtx->Sum()); | 
|---|
|  | 116 | string s; | 
|---|
|  | 117 | return mtv.Convert(s); | 
|---|
|  | 118 | } | 
|---|
| [3333] | 119 | else if (opts[0] == "sumsq") { | 
|---|
|  | 120 | MuTyV mtv(mMtx->SumSq()); | 
|---|
|  | 121 | string s; | 
|---|
|  | 122 | return mtv.Convert(s); | 
|---|
|  | 123 | } | 
|---|
|  | 124 | else if (opts[0] == "norm2") { | 
|---|
|  | 125 | MuTyV mtv(mMtx->Norm2()); | 
|---|
| [3335] | 126 | r_8 nrm2 = mtv.Convert(nrm2);  // we force the conversion to double | 
|---|
|  | 127 | mtv = nrm2; | 
|---|
| [3333] | 128 | string s; | 
|---|
|  | 129 | return mtv.Convert(s); | 
|---|
|  | 130 | } | 
|---|
|  | 131 | else if ((opts[0] == "min")||(opts[0] == "max")||(opts[0] == "minmax")) { | 
|---|
|  | 132 | T amin, amax; | 
|---|
|  | 133 | MuTyV mtv; | 
|---|
|  | 134 | string s; | 
|---|
|  | 135 | mMtx->MinMax(amin, amax); | 
|---|
|  | 136 | if (opts[0] == "minmax") { | 
|---|
|  | 137 | mtv = amin;  mtv.Convert(s); | 
|---|
|  | 138 | s += " "; | 
|---|
|  | 139 | string mms; | 
|---|
|  | 140 | mtv = amax;  mtv.Convert(mms); | 
|---|
|  | 141 | s += mms; | 
|---|
|  | 142 | } | 
|---|
|  | 143 | else { | 
|---|
|  | 144 | if (opts[0] == "min")  mtv = amin; | 
|---|
|  | 145 | else if (opts[0] == "max")  mtv = amax; | 
|---|
|  | 146 | mtv.Convert(s); | 
|---|
|  | 147 | } | 
|---|
|  | 148 | return s; | 
|---|
|  | 149 | } | 
|---|
| [3221] | 150 | else if (opts[0] == "info") { // Acces aux valeurs stockes ds le DVList Info() | 
|---|
|  | 151 | if (opts.size() < 2)  return string(""); | 
|---|
|  | 152 | else if (mMtx->Info().HasKey(opts[1]) == false) return string(""); | 
|---|
|  | 153 | else return mMtx->Info().GetS(opts[1]); | 
|---|
|  | 154 | } | 
|---|
| [3333] | 155 | else return "TMatrix.Att: rank size/nelts nrow/nrows ncol/ncols sum sumsq norm2 min max minmax info.varname"; | 
|---|
| [2999] | 156 | } | 
|---|
|  | 157 | } | 
|---|
| [1321] | 158 |  | 
|---|
|  | 159 | /* --Methode-- */ | 
|---|
|  | 160 | template <class T> | 
|---|
| [2999] | 161 | int NOMAdapter_TMatrix<T>::PerformOperation(vector<string>& opts) | 
|---|
|  | 162 | { | 
|---|
|  | 163 | bool ok = false; | 
|---|
|  | 164 | if (opts.size() >= 2) { | 
|---|
|  | 165 | int_4 kk = atoi(opts[1].c_str()); | 
|---|
|  | 166 | TVector<T> * vrc = new TVector<T>; | 
|---|
|  | 167 | char buff[40]; | 
|---|
|  | 168 | if ((opts[0] == "row") || (opts[0] == "line")) { | 
|---|
|  | 169 | vrc->Share(mMtx->Row((sa_size_t)kk)); | 
|---|
|  | 170 | ok = true; | 
|---|
|  | 171 | sprintf(buff,"row_%ld",(long)kk); | 
|---|
|  | 172 | cout << "PerformOperation(): Extracting Row(" << kk << ") from matrix" << endl; | 
|---|
|  | 173 | } | 
|---|
|  | 174 | else if ((opts[0] == "col") || (opts[0] == "column")) { | 
|---|
|  | 175 | vrc->Share(mMtx->Column((sa_size_t)kk)); | 
|---|
|  | 176 | ok = true; | 
|---|
|  | 177 | sprintf(buff,"col_%ld",(long)kk); | 
|---|
|  | 178 | cout << "PerformOperation(): Extracting Column(" << kk << ") from matrix" << endl; | 
|---|
|  | 179 | } | 
|---|
|  | 180 | if (ok) { | 
|---|
|  | 181 | string nvrc; | 
|---|
|  | 182 | if (opts.size() > 2)  nvrc = opts[2]; | 
|---|
|  | 183 | else nvrc = buff; | 
|---|
|  | 184 | NamedObjMgr omg; | 
|---|
|  | 185 | omg.AddObj(vrc, nvrc, true); | 
|---|
|  | 186 | return 0; | 
|---|
|  | 187 | } | 
|---|
|  | 188 | } | 
|---|
|  | 189 |  | 
|---|
| [3039] | 190 | cout << "NOMAdapter_TMatrix<T>::PerformOperation(): Error operation/arguments !" << endl; | 
|---|
|  | 191 | cout << "...Valid args: row/line r [rowname] , col/column c [rowname]" << endl; | 
|---|
| [2999] | 192 | return 1; | 
|---|
|  | 193 | } | 
|---|
|  | 194 |  | 
|---|
|  | 195 | /* --Methode-- */ | 
|---|
|  | 196 | template <class T> | 
|---|
| [585] | 197 | void NOMAdapter_TMatrix<T>::SavePPF(POutPersist& pos, string const & nom) | 
|---|
|  | 198 | { | 
|---|
|  | 199 | if (mMtx == NULL)  return; | 
|---|
|  | 200 | TVector<T>* v = dynamic_cast<TVector<T> *>(mMtx); | 
|---|
|  | 201 | if (v != NULL) { | 
|---|
| [810] | 202 | FIO_TArray<T> fio(v); | 
|---|
| [585] | 203 | fio.Write(pos, nom); | 
|---|
| [3221] | 204 | } | 
|---|
| [585] | 205 | else { | 
|---|
| [3221] | 206 | Image<T>* img = dynamic_cast<Image<T> *>(mMtx); | 
|---|
|  | 207 | if (img != NULL) { | 
|---|
|  | 208 | FIO_Image<T> fio(img); | 
|---|
|  | 209 | fio.Write(pos, nom); | 
|---|
| [585] | 210 | } | 
|---|
| [3221] | 211 | else { | 
|---|
|  | 212 | FIO_TArray<T> fio(mMtx); | 
|---|
|  | 213 | fio.Write(pos, nom); | 
|---|
|  | 214 | } | 
|---|
| [585] | 215 | } | 
|---|
| [3221] | 216 | return; | 
|---|
|  | 217 | } | 
|---|
| [585] | 218 |  | 
|---|
|  | 219 | /* --Methode-- */ | 
|---|
|  | 220 | template <class T> | 
|---|
| [2975] | 221 | void NOMAdapter_TMatrix<T>::Print(ostream& os, int lev) | 
|---|
| [585] | 222 | { | 
|---|
| [2975] | 223 | if (lev < 3) mMtx->Show(os, false); | 
|---|
|  | 224 | else  mMtx->Show(os, true); | 
|---|
|  | 225 | if (lev > 0) mMtx->Print(os, 10*lev); | 
|---|
| [585] | 226 | } | 
|---|
|  | 227 |  | 
|---|
|  | 228 | /* --Methode-- */ | 
|---|
|  | 229 | template <class T> | 
|---|
|  | 230 | PIDrawer* NOMAdapter_TMatrix<T>::GetDrawer(string & dopt) | 
|---|
|  | 231 | { | 
|---|
|  | 232 | TVector<T>* v = dynamic_cast<TVector<T> *>(mMtx); | 
|---|
|  | 233 | if (v == NULL) return(NULL); | 
|---|
|  | 234 | else { | 
|---|
| [1971] | 235 | dopt = "thinline " + dopt; | 
|---|
| [585] | 236 | return( new PIYfXDrawer( new POTVectorAdapter<T>(v, false), NULL, true) ); | 
|---|
|  | 237 | } | 
|---|
|  | 238 | } | 
|---|
|  | 239 |  | 
|---|
|  | 240 | /* --Methode-- */ | 
|---|
|  | 241 | template <class T> | 
|---|
|  | 242 | P2DArrayAdapter* NOMAdapter_TMatrix<T>::Get2DArray(string &) | 
|---|
|  | 243 | { | 
|---|
| [3221] | 244 | Image<T>* img = dynamic_cast<Image<T> *>(mMtx); | 
|---|
|  | 245 | if (img != NULL) return ( new ImageAdapter<T>(img, false) ); | 
|---|
|  | 246 | else return ( new POTMatrixAdapter<T>(mMtx, false) ); | 
|---|
| [585] | 247 | } | 
|---|
|  | 248 |  | 
|---|
| [3221] | 249 | // ---- Specialisation pour complexes ----- | 
|---|
|  | 250 | DECL_TEMP_SPEC  /* equivalent a template <> , pour SGI-CC en particulier */ | 
|---|
|  | 251 | P2DArrayAdapter* NOMAdapter_TMatrix< complex<r_4> >::Get2DArray(string &) | 
|---|
|  | 252 | { | 
|---|
|  | 253 | return ( new POTMatrixAdapter< complex<r_4> >(mMtx, false) ); | 
|---|
|  | 254 | } | 
|---|
|  | 255 | DECL_TEMP_SPEC  /* equivalent a template <> , pour SGI-CC en particulier */ | 
|---|
|  | 256 | P2DArrayAdapter* NOMAdapter_TMatrix< complex<r_8> >::Get2DArray(string &) | 
|---|
|  | 257 | { | 
|---|
|  | 258 | return ( new POTMatrixAdapter< complex<r_8> >(mMtx, false) ); | 
|---|
|  | 259 | } | 
|---|
|  | 260 | // ------------------------------------------------------------- | 
|---|
|  | 261 |  | 
|---|
| [585] | 262 | /* --Methode-- */ | 
|---|
|  | 263 | template <class T> | 
|---|
|  | 264 | NTupleInterface* NOMAdapter_TMatrix<T>::GetNTupleInterface(bool& adel) | 
|---|
|  | 265 | { | 
|---|
|  | 266 | adel = true; | 
|---|
|  | 267 | return( new NTupInt_TMatrix<T>(mMtx) ); | 
|---|
|  | 268 | } | 
|---|
|  | 269 |  | 
|---|
|  | 270 |  | 
|---|
| [1207] | 271 | /* --Methode-- */ | 
|---|
|  | 272 | template <class T> | 
|---|
|  | 273 | GeneralFitData* NOMAdapter_TMatrix<T>::GetGeneralFitData(bool& adel | 
|---|
|  | 274 | ,GeneralFitData::FitErrType errtype,double errscale,double errmin | 
|---|
|  | 275 | ,int i1,int i2,int j1,int j2) | 
|---|
|  | 276 | { | 
|---|
|  | 277 | adel = false; | 
|---|
|  | 278 | if(!mMtx) return(NULL); | 
|---|
| [585] | 279 |  | 
|---|
| [1207] | 280 | int nx,ny; | 
|---|
|  | 281 | TVector<T>* vec = dynamic_cast<TVector<T> *>(mMtx); | 
|---|
|  | 282 |  | 
|---|
|  | 283 | if(vec) {  // C'est un TVector | 
|---|
|  | 284 | nx = vec->NElts(); | 
|---|
|  | 285 | ny = 1; | 
|---|
|  | 286 | } else { | 
|---|
|  | 287 | nx = mMtx->NRows(); | 
|---|
|  | 288 | ny = mMtx->NCol(); | 
|---|
|  | 289 | if(nx<=0 || ny<=0) return(NULL); | 
|---|
|  | 290 | } | 
|---|
|  | 291 |  | 
|---|
|  | 292 | i1 = (i1<0||i1>=nx)? 0: i1; | 
|---|
|  | 293 | i2 = (i2<0||i2>=nx||i2<i1)? nx-1: i2; | 
|---|
|  | 294 | j1 = (j1<0||j1>=ny)? 0: j1; | 
|---|
|  | 295 | j2 = (j2<0||j2>=ny||j2<j1)? ny-1: j2; | 
|---|
|  | 296 |  | 
|---|
|  | 297 | GeneralFitData* mGData = NULL; | 
|---|
|  | 298 |  | 
|---|
|  | 299 | if(vec) {  // C'est un TVector | 
|---|
|  | 300 | mGData = new GeneralFitData(1,(i2-i1+1),0); | 
|---|
|  | 301 | adel = true; | 
|---|
|  | 302 | for(int i=i1;i<=i2;i++) { | 
|---|
|  | 303 | double x = (double) i; | 
|---|
|  | 304 | double f = (*vec)(i); | 
|---|
|  | 305 | double e = 1.; | 
|---|
|  | 306 | e = GeneralFitData::ComputeError(f,e,errtype,errscale,errmin); | 
|---|
|  | 307 | mGData->AddData1(x,f,e); | 
|---|
|  | 308 | } | 
|---|
|  | 309 | } else { | 
|---|
|  | 310 | mGData = new GeneralFitData(2,(i2-i1+1)*(j2-j1+1),0); | 
|---|
|  | 311 | adel = true; | 
|---|
|  | 312 | for(int i=i1;i<=i2;i++) for(int j=j1;j<=j2;j++) { | 
|---|
|  | 313 | double x = (double) i; | 
|---|
|  | 314 | double y = (double) j; | 
|---|
|  | 315 | double f = (*mMtx)(i,j); | 
|---|
|  | 316 | double e = 1.; | 
|---|
|  | 317 | e = GeneralFitData::ComputeError(f,e,errtype,errscale,errmin); | 
|---|
|  | 318 | mGData->AddData2(x,y,f,e); | 
|---|
|  | 319 | } | 
|---|
|  | 320 | } | 
|---|
|  | 321 |  | 
|---|
|  | 322 | return mGData; | 
|---|
|  | 323 | } | 
|---|
|  | 324 |  | 
|---|
|  | 325 | template <class T> | 
|---|
|  | 326 | AnyDataObj* NOMAdapter_TMatrix<T>::FitResidusObj(GeneralFit& mfit) | 
|---|
|  | 327 | { | 
|---|
|  | 328 | TVector<T>* vec = dynamic_cast<TVector<T> *>(mMtx); | 
|---|
|  | 329 | if(vec) { | 
|---|
|  | 330 | TVector<T>* v = new TVector<T>(ObjectFitter::FitResidus(*vec,mfit),true); | 
|---|
|  | 331 | return v; | 
|---|
|  | 332 | } else { | 
|---|
|  | 333 | TMatrix<T>* m = new TMatrix<T>(ObjectFitter::FitResidus(*mMtx,mfit),true); | 
|---|
|  | 334 | return m; | 
|---|
|  | 335 | } | 
|---|
|  | 336 | } | 
|---|
|  | 337 |  | 
|---|
|  | 338 | template <class T> | 
|---|
|  | 339 | AnyDataObj* NOMAdapter_TMatrix<T>::FitFunctionObj(GeneralFit& mfit) | 
|---|
|  | 340 | { | 
|---|
|  | 341 | TVector<T>* vec = dynamic_cast<TVector<T> *>(mMtx); | 
|---|
|  | 342 | if(vec) { | 
|---|
|  | 343 | TVector<T>* v = new TVector<T>(ObjectFitter::FitFunction(*vec,mfit),true); | 
|---|
|  | 344 | return v; | 
|---|
|  | 345 | } else { | 
|---|
|  | 346 | TMatrix<T>* m = new TMatrix<T>(ObjectFitter::FitFunction(*mMtx,mfit),true); | 
|---|
|  | 347 | return m; | 
|---|
|  | 348 | } | 
|---|
|  | 349 | } | 
|---|
|  | 350 |  | 
|---|
| [1315] | 351 | // ---- Specialisation pour complexes ----- | 
|---|
| [2343] | 352 | DECL_TEMP_SPEC  /* equivalent a template <> , pour SGI-CC en particulier */ | 
|---|
| [1315] | 353 | GeneralFitData* NOMAdapter_TMatrix< complex<r_4> >::GetGeneralFitData(bool& adel | 
|---|
|  | 354 | ,GeneralFitData::FitErrType errtype,double errscale,double errmin | 
|---|
|  | 355 | ,int i1,int i2,int j1,int j2) | 
|---|
|  | 356 | { | 
|---|
|  | 357 | return(NULL); | 
|---|
|  | 358 | } | 
|---|
| [1207] | 359 |  | 
|---|
| [2343] | 360 | DECL_TEMP_SPEC  /* equivalent a template <> , pour SGI-CC en particulier */ | 
|---|
| [1315] | 361 | AnyDataObj* NOMAdapter_TMatrix< complex<r_4> >::FitResidusObj(GeneralFit& mfit) | 
|---|
|  | 362 | { | 
|---|
|  | 363 | return(NULL); | 
|---|
|  | 364 | } | 
|---|
|  | 365 |  | 
|---|
| [2343] | 366 | DECL_TEMP_SPEC  /* equivalent a template <> , pour SGI-CC en particulier */ | 
|---|
| [1315] | 367 | AnyDataObj* NOMAdapter_TMatrix< complex<r_4> >::FitFunctionObj(GeneralFit& mfit) | 
|---|
|  | 368 | { | 
|---|
|  | 369 | return(NULL); | 
|---|
|  | 370 | } | 
|---|
|  | 371 |  | 
|---|
| [2343] | 372 | DECL_TEMP_SPEC  /* equivalent a template <> , pour SGI-CC en particulier */ | 
|---|
| [1315] | 373 | GeneralFitData* NOMAdapter_TMatrix< complex<r_8> >::GetGeneralFitData(bool& adel | 
|---|
|  | 374 | ,GeneralFitData::FitErrType errtype,double errscale,double errmin | 
|---|
|  | 375 | ,int i1,int i2,int j1,int j2) | 
|---|
|  | 376 | { | 
|---|
|  | 377 | return(NULL); | 
|---|
|  | 378 | } | 
|---|
|  | 379 |  | 
|---|
| [2343] | 380 | DECL_TEMP_SPEC  /* equivalent a template <> , pour SGI-CC en particulier */ | 
|---|
| [1315] | 381 | AnyDataObj* NOMAdapter_TMatrix< complex<r_8> >::FitResidusObj(GeneralFit& mfit) | 
|---|
|  | 382 | { | 
|---|
|  | 383 | return(NULL); | 
|---|
|  | 384 | } | 
|---|
|  | 385 |  | 
|---|
| [2343] | 386 | DECL_TEMP_SPEC  /* equivalent a template <> , pour SGI-CC en particulier */ | 
|---|
| [1315] | 387 | AnyDataObj* NOMAdapter_TMatrix< complex<r_8> >::FitFunctionObj(GeneralFit& mfit) | 
|---|
|  | 388 | { | 
|---|
|  | 389 | return(NULL); | 
|---|
|  | 390 | } | 
|---|
|  | 391 |  | 
|---|
| [585] | 392 | // ------------------------------------------------------------- | 
|---|
|  | 393 |  | 
|---|
|  | 394 | /* --Methode-- */ | 
|---|
|  | 395 | template <class T> | 
|---|
|  | 396 | NTupInt_TMatrix<T>::NTupInt_TMatrix(TMatrix<T>* m) | 
|---|
|  | 397 | { | 
|---|
|  | 398 | mMtx = m; | 
|---|
|  | 399 | } | 
|---|
|  | 400 |  | 
|---|
|  | 401 | /* --Methode-- */ | 
|---|
|  | 402 | template <class T> | 
|---|
|  | 403 | NTupInt_TMatrix<T>::~NTupInt_TMatrix() | 
|---|
|  | 404 | { | 
|---|
|  | 405 | } | 
|---|
|  | 406 |  | 
|---|
|  | 407 | /* --Methode-- */ | 
|---|
|  | 408 | template <class T> | 
|---|
| [2683] | 409 | sa_size_t NTupInt_TMatrix<T>::NbLines() const | 
|---|
| [585] | 410 | { | 
|---|
|  | 411 | return( mMtx->NRows()*mMtx->NCols() ); | 
|---|
|  | 412 | } | 
|---|
|  | 413 |  | 
|---|
|  | 414 | /* --Methode-- */ | 
|---|
|  | 415 | template <class T> | 
|---|
| [2683] | 416 | sa_size_t  NTupInt_TMatrix<T>::NbColumns() const | 
|---|
| [585] | 417 | { | 
|---|
|  | 418 | return(8); | 
|---|
|  | 419 | } | 
|---|
|  | 420 |  | 
|---|
|  | 421 | /* --Methode-- */ | 
|---|
|  | 422 | template <class T> | 
|---|
| [2683] | 423 | r_8* NTupInt_TMatrix<T>::GetLineD(sa_size_t n) const | 
|---|
| [585] | 424 | { | 
|---|
|  | 425 | int i,j; | 
|---|
|  | 426 | if ((n < 0) || (n >= (int)(mMtx->NRows()*mMtx->NCols()) )) { | 
|---|
|  | 427 | mRet[0] = n; | 
|---|
|  | 428 | for(i=1; i<8; i++)  mRet[i] = 0.; | 
|---|
|  | 429 | } | 
|---|
|  | 430 | else { | 
|---|
|  | 431 | i = n/mMtx->NCols(); j = n%mMtx->NCols(); | 
|---|
|  | 432 | mRet[0] = n;  mRet[1] = i;  mRet[2] = j; | 
|---|
|  | 433 | mRet[3] = (*mMtx)(i,j); | 
|---|
|  | 434 | mRet[4] = mRet[2];  mRet[5] = 0.; | 
|---|
|  | 435 | mRet[6] = mRet[2];  mRet[7] = 0.; | 
|---|
|  | 436 | } | 
|---|
|  | 437 | return(mRet); | 
|---|
|  | 438 | } | 
|---|
|  | 439 |  | 
|---|
|  | 440 | /* --Methode-- */ | 
|---|
|  | 441 | template <class T> | 
|---|
|  | 442 | string NTupInt_TMatrix<T>::VarList_C(const char* nx) const | 
|---|
|  | 443 | { | 
|---|
|  | 444 | string nomx; | 
|---|
|  | 445 | if (nx) nomx = nx; | 
|---|
|  | 446 | else nomx = "_xh_"; | 
|---|
|  | 447 | string vardec = "double n,r,c,val,real,imag,mod,phas; \n"; | 
|---|
|  | 448 | vardec += "n = " + nomx + "[0];  r = " + nomx + "[1]; c = " + nomx + "[2]; \n"; | 
|---|
|  | 449 | vardec += "val = " + nomx + "[3]; \n"; | 
|---|
|  | 450 | vardec += "real = " + nomx + "[4];  imag = " + nomx + "[5]; \n"; | 
|---|
|  | 451 | vardec += "mod  = " + nomx + "[6];  phas = " + nomx + "[7]; \n"; | 
|---|
|  | 452 | return(vardec); | 
|---|
|  | 453 | } | 
|---|
|  | 454 |  | 
|---|
|  | 455 | /* --Methode-- */ | 
|---|
| [2343] | 456 | DECL_TEMP_SPEC  /* equivalent a template <> , pour SGI-CC en particulier */ | 
|---|
| [2689] | 457 | r_8* NTupInt_TMatrix< complex<r_4> >::GetLineD(sa_size_t n) const | 
|---|
| [585] | 458 | { | 
|---|
|  | 459 | int i,j; | 
|---|
|  | 460 | if ((n < 0) || (n >= (int)(mMtx->NRows()*mMtx->NCols()) )) { | 
|---|
|  | 461 | mRet[0] = n; | 
|---|
|  | 462 | for(i=1; i<8; i++)  mRet[i] = 0.; | 
|---|
|  | 463 | } | 
|---|
|  | 464 | else { | 
|---|
|  | 465 | i = n/mMtx->NCols(); j = n%mMtx->NCols(); | 
|---|
|  | 466 | mRet[0] = n;   mRet[1] = i;  mRet[2] = j; | 
|---|
|  | 467 | mRet[4] = (*mMtx)(i,j).real();  mRet[5] = (*mMtx)(i,j).imag(); | 
|---|
|  | 468 | mRet[3] = mRet[6] = sqrt(mRet[4]*mRet[4]+mRet[5]*mRet[5]); | 
|---|
|  | 469 | mRet[7] = atan2(mRet[5], mRet[4]); | 
|---|
|  | 470 | } | 
|---|
|  | 471 | return(mRet); | 
|---|
|  | 472 | } | 
|---|
|  | 473 |  | 
|---|
| [2343] | 474 | DECL_TEMP_SPEC  /* equivalent a template <> , pour SGI-CC en particulier */ | 
|---|
| [2689] | 475 | r_8* NTupInt_TMatrix< complex<r_8> >::GetLineD(sa_size_t n) const | 
|---|
| [585] | 476 | { | 
|---|
|  | 477 | int i,j; | 
|---|
|  | 478 | if ((n < 0) || (n >= (int)(mMtx->NRows()*mMtx->NCols()) )) { | 
|---|
|  | 479 | mRet[0] = n; | 
|---|
|  | 480 | for(i=1; i<8; i++)  mRet[i] = 0.; | 
|---|
|  | 481 | } | 
|---|
|  | 482 | else { | 
|---|
|  | 483 | i = n/mMtx->NCols(); j = n%mMtx->NCols(); | 
|---|
|  | 484 | mRet[0] = n;   mRet[1] = i;  mRet[2] = j; | 
|---|
|  | 485 | mRet[4] = (*mMtx)(i,j).real();  mRet[5] = (*mMtx)(i,j).imag(); | 
|---|
|  | 486 | mRet[3] = mRet[6] = sqrt(mRet[4]*mRet[4]+mRet[5]*mRet[5]); | 
|---|
|  | 487 | mRet[7] = atan2(mRet[5], mRet[4]); | 
|---|
|  | 488 | } | 
|---|
|  | 489 | return(mRet); | 
|---|
|  | 490 | } | 
|---|
|  | 491 |  | 
|---|
|  | 492 |  | 
|---|
|  | 493 | #ifdef __CXX_PRAGMA_TEMPLATES__ | 
|---|
| [2930] | 494 | #pragma define_template NOMAdapter_TMatrix<uint_2> | 
|---|
|  | 495 | #pragma define_template NOMAdapter_TMatrix<int_2> | 
|---|
| [585] | 496 | #pragma define_template NOMAdapter_TMatrix<int_4> | 
|---|
| [2930] | 497 | #pragma define_template NOMAdapter_TMatrix<int_8> | 
|---|
| [585] | 498 | #pragma define_template NOMAdapter_TMatrix<r_4> | 
|---|
|  | 499 | #pragma define_template NOMAdapter_TMatrix<r_8> | 
|---|
| [1315] | 500 | #pragma define_template NOMAdapter_TMatrix< complex<r_4> > | 
|---|
|  | 501 | #pragma define_template NOMAdapter_TMatrix< complex<r_8> > | 
|---|
| [2930] | 502 | #pragma define_template NTupInt_TMatrix<uint_2> | 
|---|
|  | 503 | #pragma define_template NTupInt_TMatrix<int_2> | 
|---|
| [585] | 504 | #pragma define_template NTupInt_TMatrix<int_4> | 
|---|
| [2930] | 505 | #pragma define_template NTupInt_TMatrix<int_8> | 
|---|
| [585] | 506 | #pragma define_template NTupInt_TMatrix<r_4> | 
|---|
|  | 507 | #pragma define_template NTupInt_TMatrix<r_8> | 
|---|
| [719] | 508 | #pragma define_template NTupInt_TMatrix< complex<r_4> > | 
|---|
|  | 509 | #pragma define_template NTupInt_TMatrix< complex<r_8> > | 
|---|
| [585] | 510 | #endif | 
|---|
|  | 511 |  | 
|---|
|  | 512 | #if defined(ANSI_TEMPLATES) | 
|---|
| [2930] | 513 | template class NOMAdapter_TMatrix<uint_2>; | 
|---|
|  | 514 | template class NOMAdapter_TMatrix<int_2>; | 
|---|
| [585] | 515 | template class NOMAdapter_TMatrix<int_4>; | 
|---|
| [2930] | 516 | template class NOMAdapter_TMatrix<int_8>; | 
|---|
| [585] | 517 | template class NOMAdapter_TMatrix<r_4>; | 
|---|
|  | 518 | template class NOMAdapter_TMatrix<r_8>; | 
|---|
| [1315] | 519 | template class NOMAdapter_TMatrix< complex<r_4> >; | 
|---|
|  | 520 | template class NOMAdapter_TMatrix< complex<r_8> >; | 
|---|
| [2930] | 521 | template class NTupInt_TMatrix<uint_2>; | 
|---|
|  | 522 | template class NTupInt_TMatrix<int_2>; | 
|---|
| [585] | 523 | template class NTupInt_TMatrix<int_4>; | 
|---|
| [2930] | 524 | template class NTupInt_TMatrix<int_8>; | 
|---|
| [585] | 525 | template class NTupInt_TMatrix<r_4>; | 
|---|
|  | 526 | template class NTupInt_TMatrix<r_8>; | 
|---|
| [719] | 527 | template class NTupInt_TMatrix< complex<r_4> >; | 
|---|
|  | 528 | template class NTupInt_TMatrix< complex<r_8> >; | 
|---|
| [585] | 529 | #endif | 
|---|