| [2615] | 1 | #include "sopnamsp.h"
 | 
|---|
| [786] | 2 | #include "machdefs.h"
 | 
|---|
 | 3 | 
 | 
|---|
 | 4 | #include <math.h>
 | 
|---|
| [2322] | 5 | #include <iostream>
 | 
|---|
 | 6 | #include <fstream>
 | 
|---|
| [786] | 7 | 
 | 
|---|
 | 8 | #include "tarrinit.h"
 | 
|---|
| [812] | 9 | #include "array.h"
 | 
|---|
| [786] | 10 | #include "timing.h"
 | 
|---|
 | 11 | 
 | 
|---|
| [2918] | 12 | /*  --------------------------------------------------------- */
 | 
|---|
 | 13 | /*  ------- Programme de test des fonctions de base  -------  */
 | 
|---|
 | 14 | /*  ----    sur les TArray/TMatrix de SOPHYA    ----          */
 | 
|---|
 | 15 | /*  2000-2006      -   C. Magneville,  R. Ansari              */
 | 
|---|
 | 16 | /*  arrt -> Help/Usage                                        */
 | 
|---|
 | 17 | /*  Pour effectuer les tests avec RC                          */
 | 
|---|
 | 18 | /*  arrt  check       -> Rc=0 OK                              */
 | 
|---|
 | 19 | /*  Pour verification avec les impressions                    */
 | 
|---|
 | 20 | /*  arrt a / w / m / ascio                                    */
 | 
|---|
 | 21 | /*  --------------------------------------------------------- */
 | 
|---|
 | 22 | 
 | 
|---|
| [812] | 23 | static void tstarr(bool tio);
 | 
|---|
| [1561] | 24 | static void tstasciiio();
 | 
|---|
| [812] | 25 | static void tstioarr(TArray<int_4> & ia, TArray<int_4> & ib, TArray<int_4> & ic);
 | 
|---|
 | 26 | static void tstmtx(int n);
 | 
|---|
 | 27 | void _ZZ_TestTMatrixRC_YY_(TMatrix<r_8> & m);
 | 
|---|
| [2918] | 28 | // Methode de verification des fonctionalites - Fev 2006 
 | 
|---|
 | 29 | static int checktarr();
 | 
|---|
| [786] | 30 | 
 | 
|---|
| [2578] | 31 | static int prtlev = 1;
 | 
|---|
 | 32 | 
 | 
|---|
| [786] | 33 | int main(int narg, char* arg[])
 | 
|---|
 | 34 | {
 | 
|---|
 | 35 | 
 | 
|---|
 | 36 |   SophyaInit();
 | 
|---|
 | 37 |   InitTim();   // Initializing the CPU timer
 | 
|---|
 | 38 | 
 | 
|---|
 | 39 | 
 | 
|---|
| [812] | 40 |   if (narg < 2) {
 | 
|---|
| [1100] | 41 |     cout << " arrt - TArray<T> Test - Usage arrt a/w/m/z [size=5] [prtlev=1] [nprt=50]\n" 
 | 
|---|
| [812] | 42 |          << " a: Simple Array Test  w: a+ PPersist Test (FIO_TArray<T>) \n" 
 | 
|---|
 | 43 |          << " m: Matrix and Vector Test \n" 
 | 
|---|
| [2918] | 44 |          << " check: TArray Test/Check with Rc  \n" 
 | 
|---|
| [1561] | 45 |          << " ascio: Test of ascii I/O \n" 
 | 
|---|
| [812] | 46 |          << " z: Appel_ZZ_TestTMatrixRC_YY_ " << endl;
 | 
|---|
 | 47 |     exit(0);
 | 
|---|
 | 48 |   }
 | 
|---|
 | 49 | 
 | 
|---|
| [1561] | 50 |   string opt = arg[1];
 | 
|---|
| [786] | 51 |   int n = 5;
 | 
|---|
| [812] | 52 |   if (narg > 2) n = atoi(arg[2]);
 | 
|---|
 | 53 |   uint_4 nprt = 50;
 | 
|---|
 | 54 |   if (narg > 3) prtlev = atoi(arg[3]);
 | 
|---|
 | 55 |   if (narg > 4) nprt = atoi(arg[4]);
 | 
|---|
| [786] | 56 | 
 | 
|---|
| [812] | 57 |   BaseArray::SetMaxPrint(nprt, prtlev);
 | 
|---|
| [786] | 58 | 
 | 
|---|
| [2918] | 59 |   int rc = 0;
 | 
|---|
| [786] | 60 |   try {
 | 
|---|
| [1561] | 61 |     if (opt == "w")  tstarr(true);
 | 
|---|
 | 62 |     else if (opt == "a") tstarr(false);
 | 
|---|
 | 63 |     else if (opt == "z") {
 | 
|---|
| [812] | 64 |       if (n<5) n = 5;
 | 
|---|
 | 65 |       TMatrix<r_8> tza(n,n+3);
 | 
|---|
| [1102] | 66 |       tza = RegularSequence(2.,1.5);
 | 
|---|
| [812] | 67 |       _ZZ_TestTMatrixRC_YY_(tza);
 | 
|---|
 | 68 |       TMatrix<r_8> tza2 = tza(Range(1,3), Range(2,5));
 | 
|---|
 | 69 |       _ZZ_TestTMatrixRC_YY_(tza2);
 | 
|---|
 | 70 |     }
 | 
|---|
| [1561] | 71 |     else if (opt == "m") tstmtx(n);
 | 
|---|
 | 72 |     else if (opt == "ascio") tstasciiio();
 | 
|---|
| [2918] | 73 |     else if (opt == "check") rc = checktarr();
 | 
|---|
| [1561] | 74 |     else {
 | 
|---|
 | 75 |       cout << " arrt/Error : unknown option ! " << endl;
 | 
|---|
 | 76 |     }
 | 
|---|
| [812] | 77 |   }
 | 
|---|
 | 78 |   catch (PThrowable exc) {
 | 
|---|
 | 79 |     cerr << " catched Exception " << exc.Msg() << endl;
 | 
|---|
| [2918] | 80 |     rc = 97;
 | 
|---|
| [812] | 81 |   }  
 | 
|---|
 | 82 |   catch (...) {
 | 
|---|
 | 83 |     cerr << " catched unknown (...) exception " << endl; 
 | 
|---|
| [2918] | 84 |     rc  = 99;
 | 
|---|
| [812] | 85 |   }  
 | 
|---|
 | 86 |   PrtTim("--- End of arrt ---");
 | 
|---|
| [2918] | 87 |   cout << " -----------  END of ArrayTest (Rc= " << rc << ") --------- " << endl;
 | 
|---|
 | 88 |   return 0;
 | 
|---|
| [812] | 89 | }
 | 
