Changeset 857 in Sophya for trunk/SophyaProg/Tests


Ignore:
Timestamp:
Apr 10, 2000, 3:04:05 PM (25 years ago)
Author:
ansari
Message:

Adapatation a SphereHEALPix, correction tsttmatrix.cc tsttvector.cc - Reza 10/4/2000

Location:
trunk/SophyaProg/Tests
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/SophyaProg/Tests/arrt.cc

    r820 r857  
    44#include <iostream.h>
    55
    6 #include "nbrandom.h"
    76#include "tarrinit.h"
    87#include "array.h"
    9 // #include "fioarr.h"
    10 // #include "matharr.h"
    118#include "timing.h"
    129
     
    136133
    137134   
    138   for(int i=0; i<n; i++)
    139     for(int j=0; j<n; j++)  a(j,i) = GauRnd(0., 1.);
    140   cout << " ----- Matrix a = \n " << a << endl;
     135  //  for(int i=0; i<n; i++)
     136  //    for(int j=0; j<n; j++)  a(j,i) = GauRnd(0., 1.);
     137  a = Sequence(RandomSequence(RandomSequence::Gaussian, 0., 2.5));
     138  cout << " ----- Matrix a=Sequence(RandomSequence(RandomSequence::Gaussian, 0., 2.5)) = \n " << a << endl;
    141139  Vector x(n);
    142140  x = Sequence(1.,3.);
  • trunk/SophyaProg/Tests/lpk.cc

    r812 r857  
    44#include <iostream.h>
    55
    6 #include "nbrandom.h"
     6#include "srandgen.h"
    77#include "tarrinit.h"
    8 #include "tarray.h"
    9 #include "tvector.h"
     8#include "array.h"
    109#include "timing.h"
    1110#include "intflapack.h"
  • trunk/SophyaProg/Tests/sphg0.cc

    r768 r857  
    22#include "sambainit.h"
    33#include "tod.h"
    4 #include "spheregorski.h"
     4#include "spherehealpix.h"
    55
    66
     
    1111
    1212  int  m=32;
    13   SphereGorski<double> sph(m);
     13  SphereHEALPix<double> sph(m);
    1414  for (int j=0;j<sph.NbPixels();j++)
    1515    {
     
    1919  // Projection  dans une image
    2020
    21   cout <<  " ===== Fin de test0 ======== " << endl;
     21  cout <<  " ===== Fin de sphg0 ======== " << endl;
    2222  return 0;
    2323}
  • trunk/SophyaProg/Tests/tspm.cc

    r768 r857  
    11#include <iostream.h>
    22#include "skymapinit.h"
    3 #include "spheregorski.h"
    4 #include "spherethetaphi.h"
     3#include "skymap.h"
    54
    65#include "tod.h"
     
    3029  InitTim();   // Initializing the CPU timer
    3130  if ((narg > 1) && (strcmp(arg[1],"-h") == 0) )  {
    32     cout << " tspm [Gorski_M=32] [M_TetaPhi=64] : Spherical Map Test " << endl;
     31    cout << " tspm [HEALPix_M=32] [M_TetaPhi=64] : Spherical Map Test " << endl;
    3332    exit(0);
    3433    }
     
    3635  int  m=32;
    3736  if (narg >1)  m = atoi(arg[1]);
    38   cout <<  " ===== Gorski Spherical Map Test M= " << m << endl;
     37  cout <<  " ===== HEALPix Spherical Map Test M= " << m << endl;
    3938
    40   SphereGorski<double> sph(m);
     39  SphereHEALPix<double> sph(m);
    4140
    4241  cout << "Filling spherical map NPixels= " << sph.NbPixels() << endl;
     
    5049  // Computing mean and sigma on the sphere
    5150  MeanSig(sph, gmoy, gsig);
    52   cout << "SphereGorski<double> Mean= " << gmoy << "  Sigma = " << gsig << endl;
     51  cout << "SphereHEALPix<double> Mean= " << gmoy << "  Sigma = " << gsig << endl;
    5352  PrtTim("End of Mean-Sig ");
    5453
     
    5655  {
    5756  POutPersist s("sphg.ppf");
    58   FIO_SphereGorski<double> fiog(&sph) ;
     57  FIO_SphereHEALPix<double> fiog(&sph) ;
    5958  fiog.Write(s);
    60   cout << "SphereGorski<double>  written to sphg.ppf "  << endl;
     59  cout << "SphereHEALPix<double>  written to sphg.ppf "  << endl;
    6160  }
    6261
    6362  // Reading from the file
    6463  {
    65   FIO_SphereGorski<double> fiog("sphg.ppf");
    66   SphereGorski<double>  sph2 = fiog;
     64  FIO_SphereHEALPix<double> fiog("sphg.ppf");
     65  SphereHEALPix<double>  sph2 = fiog;
    6766  PrtTim("End of Write/Read ");
    6867
  • trunk/SophyaProg/Tests/tspm2.cc

    r819 r857  
    11#include <iostream.h>
    22#include <math.h>
    3 #include "skymapinit.h"
    4 #include "spheregorski.h"
    5 #include "spherethetaphi.h"
     3#include "sambainit.h"
     4#include "skymap.h"
    65
    76#include "tod.h"
     
    8786  InitTim();   // Initializing the CPU timer
    8887  if ((narg > 1) && (strcmp(arg[1],"-h") == 0) )  {
    89     cout << " tspm [Gorski_M=32] : Gorski Spherical Map Test " << endl;
     88    cout << " tspm [HEALPix_M=32] : HEALPix Spherical Map Test " << endl;
    9089    exit(0);
    9190    }
     
    9392  int  m=32;
    9493  if (narg >1)  m = atoi(arg[1]);
    95   cout <<  " ===== Gorski Spherical Map Test M= " << m << endl;
     94  cout <<  " ===== HEALPix Spherical Map Test M= " << m << endl;
    9695
    9796  POutPersist s("spheres.ppf");
     
    9998
    10099  {
    101   SphereGorski<double> sph(m);
     100  SphereHEALPix<double> sph(m);
    102101
    103102  cout << "Filling spherical map NPixels= " << sph.NbPixels() << endl;
     
    110109
    111110   {
    112    FIO_SphereGorski<double> fiog(&sph) ;
     111   FIO_SphereHEALPix<double> fiog(&sph) ;
    113112   nomobj = "sphg1";
    114113   fiog.Write(s, nomobj);
    115    cout << "SphMap SphereGorski<double> written to POutPersist with name "  << nomobj << endl;
     114   cout << "SphMap SphereHEALPix<double> written to POutPersist with name "  << nomobj << endl;
    116115   }
    117116
     
    149148
    150149  {
    151   SphereGorski<float> sph(m);
     150  SphereHEALPix<float> sph(m);
    152151
    153152  cout << "Filling spherical map2 NPixels= " << sph.NbPixels() << endl;
     
    166165
    167166   {
    168    FIO_SphereGorski<float> fiog(&sph) ;
     167   FIO_SphereHEALPix<float> fiog(&sph) ;
    169168   nomobj = "sphg2";
    170169   fiog.Write(s, nomobj);
    171    cout << "SphMap SphereGorski<float> written to POutPersist with name "  << nomobj << endl;
     170   cout << "SphMap SphereHEALPix<float> written to POutPersist with name "  << nomobj << endl;
    172171   }
    173172
     
    176175  FitsIoServer fios;
    177176   {
    178    cout << "Test of Write/Read SphereGorski<float> to FITS (sphg_r4.fits) " << endl;
     177   cout << "Test of Write/Read SphereHEALPix<float> to FITS (sphg_r4.fits) " << endl;
    179178   fios.save(sph, "sphg_r4.fits");
    180179 
    181    SphereGorski<float> sphr(4);
     180   SphereHEALPix<float> sphr(4);
    182181   fios.load(sphr, "sphg_r4.fits", 2);
    183    cout << " Read from file - SphereGorski<float> NPixels= " << sphr.NbPixels() << endl;
     182   cout << " Read from file - SphereHEALPix<float> NPixels= " << sphr.NbPixels() << endl;
    184183   int ndiff = 0;
    185184   for(int k=0; k<sphr.NbPixels(); k++) {
  • trunk/SophyaProg/Tests/tsttmat.cc

    r768 r857  
    77#include "ntoolsinit.h"
    88#include "pexceptions.h"
    9 #include "tmatrix.h"
    10 #include "nbrandom.h"
     9#include "array.h"
     10#include "srandgen.h"
    1111
    1212////////////////////////////////////////////////////////////////////////////////////////
     
    2424{
    2525cout << " Test ecriture PPersist TMatrix " << endl;
    26 FIO_TMatrix<r_8> ftm(A);
     26FIO_TArray<r_8> ftm(A);
    2727ftm.Write("tmtx.ppf");
    2828}
    2929{
    3030cout << " Test lecture PPersist TMatrix " << endl;
    31 FIO_TMatrix<r_8> ftm("tmtx.ppf");
     31FIO_TArray<r_8> ftm("tmtx.ppf");
    3232cout<<"Alue:"<<(TMatrix<r_8>)ftm<<endl;
    3333}
     
    182182{
    183183Matrix M(X); cout<<"Matrix M"<<endl<<M<<endl;
    184 Matrix MI = M.Inverse(); cout<<"MI"<<endl<<MI;
     184Matrix MI = Inverse(M); cout<<"MI"<<endl<<MI;
    185185MI *= M; cout<<"MI*M"<<endl<<MI;
    186186r_8 xmin=-1.;
     
    196196cout<<"TMatrix X"<<endl<<X;
    197197TMatrix<r_8> Xinv;
    198 Xinv = X.Inverse();
     198Xinv = Inverse(X);
    199199cout<<"TMatrix Xinv"<<endl<<Xinv;
    200200Xinv *= X;
     
    213213cout<<"MI"<<endl<<MI;
    214214{
    215 TMatrix<r_8> L(MI.NRows(),MI.NCol(),MI.Data(),new Bridge);
    216 cout<<"L"<<endl<<L;
    217 L *= 100.; cout<<"L*=100."<<endl<<L;
     215  uint_4 siz[5];
     216  siz[0] = MI.NCols();
     217  siz[1] = MI.NRows();
     218  TArray<r_8> A(2, siz, MI.Data(), 1, 0, new Bridge);
     219  TMatrix<r_8> L(A);
     220  cout<<"L"<<endl<<L;
     221  L *= 100.; cout<<"L*=100."<<endl<<L;
    218222} // destruction de L
    219223cout<<"MI(4,4)="<<MI(4,4)<<endl;
  • trunk/SophyaProg/Tests/tsttvec.cc

    r768 r857  
    88#include "pexceptions.h"
    99
    10 #include "tvector.h"
    11 #include "nbrandom.h"
     10#include "array.h"
     11#include "srandgen.h"
    1212
    1313////////////////////////////////////////////////////////////////////////////////////////
     
    2424{
    2525cout << " Test ecriture PPersist TVector " << endl;
    26 FIO_TVector<r_8> ftv(v1);
     26FIO_TArray<r_8> ftv(v1);
    2727ftv.Write("tvec.ppf");
    2828}
    2929{
    3030cout << " Test lecture PPersist TVector " << endl;
    31 FIO_TVector<r_8> ftv("tvec.ppf");
     31FIO_TArray<r_8> ftv("tvec.ppf");
    3232cout<<"Vlue:"<<(TVector<r_8>)ftv<<endl;
    3333}
    3434
    3535
    36 cout<<"TVector(10,v,br)"<<endl;
    37 TVector<r_8> v2(10,v,new Bridge); cout<<v2;
     36cout<<"TVector(10,v,br) (v2)"<<endl;
     37uint_4 siz[5];
     38siz[1] = 10;
     39siz[0] = 1;
     40TVector<r_8> v2(TArray<r_8>(2,siz,v,1,0,new Bridge)); cout<<v2;
    3841
    3942cout<<"TVector()"<<endl;
     
    4649v3 = 123456.; cout<<v3;
    4750
    48 cout<<"ps = v1 * v2"<<endl;
    49 r_8 ps = v1 * v2; cout<<"ps="<<ps<<endl;
     51cout<<"ps =  v2.Transpose() * v1"<<endl;
     52r_8 ps = (v2.Transpose()*v1).toScalar(); cout<<"ps="<<ps<<endl;
    5053
    5154cout<<"v2 = 10.*v1"<<endl;
Note: See TracChangeset for help on using the changeset viewer.