Changeset 1435 in Sophya
- Timestamp:
- Mar 7, 2001, 5:37:48 PM (25 years ago)
- Location:
- trunk/SophyaLib/Manual
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/SophyaLib/Manual/defsophya.sty
r1434 r1435 75 75 \vfill 76 76 \hfill 77 \framebox[\textwidth]{\hspace{0.5cm} \bf Sophya Note #1 (V1.1)77 \framebox[\textwidth]{\hspace{0.5cm} \bf Sophya Note #1 78 78 \hspace{1cm} \today } \\ 79 79 } -
trunk/SophyaLib/Manual/pmixer.tex
r1361 r1435 758 758 \begin{thebibliography}{99} 759 759 \bibitem{DOX-Sophya} 760 \url{http:// hfi-l2.in2p3.fr/}760 \url{http://www.sophya.org/} 761 761 \end{thebibliography} 762 762 \end{document} -
trunk/SophyaLib/Manual/sophya.tex
r1434 r1435 36 36 \vspace{1cm} 37 37 \begin{center} 38 {\bf \Large Document being updated !} 38 {\bf \Large Sophya Version: 1.1 (V\_Fev2001) \\ 39 Document revision 1.0 } 39 40 \end{center} 40 41 \titrebp{1} … … 57 58 the Planck-HFI data processing software, most of the 58 59 packages presented here have a more general scope than the 59 CMB analysis and Planck mission problem. This documents 60 CMB analysis and Planck mission problem. 61 \par 62 \vspace*{2mm} 63 This documents 60 64 presents only a brief overview of the class library, 61 65 mainly from the user's point of view. A more complete description 62 66 can be found in the reference manual, available from our 63 web site: \\64 {\bf http://www.sophya.org}. 65 67 web site: {\bf http://www.sophya.org}. 68 \par 69 \vspace*{2mm} 66 70 The source directory tree 67 71 \footnote{ CVS: cvsserver.lal.in2p3.fr:/exp/eros/CVSPlanck} … … 166 170 flags and the list of Sophya libraries. It should be included in the 167 171 user's makefile. The default compilation rules assumes that the object (.o) 168 and executable files would be put in the following dire tories: \\172 and executable files would be put in the following directories: \\ 169 173 {\tt \$HOME/`uname`-\$EROSCXX/Objs} \\ 170 174 {\tt \$HOME/`uname`-\$EROSCXX/Exec}. … … 174 178 The GNU make program should be used. 175 179 \par 176 The file {\tt \$DPCBASEREP/Include/makefile\_auto} defines the rules to compile180 The file {\tt Examples/auto\_makefile} defines the rules to compile 177 181 a given source program, and link it against the Sophya libraries to produce 178 182 an executable. The example below shows the steps to compile a program named … … 185 189 This command should compile the {\tt trivial.cc} file, 186 190 and link it against the sophya libraries. 187 The file {\tt \$DPCBASEREP/Include/ex\_makefile} provides another191 The file {\tt Examples/ex\_makefile} provides another 188 192 example makefile. 189 193 … … 196 200 and NTools modules, and the main program with exception handling. 197 201 Other Sophya modules can be included using the {\tt -import} flag. 202 Use of additional include files can be specified using the 203 {\tt -inc} flag. 198 204 \begin{verbatim} 199 205 csh> runcxx -h … … 220 226 \end{verbatim} 221 227 228 \newpage 222 229 223 230 \section{Copy constructor and assignment operator} 224 In C++, objects can be copied by assignment or by initiali zation.225 Copying by initiali zation corresponds to creating an object and226 initiali zing its value through the copy constructor.231 In C++, objects can be copied by assignment or by initialisation. 232 Copying by initialisation corresponds to creating an object and 233 initialising its value through the copy constructor. 227 234 The copy constructor has its first argument as a reference, or 228 235 const reference to the object's class type. It can have … … 271 278 duplicate the data. 272 279 280 \newpage 273 281 \section{Module SysTools} 274 282 … … 277 285 class {\tcls{NDataBlock}} for handling reference counting on numerical 278 286 arrays, as well as classes providing the services for implementing simple 279 seriali zation.287 serialisation. 280 288 \vspace*{5mm} 281 289 … … 294 302 and object hierarchy. \\ 295 303 {\bf PPF} {\bf P}ortable {\bf P}ersistence file {\bf F}ormat. 296 \item[] Handling of read/write for mu tiply referenced objects.304 \item[] Handling of read/write for multiply referenced objects. 297 305 \item[] All write operations are carried using sequential access only. This 298 306 holds also for read operations, unless positional tags are used. … … 300 308 through network links. 301 309 \item[] The serialisation (reading/writing) for objects for a given class 302 is implemented through a delegate object. The delegateclass inherits310 is implemented through a handler object. The handler class inherits 303 311 from {\tt PPersist} class. 312 \item[] A run time registration mechanism is used in conjunction with 313 RTTI (Run Time Type Identification) for identifying handler classes 314 when reading {\bf PInPersist} streams, or for associating handlers 315 with data objects {\bf AnyDataObject} for write operations. 304 316 \end{itemize} 305 317 A complete description of SOPHYA persistence mechanism and guidelines 306 318 for writing delegate classes for handling object persistence is beyond 307 the scope of this document. The example in the next paragraph shows 308 simple use of SOPHYA persistence. 319 the scope of this document. The most useful methods for using Sophya 320 persistence are listed below: 321 \begin{itemize} 322 \item[] {\tt POutPersist::PutObject(AnyDataObj \& o)} \\ 323 Writes the data object {\bf o} to the output stream. 324 \item[] {\tt POutPersist::PutObject(AnyDataObj \& o, string tagname)} \\ 325 Writes the data object {\bf o} to the output stream, associated with an 326 identification tag {\bf tagname}. 327 \item[] {\tt PInPersist::GetObject(AnyDataObj \& o)} \\ 328 Reads the next object in stream into {\bf o}. An exception is 329 generated for incompatible object types. 330 \item[] {\tt PInPersist::GetObject(AnyDataObj \& o, string tagname)} \\ 331 Reads the object associated with the tag {\bf tagname} into {\bf o}. 332 An exception is generated for incompatible object types. 333 \end{itemize} 334 The operators {\tt operator << (POutPersist ...) } and 335 {\tt operator >> (PInPersist ...) } are often overloaded 336 to perform {\tt PutObject()} and {\tt GetObject()} operations, 337 as illustrated in the example below: 338 \begin{verbatim} 339 // Creating and filling a histogram 340 Histo hw(0.,10.,100); 341 ... 342 // Writing histogram to a PPF stream 343 POutPersist os("hw.ppf"); 344 os << hw; 345 // Reading a histogram from a PPF stream 346 PInPersist is("hr.ppf"); 347 is >> hr; 348 \end{verbatim} 349 350 The {\bf scanppf} program can be used to list the content of a PPF file. 351 \index{scanppf} 352 \begin{verbatim} 353 csh> scanppf -h 354 SOPHYA Version 1.1 Revision 0 (V_Fev2001) -- Feb 28 2001 11:19:17 cxx 355 Usage: scanppf filename [s/n/a0/a1/a2/a3] 356 s[=default} : Sequential reading of objects 357 n : Object reading at NameTags 358 a0...a3 : Tag List with PInPersist.AnalyseTags(0...3) 359 \end{verbatim} 360 309 361 310 362 \subsection{\tcls{NDataBlock}} … … 361 413 MuTyV s("hello"); // string type value 362 414 MuTyV x; 363 x = "3.14159626"; // string type value, asciirepresentation for Pi415 x = "3.14159626"; // string type value, ASCII representation for Pi 364 416 double d = x; // x converted to double = 3.141596 365 417 x = 314; // x contains the integer value = 314 … … 384 436 #include "datacards.h" 385 437 // ... 386 // Initiali zing DataCards object dc from file ex.d438 // Initialising DataCards object dc from file ex.d 387 439 DataCards dc( "ex.d" ); 388 440 // Getting the first and second parameters for keyword size … … 433 485 \end{verbatim} 434 486 487 \newpage 435 488 \section{Module TArray} 436 489 \index{\tcls{TArray}} … … 440 493 arrays {\tt (int, float, double, complex, \ldots)}. The include 441 494 file {\tt array.h} declares all the classes and definitions 442 in module TArray. {\bf Array} is a typ def for arrays495 in module TArray. {\bf Array} is a typedef for arrays 443 496 with double precision floating value elements. \\ 444 497 {\tt typedef TArray$<$r\_8$>$ Array ; } … … 453 506 \index{Sequence} \index{RandomSequence} \index{RegularSequence} 454 507 \index{EnumeratedSequence} 455 The example below shows basic usage of arrays, creation, initiali zation508 The example below shows basic usage of arrays, creation, initialisation 456 509 and arithmetic operations. Different kind of {\bf Sequence} objects 457 can be used for initiali zing arrays.510 can be used for initialising arrays. 458 511 459 512 \begin{figure}[hbt] … … 466 519 \index{\tcls{TArray}} 467 520 \begin{verbatim} 468 // Creating and initiali zing a 1-D array of integers521 // Creating and initialising a 1-D array of integers 469 522 TArray<int> ia(5); 470 523 EnumeratedSequence es; … … 573 626 \end{verbatim} 574 627 575 \newpage576 628 \subsection{Memory organisation} 577 629 {\tt \tcls{TArray} } can handle numerical arrays with various memory … … 621 673 cout << "Matrix X_F (FortranMemoryMapping) = " << X_F << endl; 622 674 \end{verbatim} 623 \newpage624 675 This code would produce the following output (X\_F = Transpose(X\_C)) : 625 676 \begin{verbatim} … … 664 715 computing means and sigmas, finding maxima, fitting, rebinning, 665 716 integrating \dots \\ 666 The example below shows creating and filling a one dimension nal histogram667 of 100 bins from $-5.$ to $+5.$ to create a gaussian normal distribution717 The example below shows creating and filling a one dimensional histogram 718 of 100 bins from $-5.$ to $+5.$ to create a Gaussian normal distribution 668 719 with errors~: 669 720 \begin{verbatim} … … 708 759 may be applied onto profile histograms. 709 760 710 \subsection{ NTuples}761 \subsection{Data tables (tuples)} 711 762 \index{NTuple} 712 763 NTuple are memory resident tables of 32 bits floating values (float). … … 767 818 \subsection{Writing, viewing \dots } 768 819 769 All these objects have been design to be written to or read from a persist ant file.820 All these objects have been design to be written to or read from a persistent file. 770 821 The following example shows how to write the previously created objects 771 822 into such a file~: … … 785 836 all these objects. 786 837 787 \subsection{Fourier transform (FFT)}788 \index{FFT} \index{FFTServer}789 790 838 \newpage 791 \section{Module SkyMap}792 \begin{figure}[hbt]793 \dclsbb{AnyDataObj}{PixelMap}794 \dclsccc{PixelMap}{Sphericalmap}{SphereHEALPix}795 \dclsc{SphereThetaPhi}796 \dclsb{LocalMap}797 \caption{partial class diagram for pixelization classes in Sophya}798 \end{figure}799 The {\bf SkyMap} module provides classes for creating, filling, reading pixelized spherical and 2D-maps. The types of values stored in pixels can be int, float, double , complex etc. according to the specialization of the template type.800 \subsection {Spherical maps}801 There are two kinds of spherical maps according pixelization algorithms. SphereHEALPix represents spheres pixelized following the HEALPIix algorithm (E. Yvon, K. Gorski), SphereThetaPhi represents spheres pixelized following an algorithm developed at LAL-ORSAY. The example below shows creating and filling of a SphereHEALPix with nside = 8 (it will be 12*8*8= 768 pixels) :802 \index{\tcls{SphereHEALPix}}803 804 \begin{verbatim}805 #include ``spherehealpix.h''806 // ...807 SphereHEALPix<double> sph(8);808 for (int k=0; k< sph.NbPixels(); k++) sph(k) = (double)(10*k);809 \end{verbatim}810 811 SphereThetaPhi is used in a similar way with an argument representing number of slices in theta (Euler angle) for an hemisphere.812 \index{\tcls{SphereThetaPhi}}813 814 \subsection {Local maps}815 \index{\tcls{LocalMap}}816 A local map is a 2 dimensional array, with i as column index and j as row index. The map is supposed to lie on a plan tangent to the celestial sphere in a point whose coordinates are (x0,y0) on the local map and (theta0, phi0) on the sphere. The range of the map is defined by two values of angles covered respectively by all the pixels in x direction and all the pixels in y direction (SetSize()). Default value of (x0, y0) is middle of the map, center of pixel(nx/2, ny/2).817 818 Internally, a map is first defined within this reference plane and tranported until the point (theta0, phi0) in such a way that both axes are kept parallel to meridian and parallel lines of the sphere. The user can define its own map with axes rotated with respect to reference axes (this rotation is characterized by angle between the local parallel line and the wanted x-axis-- method SetOrigin(...))819 820 The example below shows creating and filling of a LocalMap with 4 columns and 5 rows. The origin is set to default. The map covers a sphere portion defined by two angles of 30. degrees (methods \textit{SetOrigin()} and \textit{SetSize()} must be called in order to completely define the map).821 \begin{verbatim}822 #include "localmap.h"823 //..............824 LocalMap<r_4> locmap(4,5);825 for (int k=0; k<locmap.NbPixels();k++) locmap(k)=10.*k;826 locmap.SetOrigin();827 locmap.SetSize(30.,30.);828 \end{verbatim}829 830 \subsection{Writing, viewing \dots }831 832 All these objects have been design to be written to or read from a persistant file.833 The following example shows how to write the previously created objects834 into such a file~:835 \begin{verbatim}836 //-- Writing837 838 #include "fiospherehealpix.h"839 //................840 841 char *fileout = "myfile.ppf";842 POutPersist outppf(fileout);843 FIO_SphereHEALPix<r_8> outsph(sph);844 outsph.Write(outppf);845 FIO_LocalMap<r_8> outloc(locmap);846 outloc.Write(outppf);847 848 \end{verbatim}849 850 Sophya graphical tools (spiapp) can automatically display and operate851 all these objects.852 853 854 839 \section{Module NTools} 855 840 … … 858 843 859 844 \subsection{Fitting} 860 \index{Fitting} \index{Minimi zation}845 \index{Fitting} \index{Minimisation} 861 846 Fitting is done with two classes {\tt GeneralFit} and {\tt GeneralFitData} 862 847 and is based on the Levenberg-Marquardt method. … … 871 856 and can be easily fitted. \\ 872 857 Here is a very simple example for fitting the previously created NTuple 873 with a gaussian~:858 with a Gaussian~: 874 859 \begin{verbatim} 875 860 #include "fct1dfit.h" … … 896 881 mFit.SetData(&mGData); // connect data to the fitter 897 882 898 // Set and initiali ze the parameters (that's non-linear fitting!)883 // Set and initialise the parameters (that's non-linear fitting!) 899 884 // (num par, name, guess start, step, [limits min and max]) 900 885 mFit.SetParam(0,"high",90.,1..); … … 962 947 Similar operations can be done on polynomials with 2 variables. 963 948 949 \subsection{Integration, Differential equations} 950 \index{Integration} 951 The NTools module provide also simple classes for numerical integration 952 of functions and differential equations. 953 \begin{figure}[hbt] 954 \dclsbb{Integrator}{GLInteg} 955 \dclsb{TrpzInteg} 956 \end{figure} 957 958 \index{GLInteg} \index{TrpzInteg} 959 {\bf GLInteg} implements the integration through Gauss-Legendre method 960 and {\bf TrpzInteg} implements trapeze integration. For {\bf TrpzInteg}, 961 number of steps specify the number of trapeze, and integration step, 962 their width. 963 The sample code below illustrates the use of TrpzInteg class: 964 \begin{verbatim} 965 #include "integ.h" 966 // ...................................................... 967 // Function to be integrated 968 double myf(double x) 969 { 970 // Simple a x + b x^2 (a=2 b=3) 971 return (x*(2.+3.*x)); 972 } 973 // ...................................................... 974 975 // Compute Integral(myf, 2., 5.) between xmin=2., xmax=5. 976 TrpzInteg trpz(myf, 2., 5.); 977 // We specify an integration step 978 trpz.DX(0.01); 979 // The integral can be computed as trpz.Value() 980 double myf_integral = trpz.Value(); 981 // We could have used the cast operator : 982 cout << "Integral[myf, 2., 5.]= " << (double)trpz << endl; 983 // Limits can be specified through ValueBetween() method 984 cout << "Integral[myf, 0., 4.]= " << trpz.ValueBetween(0.,4.) << endl; 985 \end{verbatim} 986 987 \subsection{Fourier transform (FFT)} 988 \index{FFT} \index{FFTPackServer} 989 An abstract interface for performing FFT operations is defined by the 990 {\bf FFTServerInterface} class. The {\bf FFTPackSever} class implements 991 one dimensional FFT, on real and complex data. FFTPackServer uses an 992 adapted and extended version of FFTPack (available from netlib), 993 translated in C, and can operate on single and double precision 994 ({\tt float, double}) data. 995 996 The sample code below illustrates the use of FFTServers: 997 \begin{verbatim} 998 #include "fftpserver.h" 999 // ... 1000 TVector<r_8> in(32); 1001 TVector< complex<r_8> > out; 1002 in = RandomSequence(); 1003 FFTPackServer ffts; 1004 ffts.setNormalize(true); // To have normalized transforms 1005 cout << " FFTServer info string= " << ffts.getInfo() << endl; 1006 cout << "in= " << in << endl; 1007 cout << " Calling ffts.FFTForward(in, out) : " << endl; 1008 ffts.FFTForward(in, out); 1009 cout << "out= " << out << endl; 1010 \end{verbatim} 1011 1012 \newpage 1013 \section{Module SkyMap} 1014 \begin{figure}[hbt] 1015 \dclsbb{AnyDataObj}{PixelMap} 1016 \dclsccc{PixelMap}{Sphericalmap}{SphereHEALPix} 1017 \dclsc{SphereThetaPhi} 1018 \dclsb{LocalMap} 1019 \caption{partial class diagram for pixelization classes in Sophya} 1020 \end{figure} 1021 The {\bf SkyMap} module provides classes for creating, filling, reading pixelized spherical and 2D-maps. The types of values stored in pixels can be int, float, double , complex etc. according to the specialization of the template type. 1022 \subsection {Spherical maps} 1023 There are two kinds of spherical maps according pixelization algorithms. SphereHEALPix represents spheres pixelized following the HEALPIix algorithm (E. Hivon, K. Gorski) 1024 \footnote{see the HEALPix Homepage: http://www.eso.org/kgorski/healpix/ } 1025 , SphereThetaPhi represents spheres pixelized following an algorithm developed at LAL-ORSAY. The example below shows creating and filling of a SphereHEALPix with nside = 8 (it will be 12*8*8= 768 pixels) : 1026 \index{\tcls{SphereHEALPix}} 1027 \index{\tcls{SphereThetaPhi}} 1028 1029 \begin{verbatim} 1030 #include "spherehealpix.h" 1031 // ... 1032 SphereHEALPix<double> sph(8); 1033 for (int k=0; k< sph.NbPixels(); k++) sph(k) = (double)(10*k); 1034 \end{verbatim} 1035 1036 SphereThetaPhi is used in a similar way with an argument representing number of slices in theta (Euler angle) for an hemisphere. 1037 \index{\tcls{SphereThetaPhi}} 1038 1039 \subsection {Local maps} 1040 \index{\tcls{LocalMap}} 1041 A local map is a 2 dimensional array, with i as column index and j as row index. The map is supposed to lie on a plan tangent to the celestial sphere in a point whose coordinates are (x0,y0) on the local map and (theta0, phi0) on the sphere. The range of the map is defined by two values of angles covered respectively by all the pixels in x direction and all the pixels in y direction (SetSize()). Default value of (x0, y0) is middle of the map, center of pixel(nx/2, ny/2). 1042 1043 Internally, a map is first defined within this reference plane and tranported until the point (theta0, phi0) in such a way that both axes are kept parallel to meridian and parallel lines of the sphere. The user can define its own map with axes rotated with respect to reference axes (this rotation is characterized by angle between the local parallel line and the wanted x-axis-- method SetOrigin(...)) 1044 1045 The example below shows creating and filling of a LocalMap with 4 columns and 5 rows. The origin is set to default. The map covers a sphere portion defined by two angles of 30. degrees (methods \textit{SetOrigin()} and \textit{SetSize()} must be called in order to completely define the map). 1046 \begin{verbatim} 1047 #include "localmap.h" 1048 //.............. 1049 LocalMap<r_4> locmap(4,5); 1050 for (int k=0; k<locmap.NbPixels();k++) locmap(k)=10.*k; 1051 locmap.SetOrigin(); 1052 locmap.SetSize(30.,30.); 1053 \end{verbatim} 1054 1055 \subsection{Writing, viewing \dots } 1056 1057 All these objects have been design to be written to or read from a persistant file. 1058 The following example shows how to write the previously created objects 1059 into such a file~: 1060 \begin{verbatim} 1061 //-- Writing 1062 1063 #include "fiospherehealpix.h" 1064 //................ 1065 1066 char *fileout = "myfile.ppf"; 1067 POutPersist outppf(fileout); 1068 FIO_SphereHEALPix<r_8> outsph(sph); 1069 outsph.Write(outppf); 1070 FIO_LocalMap<r_8> outloc(locmap); 1071 outloc.Write(outppf); 1072 // It is also possible to use the << operator 1073 POutPersist os("sph.ppf"); 1074 os << outsph; 1075 os << outloc; 1076 \end{verbatim} 1077 1078 Sophya graphical tools (spiapp) can automatically display and operate 1079 all these objects. 1080 1081 \newpage 964 1082 \section{Module Samba} 965 1083 \index{Spherical Harmonics} 966 1084 \index{SphericalTransformServer} 967 The module provides several classes for spherical harmonic analysis. The main class is \textit{SphericalTranformServer}. It contains methods for analysis and synthesis of spherical maps. The following example fills a vector of Cl's, generate a spherical map from these Cl's. This map is analy zed back to Cl's...1085 The module provides several classes for spherical harmonic analysis. The main class is \textit{SphericalTranformServer}. It contains methods for analysis and synthesis of spherical maps. The following example fills a vector of Cl's, generate a spherical map from these Cl's. This map is analysed back to Cl's... 968 1086 \begin{verbatim} 969 1087 #include "skymap.h" … … 988 1106 \end{verbatim} 989 1107 1108 \newpage 990 1109 \section{Module SkyT} 991 1110 \index{RadSpectra} \index{SpectralResponse} 1111 The SkyT module is composed of two types of classes: 1112 \begin{itemize} 1113 \item{} one which corresponds to an emission spectrum of 1114 radiation, which is called RadSpectra 1115 \item{} one which corresponds to the spectral response 1116 of a given detector (i.e. corresponding to a detector 1117 filter in a given frequency domain), which is called 1118 SpectralResponse. 1119 \end{itemize} 1120 \begin{figure}[hbt] 1121 \dclsbb{RadSpectra}{RadSpectraVec} 1122 \dclsb{BlackBody} 1123 \dclsccc{AnyDataObj}{SpectralResponse}{SpecRespVec} 1124 \dclsc{GaussianFilter} 1125 \caption{partial class for SkyT module} 1126 \end{figure} 1127 1128 \begin{verbatim} 1129 #include "skyt.h" 1130 // .... 1131 // Compute the flux from a blackbody at 2.73 K through a square filter 1132 BlackBody myBB(2.73); 1133 // We define a square filter from 100 - 200 GHz 1134 SquareFilter mySF(100,200); 1135 // Compute the filtered integrated flux : 1136 double flux = myBB.filteredIntegratedFlux(mySF); 1137 \end{verbatim} 1138 1139 A more detailed description of SkyT module can be found in: 1140 {\it The SkyMixer (SkyT and PMixer modules) - Sophya Note No 2. } 1141 available also from Sophya Web site. 1142 1143 \newpage 992 1144 \section{Module FitsIOServer} 993 1145 \begin{figure}[hbt] … … 995 1147 \dclsb{FitsOutFile} 996 1148 \end{figure} 997 \index{FITS} 1149 \index{FITS} \index{FitsInFile} \index{FitsOutFile} 998 1150 This module provides classes for handling file input-output in FITS format using the cfitsio library. It works like the SOPHYA persistence (see Module SysTools), using delegate objects, but its design is simpler. The following example writes a matrix (see module TArray) and a spherical map (see module SkyMap) on a FITS file and reads back from FITS file and creates new objects : 999 1151 \begin{verbatim} … … 1030 1182 \end{verbatim} 1031 1183 1032 1184 The operators {\tt operator << (FitsOutFile ...)} and 1185 {\tt operator >> (FitsInFile ...)} are defined in order 1186 to facilitate the FITS file operations: 1187 \begin{verbatim} 1188 // Writing an array object to a FITS file 1189 #include "fitstarray.h" 1190 FitsOutFile fio("arr.fits"); 1191 Matrix m(20,30); 1192 m = 12345.; 1193 fio << m; 1194 // ..... 1195 // Reading a binary table to a XNTuple 1196 #include "fitsxntuple.h" 1197 XNTuple xn; 1198 FitsInFile fii("table.fits"); 1199 fii >> xn; 1200 \end{verbatim} 1201 1202 1203 \newpage 1204 \section{LinAlg and IFFTW modules} 1205 An interface to use LAPACK library (available from {\tt http://www.netlib.org}) 1206 is implemented by the {\bf LapackServer} class, in module LinAlg. 1207 \index{LapackServer}. 1208 The sample code below shows how to use SVD (Singular Value Decomposition) 1209 through LapackServer: 1210 \begin{verbatim} 1211 #include "intflapack.h" 1212 // ... 1213 // Use FortranMemoryMapping as default 1214 BaseArray::SetDefaultMemoryMapping(BaseArray::FortranMemoryMapping); 1215 // Create an fill the arrays A and its copy AA 1216 int n = 20; 1217 Matrix A(n , n), AA; 1218 A = RandomSequence(RandomSequence::Gaussian, 0., 4.); 1219 AA = A; // AA is a copy of A 1220 // Compute the SVD decomposition 1221 Vector S; // Vector of singular values 1222 Matrix U, VT; 1223 LapackServer<r_8> lpks; 1224 lpks.SVD(AA, S, U, VT); 1225 // We create a diagonal matrix using S 1226 Matrix SM(n, n); 1227 for(int k=0; k<n; k++) SM(k,k) = S(k); 1228 // Check the result : A = U*SM*VT 1229 Matrix diff = U*(SM*VT) - A; 1230 double min, max; 1231 diff.MinMax(min, max); 1232 cout << " Min/Max difference Matrix (?=0) , Min= " << min 1233 << " Max= " << max << endl; 1234 \end{verbatim} 1235 1236 \index{FFTWServer} 1237 The {\bf FFTWServer} class (in module FFTW) implements FFTServerInterface class 1238 methods, for one dimensional and multi-dimensional Fourier 1239 transforms on double precision data using the FFTW package 1240 (available from {\tt http://www.fftw.org}). 1033 1241 1034 1242 \newpage … … 1109 1317 \end{verbatim} 1110 1318 1111 At this step, all libraries s ould have been made. Programs using1319 At this step, all libraries should have been made. Programs using 1112 1320 Sophya libraries can now be built: 1113 1321 \begin{verbatim} … … 1130 1338 makefiles for each module. 1131 1339 \begin{itemize} 1132 \item {\bf Makefile} Top level Makefile for buil iding the libraries.1133 \item {\bf Makefile.h} contains the defin tion of compilation flags for the1340 \item {\bf Makefile} Top level Makefile for building the libraries. 1341 \item {\bf Makefile.h} contains the definition of compilation flags for the 1134 1342 different compilers and systems. This file is used for building the 1135 1343 library and generating {\bf MakefileUser.h} (to be included in makefiles). … … 1162 1370 \index{Exception classes} \index{PThrowable} \index{PError} \index{PException} 1163 1371 SOPHYA library defines a set of exceptions which are used 1164 for signal ing error conditions. The figure below shows a partial1372 for signalling error conditions. The figure below shows a partial 1165 1373 class diagram for exception classes in SOPHYA. 1166 1374 \begin{figure}[hbt]
Note:
See TracChangeset
for help on using the changeset viewer.