|---|
 | 90 | 
 | 
|---|
 | 91 | 
 | 
|---|
 | 92 | void tstmtx(int n)
 | 
|---|
 | 93 | {
 | 
|---|
 | 94 |   TMatrix<r_4> ma(4,7);
 | 
|---|
| [1102] | 95 |   ma = RegularSequence(10., 2.);
 | 
|---|
| [812] | 96 |   cout << "\n ::::::  Testing TMatrix - TVector ::::::  " << endl;  
 | 
|---|
 | 97 |   TMatrix<r_4> sma1 = ma(Range(1,2), Range(2,4));
 | 
|---|
| [2578] | 98 |   if (prtlev > 0) 
 | 
|---|
 | 99 |     cout << " ----- Matrix ma = \n " << ma << endl;
 | 
|---|
| [812] | 100 |   sma1 = 3.14;
 | 
|---|
| [2578] | 101 |   if (prtlev > 0) 
 | 
|---|
 | 102 |     cout << " ----- Matrix ma (Avec sma1=ma(Range(1,2), Range(2,3))=3.14) = \n " << ma << endl;
 | 
|---|
| [812] | 103 |   TMatrix<r_4> mb(2,3);
 | 
|---|
 | 104 |   mb = 50.;
 | 
|---|
 | 105 |   TMatrix<r_4> mc = mb+sma1;
 | 
|---|
| [2578] | 106 |   if (prtlev > 0) 
 | 
|---|
 | 107 |     cout << " ----- Matrix mc = mb(=50.)+sma1(=3.14) = " << mc << endl;
 | 
|---|
| [812] | 108 |   TMatrix<r_4> md = (float)100+mc;
 | 
|---|
| [2578] | 109 |   if (prtlev > 0) {
 | 
|---|
 | 110 |     cout << " ----- Matrix md=100.+mc = " << md << endl;
 | 
|---|
 | 111 |     cout << " ----- Matrix md-50 = " << md-(float)50. << endl;
 | 
|---|
 | 112 |   }
 | 
|---|
| [812] | 113 | 
 | 
|---|
 | 114 |   TMatrix<int_4> ima(3,10);
 | 
|---|
| [1102] | 115 |   ima = RegularSequence(0.01,1.);
 | 
|---|
| [2578] | 116 |   if (prtlev > 0) {
 | 
|---|
 | 117 |     cout << " ----- Matrix ima(3,10) = RegularSequence(0.01,1.) = " << ima << endl;
 | 
|---|
 | 118 |     cout << " ----- Matrix  ima.Column(3) = \n" << ima.Column(3) << endl;
 | 
|---|
 | 119 |   }
 | 
|---|
| [812] | 120 |   TVector<int_4> vcol = ima.Column(7);
 | 
|---|
| [2578] | 121 |   if (prtlev > 0) {
 | 
|---|
 | 122 |     cout << " ----- Vector  vcol=ima.Column(7) = \n" << vcol << endl;
 | 
|---|
 | 123 |     cout << " ----- Matrix  ima.Row(0) = \n" << ima.Row(0) << endl;
 | 
|---|
 | 124 |   }
 | 
|---|
| [820] | 125 |   TVector<int_4> vlig;
 | 
|---|
 | 126 |   vlig = ima.Row(1);
 | 
|---|
| [2578] | 127 |   if (prtlev > 0) 
 | 
|---|
 | 128 |     cout << " ----- Vector  vlig=ima.Row(1) = \n" << vlig << endl;
 | 
|---|
| [812] | 129 | 
 | 
|---|
 | 130 |   TMatrix<int_4> imb(3,10);
 | 
|---|
| [1102] | 131 |   imb = RegularSequence(100.01,10.);
 | 
|---|
| [2578] | 132 |   if (prtlev > 0) 
 | 
|---|
 | 133 |     cout << " ----- Matrix imb(3,10) = RegularSequence(100.01,10.) = " << imb << endl;
 | 
|---|
| [812] | 134 |   TMatrix<int_4> imc = ima+imb;
 | 
|---|
| [2578] | 135 |   if (prtlev > 0) 
 | 
|---|
 | 136 |     cout << " ----- Matrix imc=ima+imb = " << imc << endl;
 | 
|---|
| [812] | 137 |   TMatrix<int_4> imd(3,10);
 | 
|---|
 | 138 |   TMatrix<int_4> imd2(3,10);
 | 
|---|
 | 139 |   imd += 25;
 | 
|---|
 | 140 |   imd *= 2;
 | 
|---|
 | 141 |   imd2 = 2;
 | 
|---|
| [2578] | 142 |   imd.MulElt(imd2,imd);
 | 
|---|
 | 143 |   if (prtlev > 0) 
 | 
|---|
 | 144 |     cout << " ----- Matrix imd (? = 100) " << imd << endl;
 | 
|---|
| [812] | 145 |   imb -= imd;
 | 
|---|
 | 146 |   imc -= imd;
 | 
|---|
| [2578] | 147 |   if (prtlev > 0) 
 | 
|---|
 | 148 |     cout << " ----- Matrix ((imc-=imd)-(imb-=imd))-ima (== 0 ?) " 
 | 
|---|
 | 149 |          << (imc-imb)-ima << endl;
 | 
|---|
| [812] | 150 |   TVector<r_4> va(16, BaseArray::RowVector);
 | 
|---|
| [1102] | 151 |   va = RegularSequence(0.,1.);
 | 
|---|
| [2578] | 152 |   if (prtlev > 0) 
 | 
|---|
 | 153 |     cout << " ----- Vector va = RegularSequence(0.,1.) = " << va << endl;
 | 
|---|
| [812] | 154 |   va(Range(2,0,6,2)) *= 10.;
 | 
|---|
| [2578] | 155 |   if (prtlev > 0) 
 | 
|---|
 | 156 |     cout << " ----- Vector va apres va(Range(2,0,6,2)) *= 10. " << va << endl;
 | 
|---|
| [812] | 157 |   va(Range(0,5)) += 100.;
 | 
|---|
| [2578] | 158 |   if (prtlev > 0) 
 | 
|---|
 | 159 |     cout << " ----- Vector va apres va(Range(0,6)) += 100. " << va << endl;
 | 
|---|
| [812] | 160 | 
 | 
|---|
| [1107] | 161 |   TMatrix<r_4> esm(3,5);
 | 
|---|
| [1114] | 162 |   EnumeratedSequence ess;
 | 
|---|
 | 163 |               ess ,
 | 
|---|
| [1107] | 164 |          11 , 12 , 13, 14, 15,  
 | 
|---|
| [1114] | 165 |          21 , 22 , 23, 24, 25,
 | 
|---|
 | 166 |          31 , 32 , 33, 34, 35  ;  
 | 
|---|
 | 167 |   esm = ess;
 | 
|---|
| [2578] | 168 |   if (prtlev > 0) 
 | 
|---|
 | 169 |     cout << "\n TMatrix<r_4> esm(3,5) = EnumeratedSequence(), 11 , 12 , 13, 14, 15 ... " 
 | 
|---|
 | 170 |          << esm << endl;
 | 
|---|
| [1114] | 171 |   r_4 emin,emax,esum,eprod,esumx2;
 | 
|---|
 | 172 |   esm.MinMax(emin, emax);  
 | 
|---|
 | 173 |   esum = esm.Sum();
 | 
|---|
 | 174 |   eprod = esm.Product();
 | 
|---|
| [3334] | 175 |   esumx2 = esm.SumSq();
 | 
|---|
| [1107] | 176 | 
 | 
|---|
| [2578] | 177 |   if (prtlev > 0) 
 | 
|---|
 | 178 |     cout << " Min= " << emin << "  Max= " << emax 
 | 
|---|
| [3334] | 179 |          << " Sum= " << esum << " Prod=" << eprod << " SumSq=" << esumx2 << endl;
 | 
|---|
| [1114] | 180 | 
 | 
|---|
| [812] | 181 |   cout << "\n :::::: Testing Matrix operations :::::: " << endl;
 | 
|---|
 | 182 |   TMatrix<r_4> ra(2,2), ira(2,2);
 | 
|---|
| [1102] | 183 |   /*  ra(0,0) = 2.;   ra(0,1) = 1.;
 | 
|---|
| [812] | 184 |   ra(1,0) = 4.;   ra(1,1) = 3.;
 | 
|---|
| [1102] | 185 |   */
 | 
|---|
| [812] | 186 |   ira(0,0) = 1.5;   ira(0,1) = -0.5;
 | 
|---|
 | 187 |   ira(1,0) = -2.;    ira(1,1) = 1.;
 | 
|---|
| [1102] | 188 |   EnumeratedSequence es;
 | 
|---|
 | 189 |   es, 2 , 1 , 4 , 3 ;
 | 
|---|
 | 190 |   ra = es ;
 | 
|---|
 | 191 |   
 | 
|---|
| [2578] | 192 |   if (prtlev > 0) {
 | 
|---|
 | 193 |     cout << " ----- Matrix ra = \n " << ra << endl; 
 | 
|---|
 | 194 |     cout << " ----- Matrix ira = \n " << ira << endl; 
 | 
|---|
 | 195 |     cout << " ----- Matrix ira*ra = (= Identity ?) " << ira*ra << endl; 
 | 
|---|
 | 196 |   }
 | 
|---|
| [812] | 197 | 
 | 
|---|
 | 198 |   cout << "\n ::::::: Testing Matrix Inversion ::::::: " << endl;
 | 
|---|
 | 199 |   SimpleMatrixOperation<r_4> smr;
 | 
|---|
 | 200 |   TMatrix<r_4> cira = smr.Inverse(ra);
 | 
|---|
| [2578] | 201 |   if (prtlev > 0) {
 | 
|---|
 | 202 |     cout << " ----- Matrix Inverse(ra) =  " << cira << endl;
 | 
|---|
 | 203 |     cout << " ----- ira-Inverse(ra) = " << ira-cira << endl;
 | 
|---|
 | 204 |   }
 | 
|---|
| [812] | 205 |   Matrix a(n,n);
 | 
|---|
 | 206 | 
 | 
|---|
 | 207 |     
 | 
|---|
| [857] | 208 |   //  for(int i=0; i<n; i++)
 | 
|---|
 | 209 |   //    for(int j=0; j<n; j++)  a(j,i) = GauRnd(0., 1.);
 | 
|---|
| [1102] | 210 |   a = RandomSequence(RandomSequence::Gaussian, 0., 2.5);
 | 
|---|
| [2578] | 211 |   if (prtlev > 0) 
 | 
|---|
 | 212 |     cout << " ----- Matrix a=RandomSequence(RandomSequence::Gaussian, 0., 2.5) = \n " << a << endl;
 | 
|---|
| [812] | 213 |   Vector x(n);
 | 
|---|
| [1102] | 214 |   x = RegularSequence(1.,3.);
 | 
|---|
| [812] | 215 |   Vector b = a*x;
 | 
|---|
| [2578] | 216 |   if (prtlev > 0) {
 | 
|---|
 | 217 |     cout << " ----- Vector x = \n " << x << endl;
 | 
|---|
 | 218 |     cout << " ----- Vector b = a*x = \n " << b << endl;
 | 
|---|
 | 219 |   }
 | 
|---|
| [812] | 220 |   SimpleMatrixOperation<r_8> smo;
 | 
|---|
 | 221 |   Matrix inva = smo.Inverse(a);
 | 
|---|
| [2578] | 222 |   if (prtlev > 0) {
 | 
|---|
 | 223 |     cout << " ----- Matrix Inverse(a) = \n " << inva << endl;
 | 
|---|
 | 224 |     cout << " ----- Matrix a*Inverse(a) = \n " << inva*a << endl;
 | 
|---|
 | 225 |     cout << " ----- Matrix Inverse(a)*b (=Inv(a)*a*x) = \n " << inva*b << endl;
 | 
|---|
 | 226 |     cout << " ----- Matrix x-Inverse(a)*b = (=0 ?)\n " << x-inva*b << endl;
 | 
|---|
 | 227 |   }
 | 
|---|
| [812] | 228 | }
 | 
|---|
 | 229 | 
 | 
|---|
 | 230 | void tstarr(bool tio)
 | 
|---|
 | 231 | {
 | 
|---|
| [786] | 232 |   cout << "\n -----> Testing TArray <---- " << endl;  
 | 
|---|
| [789] | 233 |   // We create a integer array SizeX=7, SizeY=5
 | 
|---|
| [786] | 234 |   TArray<int_4> ia(7,5); 
 | 
|---|
| [789] | 235 |   // We fill it with a sequence of numbers starting at 10., with step = 2.
 | 
|---|
| [1102] | 236 |   ia = RegularSequence(10., 2.);
 | 
|---|
| [812] | 237 |   cout << " ----- Array IA = \n " << ia << endl;
 | 
|---|
 | 238 |   // sub array extraction, Range(2,4) : starting position=2 , End=4
 | 
|---|
 | 239 |   TArray<int_4> ic = ia(Range(2,3),Range(1,3),Range(0));
 | 
|---|
| [1100] | 240 |   cout << " ----- Array IC IA(Range(2,3),Range(1,3)) = \n " << ic << endl;
 | 
|---|
| [789] | 241 |   // we set the sub-array to zero, this should reflect in the original array
 | 
|---|
 | 242 |   // sub-arrays share their data with parent array
 | 
|---|
| [786] | 243 |   ic = 0;
 | 
|---|
| [812] | 244 |   cout << " ----- Array IC Apres (=0) = \n " << ic << endl;
 | 
|---|
 | 245 |   cout << " ----- Array IA Apres IC=0 = \n " << ia << endl;
 | 
|---|
| [786] | 246 | 
 | 
|---|
 | 247 |   cout << "  :::: 3 Dim arrays ::::: " << endl;
 | 
|---|
 | 248 |   TArray<int_4>::SetMaxPrint(1000);
 | 
|---|
| [789] | 249 |   // Creating 3-dim array (X=8 x Y=7 x Z=2) , filling it with 5
 | 
|---|
| [786] | 250 |   TArray<int_4> ib(8,7,2);
 | 
|---|
 | 251 |   ib = 5;
 | 
|---|
| [812] | 252 |   cout << " ----- Array IB = \n " << ib << endl;
 | 
|---|
| [789] | 253 |   // Sub array extraction  X from 1 , size 4 - Y from 2 , size 3 , in Z default, from 0, size 1
 | 
|---|
 | 254 |   // we multiply this sub-array elements by 3
 | 
|---|
| [812] | 255 |   ib(Range(1,4),Range(2,4), Range(0)) *= 3;
 | 
|---|
 | 256 |   cout << " -- Array IB , Apres ib(Range(1,4),Range(2,4))*=3 : " << endl;
 | 
|---|
| [786] | 257 |   cout << ib;
 | 
|---|
| [812] | 258 |   cout << " -- Array ib(Range(1,4),Range(2,4)) =  : " 
 | 
|---|
 | 259 |        << ib(Range(1,4),Range(2,4), Range(0)) << endl;
 | 
|---|
| [789] | 260 | 
 | 
|---|
 | 261 |   // Creating a double array X=5 x Y=2
 | 
|---|
 | 262 |   TArray<r_4> fa(5,2);
 | 
|---|
 | 263 |   // fill it up with a sequence of 0. to 1.
 | 
|---|
| [1102] | 264 |   fa = RegularSequence(0.,1./(5*2));
 | 
|---|
| [789] | 265 |   cout << " ------ TArray<r_4> fa(5,2) = \n" << fa << endl;
 | 
|---|
 | 266 |   // Create a new array from the original array , multiplying it by 2*Pi
 | 
|---|
 | 267 |   TArray<r_4> fa2 = fa*(float)(2.*M_PI); 
 | 
|---|
 | 268 |   cout << " ------ TArray<r_4> fa2=fa*2*Pi = \n" << fa2 << endl;
 | 
|---|
 | 269 |   // Compute sin(fa2) cos(fa2)
 | 
|---|
| [1229] | 270 |   cout << " ------ sin(fa2=fa*2*Pi) = \n" << Sin(fa2) << endl;
 | 
|---|
 | 271 |   cout << " ------ cos(fa2=fa*2*Pi) = \n" << Cos(fa2) << endl;
 | 
|---|
| [807] | 272 | 
 | 
|---|
| [1519] | 273 |   //  Test des fonctions sur complexes 
 | 
|---|
 | 274 |   TVector<r_4> p_real(10, BaseArray::RowVector), p_imag(10, BaseArray::RowVector);
 | 
|---|
 | 275 |   p_real = RegularSequence(0., 0.5);
 | 
|---|
 | 276 |   p_imag = RegularSequence(0., 0.25);
 | 
|---|
 | 277 |   TVector< complex<r_4> > zvec = ComplexArray(p_real, p_imag);
 | 
|---|
 | 278 |   cout << " ------ zvec = ComplexArray(p_real, p_imag) -------- "  << endl;
 | 
|---|
 | 279 |   cout << " :: p_real= " << p_real; 
 | 
|---|
 | 280 |   cout << " :: p_imag= " << p_imag;
 | 
|---|
 | 281 |   cout << " :: zvec= " << zvec;
 | 
|---|
 | 282 |   cout << " :: real(zvec) = " << real(zvec) ;
 | 
|---|
 | 283 |   cout << " :::: imag(zvec) = " << imag(zvec) ;
 | 
|---|
 | 284 |   cout << " :::: module2(zvec) = " << module2(zvec) ;
 | 
|---|
 | 285 |   cout << " :::: module(zvec) = " << module(zvec) ;
 | 
|---|
 | 286 |   cout << " :::: phase(zvec) = " << phase(zvec) ;
 | 
|---|
 | 287 |   cout << " ----------------------------------------------------- " << endl;
 | 
|---|
 | 288 | 
 | 
|---|
| [807] | 289 |   if (tio) tstioarr(ia, ib, ic);
 | 
|---|
| [786] | 290 | }
 | 
|---|
| [807] | 291 | 
 | 
|---|
 | 292 | void tstioarr(TArray<int_4> & ia, TArray<int_4> & ib, TArray<int_4> & ic)
 | 
|---|
 | 293 | {
 | 
|---|
 | 294 |   cout << " ------ tstioarr(TArray<int_4> & ia, TArray<int_4> & ib, TArray<int_4> & ic) ---- " << endl;
 | 
|---|
 | 295 |   {
 | 
|---|
 | 296 |   cout << " >>>>>> Writing in  arrt.ppf <<<<<<< " << endl;
 | 
|---|
 | 297 |   POutPersist pos("arrt.ppf");
 | 
|---|
 | 298 |   // We write  the three arrays in the stream 
 | 
|---|
 | 299 |   pos << ia << ib << ic;
 | 
|---|
 | 300 |   cout << " >>>>>> Writing in  arrtn.ppf with names <<<<<<<" << endl;
 | 
|---|
 | 301 |   POutPersist posn("arrtn.ppf");
 | 
|---|
 | 302 |   string tag = "ArrIA";
 | 
|---|
 | 303 |   posn.PutObject(ia, tag);
 | 
|---|
 | 304 |   tag = "ArrIB";
 | 
|---|
 | 305 |   posn.PutObject(ib, tag);
 | 
|---|
 | 306 |   tag = "ArrIC";
 | 
|---|
 | 307 |   posn.PutObject(ic, tag);
 | 
|---|
 | 308 |   }
 | 
|---|
 | 309 | 
 | 
|---|
 | 310 |   {
 | 
|---|
 | 311 |   cout << " >>>>>>> Reading from  arrt.ppf  <<<<< " << endl;
 | 
|---|
 | 312 |   PInPersist pis("arrt.ppf");
 | 
|---|
 | 313 |   TArray<int_4> iaa, ibb, icc; 
 | 
|---|
 | 314 |   // We read the three arrays from the stream 
 | 
|---|
 | 315 |   pis >> iaa >> ibb >> icc;
 | 
|---|
| [812] | 316 |   cout << " ----- Array IAA = \n " << iaa << endl;
 | 
|---|
 | 317 |   cout << " ----- Array IBB = \n " << ibb << endl;
 | 
|---|
 | 318 |   cout << " ----- Array ICC = \n " << icc << endl;
 | 
|---|
| [807] | 319 |   icc = 12;
 | 
|---|
| [812] | 320 |   cout << " ----- Array ICC (=12) = \n " << icc << endl;
 | 
|---|
 | 321 |   cout << " ----- Array IAA (ICC=12) = \n " << iaa << endl;
 | 
|---|
| [807] | 322 |   }
 | 
|---|
 | 323 | 
 | 
|---|
 | 324 |   {
 | 
|---|
 | 325 |   cout << " >>>>>>> Reading from  arrtn.ppf  <<<<< " << endl;
 | 
|---|
 | 326 |   PInPersist pis("arrtn.ppf");
 | 
|---|
 | 327 |   TArray<int_4> iaa, ibb, icc; 
 | 
|---|
 | 328 |   // We read the three arrays from the stream 
 | 
|---|
 | 329 |   string tag = "ArrIC";
 | 
|---|
 | 330 |   pis.GetObject(icc, tag);
 | 
|---|
 | 331 |   tag = "ArrIB";
 | 
|---|
 | 332 |   pis.GetObject(ibb, tag);
 | 
|---|
 | 333 |   tag = "ArrIA";
 | 
|---|
 | 334 |   pis.GetObject(iaa, tag);
 | 
|---|
 | 335 | 
 | 
|---|
| [812] | 336 |   cout << " ----- Array IAAA = \n " << iaa << endl;
 | 
|---|
 | 337 |   cout << " ----- Array IBBB = \n " << ibb << endl;
 | 
|---|
 | 338 |   cout << " ----- Array ICCC = \n " << icc << endl;
 | 
|---|
| [807] | 339 |   icc = 68;
 | 
|---|
| [812] | 340 |   cout << " ----- Array ICCC (=12) = \n " << icc << endl;
 | 
|---|
 | 341 |   cout << " ----- Array IAAA (ICC=12) = \n " << iaa << endl;
 | 
|---|
| [807] | 342 |   }
 | 
|---|
 | 343 | 
 | 
|---|
| [1561] | 344 | }
 | 
|---|
| [807] | 345 | 
 | 
|---|
| [1561] | 346 | 
 | 
|---|
 | 347 | void tstasciiio()
 | 
|---|
 | 348 | {
 | 
|---|
 | 349 | 
 | 
|---|
 | 350 | cout << "\n -----> Testing EnumeratedSequence/TArray ASCII I/O <---- " << endl; 
 | 
|---|
 | 351 | 
 | 
|---|
 | 352 | EnumeratedSequence ess;
 | 
|---|
 | 353 | int nbad;
 | 
|---|
 | 354 | ess.Append("56.5 (1.,-1.) 4 8 16", nbad);
 | 
|---|
 | 355 | cout << " --- ess.Append(\"56.5 (1.,-1.) 4 8 16\", nbad) :  ess=" << endl;
 | 
|---|
 | 356 | cout << ess;
 | 
|---|
 | 357 | 
 | 
|---|
 | 358 | EnumeratedSequence ess2;
 | 
|---|
 | 359 | ess2.Append("56.5 (-3.14, 12) 'Hello' 4. 8.565432 12 32 3.1415e-6", nbad);
 | 
|---|
 | 360 | cout << " --- ess2.Append(...) ess2=" << endl; 
 | 
|---|
 | 361 | cout << ess2;
 | 
|---|
 | 362 | cout << " --- ess2.Append(...) (2) ess2=" << endl; 
 | 
|---|
 | 363 | ess2.Append("(2.7, -8) Bonjour ByeBye 'Comment ca va ?' 64 64.7 128 1.28 25.6e3", 
 | 
|---|
 | 364 |             nbad);
 | 
|---|
 | 365 | cout << ess2;
 | 
|---|
 | 366 | 
 | 
|---|
 | 367 | Matrix A(4,6);
 | 
|---|
 | 368 | A = RegularSequence(0.5, 0.2);
 | 
|---|
 | 369 | cout << " Matrix A(4,6); A=RegularSequence(0.5, 0.2) : " << endl;
 | 
|---|
 | 370 | cout << A ;
 | 
|---|
 | 371 | 
 | 
|---|
| [3569] | 372 | const char * flnm = "arr_ascii.txt";
 | 
|---|
| [1561] | 373 | {
 | 
|---|
 | 374 | cout << " Writing A to file " << flnm << endl;
 | 
|---|
 | 375 | ofstream ofs(flnm);
 | 
|---|
 | 376 | A.WriteASCII(ofs);
 | 
|---|
| [807] | 377 | }
 | 
|---|
| [1561] | 378 | 
 | 
|---|
 | 379 | Matrix B;
 | 
|---|
 | 380 | sa_size_t nr, nc;
 | 
|---|
 | 381 | {
 | 
|---|
 | 382 | ifstream ifs(flnm);
 | 
|---|
 | 383 | B.ReadASCII(ifs,nr,nc);
 | 
|---|
 | 384 | }
 | 
|---|
 | 385 | 
 | 
|---|
 | 386 | cout << " Matrix B; B.ReadASCII() from file " << flnm << endl;
 | 
|---|
 | 387 | cout << B ;
 | 
|---|
 | 388 | 
 | 
|---|
 | 389 | Vector C;
 | 
|---|
 | 390 | {
 | 
|---|
 | 391 | ifstream ifs(flnm);
 | 
|---|
| [1577] | 392 | ifs >> C;
 | 
|---|
| [1561] | 393 | }
 | 
|---|
| [1577] | 394 | cout << " Vector C; ifstream( " << flnm << ") >> C " << endl;
 | 
|---|
| [1561] | 395 | cout << " C.Transpose()= " << C.Transpose() ;
 | 
|---|
 | 396 | 
 | 
|---|
 | 397 | TVector<int_4> IC;
 | 
|---|
 | 398 | {
 | 
|---|
 | 399 | ifstream ifs(flnm);
 | 
|---|
 | 400 | IC.ReadASCII(ifs,nr,nc);
 | 
|---|
 | 401 | }
 | 
|---|
 | 402 | cout << " TVector<int_4> IC; IC.ReadASCII() from file " << flnm << endl;
 | 
|---|
 | 403 | cout << " IC.Transpose()= " << IC.Transpose() ;
 | 
|---|
 | 404 | 
 | 
|---|
 | 405 | TArray<r_4> D(4,6,2);
 | 
|---|
 | 406 | {
 | 
|---|
 | 407 | ifstream ifs(flnm);
 | 
|---|
 | 408 | D.ReadASCII(ifs,nr,nc);
 | 
|---|
 | 409 | }
 | 
|---|
 | 410 | cout << " TArray<r_4> D(4,6,2); D.ReadASCII() from file " << flnm << endl;
 | 
|---|
 | 411 | cout << D ;
 | 
|---|
 | 412 | 
 | 
|---|
 | 413 | }
 | 
|---|
| [2918] | 414 | 
 | 
|---|
 | 415 | // ----- Fonction de verification des fonctions de base de TArray 
 | 
|---|
 | 416 | // Retourne 0 si OK 
 | 
|---|
 | 417 | int checktarr()
 | 
|---|
 | 418 | {
 | 
|---|
 | 419 |   int rc = 0;
 | 
|---|
 | 420 | 
 | 
|---|
 | 421 |   int NX = 17;
 | 
|---|
 | 422 |   int NY = 8;
 | 
|---|
 | 423 |   int NZ = 6;
 | 
|---|
 | 424 |   int NT = 5;
 | 
|---|
 | 425 |   if (prtlev > 0)  
 | 
|---|
 | 426 |     cout << " CheckArry: Starting Test-1 EltAcc/SubArray <int> " << endl;
 | 
|---|
 | 427 |   TArray<int> IA(NX, NY, NZ, NT);
 | 
|---|
 | 428 |   for(int ix=0; ix<NX; ix++)
 | 
|---|
 | 429 |     for(int iy=0; iy<NY; iy++)
 | 
|---|
 | 430 |       for(int iz=0; iz<NZ; iz++)
 | 
|---|
 | 431 |         for(int it=0; it<NT; it++)
 | 
|---|
 | 432 |           IA(ix, iy, iz, it) = it*10000+iz*1000+iy*100+ix;
 | 
|---|
 | 433 | 
 | 
|---|
 | 434 |   TArray<int> IB(NX, NY);
 | 
|---|
 | 435 |   TMatrix<int> IMXB(IB);
 | 
|---|
 | 436 |   for(int ir=0; ir<IMXB.NRows(); ir++) {
 | 
|---|
 | 437 |     IMXB.Row(ir) = RegularSequence(0.1);  
 | 
|---|
 | 438 |     IMXB.Row(ir) += ir*100;
 | 
|---|
 | 439 |   }
 | 
|---|
 | 440 | 
 | 
|---|
 | 441 |   int nerr = 0;
 | 
|---|
 | 442 |   int min=99, max=99;
 | 
|---|
 | 443 |   for(int iz=0; iz<NZ; iz++)
 | 
|---|
 | 444 |     for(int it=0; it<NT; it++)  {
 | 
|---|
 | 445 |       TArray<int> IC = IB+(it*10000+iz*1000);
 | 
|---|
 | 446 |       TArray<int> IAI = IA(Range::all(), Range::all(), Range(iz, iz), Range(it, it));
 | 
|---|
 | 447 |       // Fait par SubArray      IAI.CompactTrailingDim();
 | 
|---|
 | 448 |       if (prtlev > 2) {
 | 
|---|
 | 449 |         cout << " CheckArry/Debug: Test-1 iz=" << iz << " it=" << it << endl;
 | 
|---|
 | 450 |         cout << "IAI= \n " << IAI << " IC= \n " << IC << endl;
 | 
|---|
 | 451 |       }
 | 
|---|
 | 452 |       TArray<int> ID = IAI - IC;
 | 
|---|
 | 453 |       ID.MinMax(min, max);
 | 
|---|
 | 454 |       if ((min!=0) || (max!=0)) nerr++;
 | 
|---|
 | 455 |     }
 | 
|---|
 | 456 |   
 | 
|---|
 | 457 |   if (nerr == 0)
 | 
|---|
 | 458 |     cout << "(1) CheckTArray <int>  EltAcc, SubArray OK " << endl; 
 | 
|---|
 | 459 |   else {
 | 
|---|
 | 460 |     cout << "(1) CheckTArray <int>  EltAcc, SubArray ERROR -> Rc += 1 !!! NErr=" 
 | 
|---|
 | 461 |          << nerr << endl; 
 | 
|---|
 | 462 |     rc += 1;
 | 
|---|
 | 463 |   }
 | 
|---|
 | 464 | 
 | 
|---|
 | 465 |   if (prtlev > 0)  
 | 
|---|
 | 466 |     cout << " CheckArry: Starting Test-2 SubArray/Range <int> " << endl;  nerr = 0;
 | 
|---|
 | 467 |   {
 | 
|---|
 | 468 |   TArray<int> ID, IAI;
 | 
|---|
 | 469 |   IAI = IA(Range::all(), Range::all(), Range::last(), Range::first());
 | 
|---|
 | 470 |   // Fait par SubArray  IAI.CompactTrailingDim();
 | 
|---|
 | 471 |   // cout << "---DBG- IAI= \n " << IAI << " IB= \n " << IB << endl;
 | 
|---|
 | 472 |   ID = IAI - IB;
 | 
|---|
 | 473 |   ID -= ((NZ-1)*1000);
 | 
|---|
 | 474 |   // cout << "---DBG- ID= \n" << ID ;
 | 
|---|
 | 475 |   ID.MinMax(min, max);
 | 
|---|
 | 476 |   if ((min!=0) || (max!=0)) nerr++;
 | 
|---|
 | 477 |   }
 | 
|---|
 | 478 |   {
 | 
|---|
 | 479 |   TArray<int> ID, IAI;
 | 
|---|
 | 480 |   IAI = IA(Range::all(), Range::all(), Range::last(), Range::last());
 | 
|---|
 | 481 |   // Fait par SubArray  IAI.CompactTrailingDim();
 | 
|---|
 | 482 |   //  cout << "---DBG- IAI= \n " << IAI << " IB= \n " << IB << endl;
 | 
|---|
 | 483 |   ID = IAI - IB;
 | 
|---|
 | 484 |   ID -= ((NZ-1)*1000+(NT-1)*10000);
 | 
|---|
 | 485 |   // cout << "---DBG- ID= \n" << ID ;
 | 
|---|
 | 486 |   ID.MinMax(min, max);
 | 
|---|
 | 487 |   if ((min!=0) || (max!=0)) nerr++;
 | 
|---|
 | 488 |   }
 | 
|---|
 | 489 |   if (nerr == 0)
 | 
|---|
 | 490 |     cout << "(2) CheckTArray <int>  SubArray/Range::last() OK " << endl; 
 | 
|---|
 | 491 |   else {
 | 
|---|
 | 492 |     cout << "(2) CheckTArray <int>  SubArray/Range::last() ERROR  Rc += 2 !!! NErr=" 
 | 
|---|
 | 493 |          << nerr << endl; 
 | 
|---|
 | 494 |     rc += 2;
 | 
|---|
 | 495 |   }
 | 
|---|
 | 496 | 
 | 
|---|
 | 497 |   if (prtlev > 0)  
 | 
|---|
 | 498 |     cout << " CheckArry: Starting Test-3 SubArray(SubArray) <int> " << endl;  nerr = 0;
 | 
|---|
 | 499 |   TArray<int> IAE = IA(Range::all(), Range::all(), 
 | 
|---|
 | 500 |                        //                              Range(1, 0, 3, 2), Range::last() );
 | 
|---|
 | 501 |                        Range(Range::lastIndex(), Range::lastIndex(), 3, 2), Range::last() );
 | 
|---|
 | 502 |   // Fait par SubArray  IAE.CompactTrailingDim();
 | 
|---|
 | 503 | 
 | 
|---|
 | 504 |   TArray<int> IBE(NX/3, NY/2);  
 | 
|---|
 | 505 |   for(int ix=0; ix<NX/3; ix++)
 | 
|---|
 | 506 |     for(int iy=0; iy<NY/2; iy++)
 | 
|---|
 | 507 |       IBE(ix, iy, 0) = 3*ix+(2*100*iy);
 | 
|---|
 | 508 | 
 | 
|---|
 | 509 |   nerr = 0;
 | 
|---|
 | 510 |   for(int iz=0; iz<IAE.SizeZ(); iz++) {
 | 
|---|
 | 511 |     TArray<int> IAI = IAE(Range::all(), Range::all(), Range(iz, iz));
 | 
|---|
 | 512 |     // Fait par SubArray  IAI.CompactTrailingDim();
 | 
|---|
 | 513 |     //    cout << "---DBG- iz= " << iz << " IAI= \n " << IAI << " IB= \n " << IB << endl;
 | 
|---|
 | 514 |     TArray<int> ID = IAI-IB;
 | 
|---|
 | 515 |     ID -= ((iz*2+1)*1000+(NT-1)*10000);
 | 
|---|
 | 516 |     ID.MinMax(min, max);
 | 
|---|
 | 517 |     if ((min!=0) || (max!=0)) nerr++;
 | 
|---|
 | 518 |   }
 | 
|---|
 | 519 | 
 | 
|---|
 | 520 |   if (nerr == 0)
 | 
|---|
 | 521 |     cout << "(3) CheckTArray <int>  SubArray(SubArray) OK " << endl; 
 | 
|---|
 | 522 |   else {
 | 
|---|
 | 523 |     cout << "(3) CheckTArray <int>  SubArray(SubArray)  ERROR  Rc += 4 !!! NErr=" 
 | 
|---|
 | 524 |          << nerr << endl; 
 | 
|---|
 | 525 |     rc += 4;
 | 
|---|
 | 526 |   }
 | 
|---|
| [3570] | 527 |   
 | 
|---|
 | 528 |   if (prtlev > 0)  
 | 
|---|
 | 529 |     cout << " CheckArry: Starting Test-4 ArrayOp <float> " << endl;  nerr = 0;
 | 
|---|
 | 530 |   NX = 7;
 | 
|---|
 | 531 |   NY = 5;
 | 
|---|
 | 532 |   NZ = 3;  
 | 
|---|
 | 533 |   TArray<float> FA(NX,NY,NZ), FB, FM1(NX,NY,NZ), FM2(NX,NY,NZ);
 | 
|---|
 | 534 |   for(int iz=0; iz<NZ; iz++)  
 | 
|---|
 | 535 |     FM1(Range::all(), Range::all(), Range(iz, iz)) = M_PI*(iz+0.75);
 | 
|---|
 | 536 |   for(int iy=0; iy<NY; iy++)  
 | 
|---|
 | 537 |     FM2(Range::all(), Range(iy, iy), Range::all()) = (iy+2.22)*78.654;
 | 
|---|
| [2918] | 538 | 
 | 
|---|
| [3570] | 539 |   FA = RandomSequence(RandomSequence::Gaussian, 7., 2.7);
 | 
|---|
 | 540 |   FB = FA;  
 | 
|---|
 | 541 | 
 | 
|---|
 | 542 |   float cst[3] = {6., 4., 8.2};
 | 
|---|
 | 543 | 
 | 
|---|
 | 544 |   for(int ix=0; ix<NX; ix++)
 | 
|---|
 | 545 |     for(int iy=0; iy<NY; iy++) 
 | 
|---|
 | 546 |       for(int iz=0; iz<NZ; iz++)
 | 
|---|
 | 547 |         FB(ix,iy,iz) = FB(ix,iy,iz)*FM1(ix,iy,iz)+cst[0]*FM2(ix,iy,iz);         
 | 
|---|
 | 548 | 
 | 
|---|
 | 549 |   nerr = 0;
 | 
|---|
 | 550 |   TArray<float> FD = ((FA&&FM1) + (cst[0]*FM2))/cst[1];
 | 
|---|
 | 551 |   TArray<float> FE = (FD*cst[1] - FB);
 | 
|---|
 | 552 |   float fmin, fmax;
 | 
|---|
 | 553 |   FE.MinMax(fmin, fmax);
 | 
|---|
 | 554 |   
 | 
|---|
 | 555 | //  cout << FM1 << FM2;
 | 
|---|
 | 556 | //  cout << FB << FD ; 
 | 
|---|
 | 557 | //  cout << " ---- Resultat FE: " << FE;
 | 
|---|
 | 558 |   if ((fabs(fmin)>1.e-5) || (fabs(fmax)>1e-5)) nerr++;
 | 
|---|
 | 559 |   if (nerr == 0)
 | 
|---|
 | 560 |     cout << "(4) CheckTArray <int>  ArrayOp <float> OK " << endl; 
 | 
|---|
 | 561 |   else {
 | 
|---|
 | 562 |     cout << "(4) CheckTArray <int>  ArrayOp <float>  ERROR  Rc += 8 !!! fmin=" 
 | 
|---|
 | 563 |          << fmin << " fmax=" << fmax << endl; 
 | 
|---|
 | 564 |     rc += 8;
 | 
|---|
 | 565 |   }
 | 
|---|
 | 566 | 
 | 
|---|
 | 567 |   if (prtlev > 0)  
 | 
|---|
 | 568 |     cout << " CheckArry: Starting Test-5 PPF_Array IO " << endl;  
 | 
|---|
 | 569 |   nerr = 0;
 | 
|---|
 | 570 |   {
 | 
|---|
 | 571 |     POutPersist po("arrt_ck.ppf");
 | 
|---|
 | 572 |     TArray<float> FAS = FA(Range::all(), Range::all(), Range(0,0));
 | 
|---|
 | 573 |     po << FA << FAS;    
 | 
|---|
 | 574 |   }
 | 
|---|
 | 575 |   {
 | 
|---|
 | 576 |     PInPersist pin("arrt_ck.ppf");
 | 
|---|
 | 577 |     TArray<float> RFA, RFAS;
 | 
|---|
 | 578 |     pin >> RFA >> RFAS;
 | 
|---|
 | 579 |     TArray<float> DA = RFA - FA;
 | 
|---|
 | 580 |     TArray<float> DAS = RFAS - FA(Range::all(), Range::all(), Range(0,0));
 | 
|---|
 | 581 |     DA.MinMax(fmin, fmax);
 | 
|---|
 | 582 |     if ((fabs(fmin)>1.e-8) || (fabs(fmax)>1e-8)) nerr++;
 | 
|---|
 | 583 |     DAS.MinMax(fmin, fmax);
 | 
|---|
 | 584 |     if ((fabs(fmin)>1.e-8) || (fabs(fmax)>1e-8)) nerr++;
 | 
|---|
 | 585 |   }
 | 
|---|
 | 586 |   if (nerr == 0)
 | 
|---|
 | 587 |     cout << "(5) CheckTArray <float>  PPF_Array IO OK " << endl; 
 | 
|---|
 | 588 |   else {
 | 
|---|
 | 589 |     cout << "(5) CheckTArray <float>  PPF_Array IO  ERROR  Rc += 16 !!!  nerr=" 
 | 
|---|
 | 590 |          << nerr << endl; 
 | 
|---|
 | 591 |     rc += 16;
 | 
|---|
 | 592 |   }
 | 
|---|
 | 593 | 
 | 
|---|
 | 594 |   if (prtlev > 0)  
 | 
|---|
 | 595 |     cout << " CheckArry: Starting Test-6 Matrix inverse/multiply " << endl;  
 | 
|---|
 | 596 |   nerr = 0;
 | 
|---|
 | 597 |  
 | 
|---|
 | 598 |   sa_size_t MSZ = 32;
 | 
|---|
 | 599 |   Matrix A(MSZ,MSZ), B(MSZ, MSZ);
 | 
|---|
 | 600 |   A = 0.;
 | 
|---|
 | 601 |   for(sa_size_t cc=0; cc<MSZ; cc+=2) {
 | 
|---|
 | 602 |         sa_size_t ca = cc;
 | 
|---|
 | 603 |         sa_size_t ra = MSZ-ca-2;
 | 
|---|
 | 604 |         A(ra,ca) = 1.;   B(ca, ra) = 0.5;
 | 
|---|
 | 605 |         A(ra+1,ca) = 1.;   B(ca, ra+1) = 0.5;
 | 
|---|
 | 606 |         A(ra,ca+1) = 1.;   B(ca+1, ra) = 0.5;
 | 
|---|
 | 607 |         A(ra+1,ca+1) = -1.;   B(ca+1, ra+1) = -0.5;
 | 
|---|
 | 608 |   }
 | 
|---|
 | 609 | //  cout << A << B;
 | 
|---|
 | 610 |   Matrix C = A*B;
 | 
|---|
 | 611 |   Matrix Identite(MSZ,MSZ);
 | 
|---|
 | 612 |   Identite = IdentityMatrix(1., MSZ);
 | 
|---|
 | 613 |   Matrix D = C-Identite;
 | 
|---|
 | 614 | //  cout << "---- C=A*B=" << C ;
 | 
|---|
 | 615 |   Matrix Ainv = Inverse(A);
 | 
|---|
 | 616 |   Matrix E =B-Ainv;
 | 
|---|
 | 617 |   double dmin, dmax;
 | 
|---|
 | 618 |   D.MinMax(dmin, dmax);
 | 
|---|
 | 619 |   if ((fabs(dmin)>1.e-7) || (fabs(dmax)>1e-7)) nerr++;
 | 
|---|
 | 620 |   E.MinMax(dmin, dmax);
 | 
|---|
 | 621 |   if ((fabs(dmin)>1.e-7) || (fabs(dmax)>1e-7)) nerr++;
 | 
|---|
 | 622 |   if (nerr == 0)
 | 
|---|
 | 623 |     cout << "(6) CheckTArray <double>  Matrix inverse/multiply OK " << endl; 
 | 
|---|
 | 624 |   else {
 | 
|---|
 | 625 |     cout << "(6) CheckTArray <double>  Matrix inverse/multiply  ERROR  Rc += 32 !!!  nerr=" 
 | 
|---|
 | 626 |          << nerr << endl; 
 | 
|---|
 | 627 |     rc += 32;
 | 
|---|
 | 628 |   }
 | 
|---|
 | 629 |  
 | 
|---|
| [2918] | 630 |   return rc;
 | 
|---|
 | 631 | }
 | 
|---|