Changeset 1435 in Sophya for trunk/SophyaLib/Manual/sophya.tex


Ignore:
Timestamp:
Mar 7, 2001, 5:37:48 PM (25 years ago)
Author:
ansari
Message:

MAJ doc Sophya overview - Preparation pour release - Reza 7/3/2001

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/SophyaLib/Manual/sophya.tex

    r1434 r1435  
    3636\vspace{1cm}
    3737\begin{center}
    38 {\bf \Large Document being updated !}
     38{\bf \Large Sophya Version: 1.1 (V\_Fev2001) \\
     39Document revision 1.0 }
    3940\end{center}
    4041\titrebp{1}
     
    5758the Planck-HFI data processing software, most of the
    5859packages presented here have a more general scope than the
    59 CMB analysis and Planck mission problem. This documents
     60CMB analysis and Planck mission problem.
     61\par
     62\vspace*{2mm}
     63This documents
    6064presents only a brief overview of the class library,
    6165mainly from the user's point of view. A more complete description
    6266can be found in the reference manual, available from our
    63 web site: \\
    64 {\bf http://www.sophya.org}.
    65 
     67web site: {\bf http://www.sophya.org}.
     68\par
     69\vspace*{2mm}
    6670The source directory tree
    6771\footnote{ CVS: cvsserver.lal.in2p3.fr:/exp/eros/CVSPlanck}
     
    166170flags and the list of Sophya libraries. It should be included in the
    167171user's makefile. The default compilation rules assumes that the object (.o)
    168 and executable files would be put in the following diretories: \\
     172and executable files would be put in the following directories: \\
    169173{\tt \$HOME/`uname`-\$EROSCXX/Objs} \\
    170174{\tt \$HOME/`uname`-\$EROSCXX/Exec}.
     
    174178The GNU make program should be used.
    175179\par
    176 The file {\tt \$DPCBASEREP/Include/makefile\_auto} defines the rules to compile
     180The file {\tt Examples/auto\_makefile} defines the rules to compile
    177181a given source program, and link it against the Sophya libraries to produce
    178182an executable. The example below shows the steps to compile a program named
     
    185189This command should compile the {\tt trivial.cc} file,
    186190and link it against the sophya libraries.
    187 The file {\tt \$DPCBASEREP/Include/ex\_makefile} provides another
     191The file {\tt Examples/ex\_makefile} provides another
    188192example makefile.
    189193
     
    196200and NTools modules, and the main program with exception handling.
    197201Other Sophya modules can be included using the {\tt -import} flag.
     202Use of additional include files can be specified using the
     203{\tt -inc} flag.
    198204\begin{verbatim}
    199205csh> runcxx -h
     
    220226\end{verbatim}
    221227 
     228\newpage
    222229
    223230\section{Copy constructor and assignment operator}
    224 In C++, objects can be copied by assignment or by initialization.
    225 Copying by initialization corresponds to creating an object and
    226 initializing its value through the copy constructor.
     231In C++, objects can be copied by assignment or by initialisation.
     232Copying by initialisation corresponds to creating an object and
     233initialising its value through the copy constructor.
    227234The copy constructor has its first argument as a reference, or
    228235const reference to the object's class type. It can have 
     
    271278duplicate the data.
    272279
     280\newpage
    273281\section{Module SysTools}
    274282
     
    277285class {\tcls{NDataBlock}} for handling reference counting on numerical
    278286arrays, as well as classes providing the services for implementing simple
    279 serialization.
     287serialisation.
    280288\vspace*{5mm}
    281289
     
    294302and object hierarchy. \\
    295303{\bf PPF} {\bf P}ortable {\bf P}ersistence file {\bf F}ormat.
    296 \item[] Handling of read/write for mutiply referenced objects.
     304\item[] Handling of read/write for multiply referenced objects.
    297305\item[] All write operations are carried using sequential access only. This
    298306holds also for read operations, unless positional tags are used.
     
    300308through network links.
    301309\item[] The serialisation (reading/writing) for objects for a given class
    302 is implemented through a delegate object. The delegate class inherits
     310is implemented through a handler object. The handler class inherits
    303311from {\tt PPersist} class.
     312\item[] A run time registration mechanism is used in conjunction with
     313RTTI (Run Time Type Identification) for identifying handler classes
     314when reading {\bf PInPersist} streams, or for associating handlers
     315with data objects {\bf AnyDataObject} for write operations.
    304316\end{itemize}
    305317A complete description of SOPHYA persistence mechanism and guidelines
    306318for 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.
     319the scope of this document. The most useful methods for using Sophya
     320persistence are listed below:
     321\begin{itemize}
     322\item[] {\tt POutPersist::PutObject(AnyDataObj \& o)} \\
     323Writes the data object {\bf o} to the output stream.
     324\item[] {\tt POutPersist::PutObject(AnyDataObj \& o, string tagname)} \\
     325Writes the data object {\bf o} to the output stream, associated with an
     326identification tag {\bf tagname}.
     327\item[] {\tt PInPersist::GetObject(AnyDataObj \& o)} \\
     328Reads the next object in stream into {\bf o}. An exception is
     329generated for incompatible object types.
     330\item[] {\tt PInPersist::GetObject(AnyDataObj \& o, string  tagname)} \\
     331Reads the object associated with the tag {\bf tagname} into {\bf o}.
     332An exception is generated for incompatible object types.
     333\end{itemize}
     334The operators {\tt operator << (POutPersist ...) } and
     335{\tt operator >> (PInPersist ...) } are often overloaded
     336to perform {\tt PutObject()} and {\tt GetObject()} operations,
     337as illustrated in the example below:
     338\begin{verbatim}
     339// Creating and filling a histogram
     340Histo hw(0.,10.,100);
     341...
     342// Writing histogram to a PPF stream
     343POutPersist os("hw.ppf");
     344os << hw;
     345// Reading a histogram from a PPF stream
     346PInPersist is("hr.ppf");
     347is >> hr;
     348\end{verbatim}
     349
     350The {\bf scanppf} program can be used to list the content of a PPF file.
     351\index{scanppf}
     352\begin{verbatim}
     353csh> scanppf -h
     354SOPHYA 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
    309361
    310362\subsection{\tcls{NDataBlock}}
     
    361413MuTyV s("hello");  // string type value
    362414MuTyV x;
    363 x = "3.14159626";    // string type value, ascii representation for Pi
     415x = "3.14159626";    // string type value, ASCII representation for Pi
    364416double d = x;        // x converted to double = 3.141596
    365417x = 314;             // x contains the integer value = 314
     
    384436#include "datacards.h"
    385437// ...
    386 // Initializing DataCards object dc from file ex.d
     438// Initialising DataCards object dc from file ex.d
    387439DataCards dc( "ex.d" );
    388440// Getting the first and second parameters for keyword size
     
    433485\end{verbatim}
    434486
     487\newpage
    435488\section{Module TArray}
    436489\index{\tcls{TArray}}
     
    440493arrays {\tt (int, float, double, complex, \ldots)}. The include
    441494file {\tt array.h} declares all the classes and definitions
    442 in module TArray. {\bf Array} is a typdef for arrays
     495in module TArray. {\bf Array} is a typedef for arrays
    443496with double precision floating value elements. \\
    444497{\tt typedef TArray$<$r\_8$>$ Array ; }
     
    453506\index{Sequence} \index{RandomSequence} \index{RegularSequence}
    454507\index{EnumeratedSequence}
    455 The example below shows basic usage of arrays, creation, initialization
     508The example below shows basic usage of arrays, creation, initialisation
    456509and arithmetic operations. Different kind of {\bf Sequence} objects
    457 can be used for initializing arrays.
     510can be used for initialising arrays.
    458511
    459512\begin{figure}[hbt]
     
    466519\index{\tcls{TArray}}
    467520\begin{verbatim}
    468 // Creating and initializing a 1-D array of integers
     521// Creating and initialising a 1-D array of integers
    469522TArray<int> ia(5);
    470523EnumeratedSequence es;
     
    573626\end{verbatim}
    574627
    575 \newpage
    576628\subsection{Memory organisation}
    577629{\tt \tcls{TArray} } can handle numerical arrays with various memory
     
    621673cout << "Matrix X_F (FortranMemoryMapping) = " << X_F << endl;
    622674\end{verbatim}
    623 \newpage
    624675This code would produce the following output (X\_F = Transpose(X\_C)) :
    625676\begin{verbatim}
     
    664715computing means and sigmas, finding maxima, fitting, rebinning,
    665716integrating \dots \\
    666 The example below shows creating and filling a one dimensionnal histogram
    667 of 100 bins from $-5.$ to $+5.$ to create a gaussian normal distribution
     717The example below shows creating and filling a one dimensional histogram
     718of 100 bins from $-5.$ to $+5.$ to create a Gaussian normal distribution
    668719with errors~:
    669720\begin{verbatim}
     
    708759may be applied onto profile histograms.
    709760
    710 \subsection{NTuples}
     761\subsection{Data tables (tuples)}
    711762\index{NTuple}
    712763NTuple are memory resident tables of 32 bits floating values (float).
     
    767818\subsection{Writing, viewing \dots }
    768819
    769 All these objects have been design to be written to or read from a persistant file.
     820All these objects have been design to be written to or read from a persistent file.
    770821The following example shows how to write the previously created objects
    771822into such a file~:
     
    785836all these objects.
    786837
    787 \subsection{Fourier transform (FFT)}
    788 \index{FFT} \index{FFTServer}
    789 
    790838\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 objects
    834 into such a file~:
    835 \begin{verbatim}
    836 //-- Writing
    837 
    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 operate
    851 all these objects.
    852 
    853 
    854839\section{Module NTools}
    855840
     
    858843
    859844\subsection{Fitting}
    860 \index{Fitting} \index{Minimization}
     845\index{Fitting} \index{Minimisation}
    861846Fitting is done with two classes {\tt GeneralFit} and {\tt GeneralFitData}
    862847and is based on the Levenberg-Marquardt method.
     
    871856and can be easily fitted. \\
    872857Here is a very simple example for fitting the previously created NTuple
    873 with a gaussian~:
     858with a Gaussian~:
    874859\begin{verbatim}
    875860#include "fct1dfit.h"
     
    896881mFit.SetData(&mGData);        // connect data to the fitter
    897882
    898 // Set and initialize the parameters (that's non-linear fitting!)
     883// Set and initialise the parameters (that's non-linear fitting!)
    899884//           (num par, name, guess start, step, [limits min and max])
    900885mFit.SetParam(0,"high",90.,1..);
     
    962947Similar operations can be done on polynomials with 2 variables.
    963948
     949\subsection{Integration, Differential equations}
     950\index{Integration}
     951The NTools module provide also simple classes for numerical integration
     952of 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
     960and {\bf TrpzInteg} implements trapeze integration. For {\bf TrpzInteg},
     961number of steps specify the number of trapeze, and integration step,
     962their width.
     963The sample code below illustrates the use of TrpzInteg class:
     964\begin{verbatim}
     965#include "integ.h"
     966// ......................................................
     967// Function to be integrated
     968double myf(double x)
     969{
     970// Simple a x + b x^2  (a=2 b=3)
     971return (x*(2.+3.*x));
     972}
     973// ......................................................
     974
     975// Compute Integral(myf, 2., 5.) between xmin=2., xmax=5.
     976TrpzInteg trpz(myf, 2., 5.);
     977// We specify an integration step
     978trpz.DX(0.01);
     979// The integral can be computed as trpz.Value()
     980double myf_integral = trpz.Value();
     981// We could have used the cast operator :
     982cout << "Integral[myf, 2., 5.]= " << (double)trpz << endl;
     983// Limits can be specified through ValueBetween() method
     984cout << "Integral[myf, 0., 4.]= " << trpz.ValueBetween(0.,4.) << endl;
     985\end{verbatim}
     986
     987\subsection{Fourier transform (FFT)}
     988\index{FFT} \index{FFTPackServer}
     989An abstract interface for performing FFT operations is defined by the
     990{\bf FFTServerInterface} class. The {\bf FFTPackSever} class implements
     991one dimensional FFT, on real and complex data. FFTPackServer uses an
     992adapted and extended version of FFTPack (available from netlib),
     993translated in C, and can operate on single and double precision
     994({\tt float, double}) data.
     995
     996The sample code below illustrates the use of FFTServers:
     997\begin{verbatim}
     998#include "fftpserver.h"
     999   // ...
     1000TVector<r_8> in(32);
     1001TVector< complex<r_8> > out;
     1002in = RandomSequence();
     1003FFTPackServer ffts;
     1004ffts.setNormalize(true);  // To have normalized transforms
     1005cout << " FFTServer info string= " << ffts.getInfo() << endl;
     1006cout << "in= " << in << endl;
     1007cout << " Calling ffts.FFTForward(in, out) : " << endl;
     1008ffts.FFTForward(in, out);
     1009cout << "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}
     1021The {\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}
     1023There 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// ...
     1032SphereHEALPix<double> sph(8);
     1033for (int k=0; k< sph.NbPixels(); k++) sph(k) = (double)(10*k);
     1034\end{verbatim}
     1035
     1036SphereThetaPhi 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}}
     1041A 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
     1043Internally, 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
     1045The 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
     1057All these objects have been design to be written to or read from a persistant file.
     1058The following example shows how to write the previously created objects
     1059into such a file~:
     1060\begin{verbatim}
     1061//-- Writing
     1062
     1063#include "fiospherehealpix.h"
     1064//................
     1065
     1066char *fileout = "myfile.ppf";
     1067POutPersist outppf(fileout);
     1068FIO_SphereHEALPix<r_8> outsph(sph);
     1069outsph.Write(outppf);
     1070FIO_LocalMap<r_8> outloc(locmap);
     1071outloc.Write(outppf);
     1072// It is also possible to use the << operator
     1073POutPersist os("sph.ppf");
     1074os << outsph;
     1075os << outloc;
     1076\end{verbatim}
     1077
     1078Sophya graphical tools (spiapp) can automatically display and operate
     1079all these objects.
     1080
     1081\newpage
    9641082\section{Module Samba}
    9651083\index{Spherical Harmonics}
    9661084\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 analyzed back to Cl's...
     1085The 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...
    9681086\begin{verbatim}
    9691087#include "skymap.h"
     
    9881106\end{verbatim}
    9891107
     1108\newpage
    9901109\section{Module SkyT}
    991 
     1110\index{RadSpectra} \index{SpectralResponse}
     1111The SkyT module is composed of two types of classes:
     1112\begin{itemize}
     1113\item{} one which corresponds to an emission spectrum of
     1114radiation, which is called RadSpectra
     1115\item{} one which corresponds to the spectral response
     1116of a given detector (i.e. corresponding to a detector
     1117filter in a given frequency domain), which is called
     1118SpectralResponse.
     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
     1132BlackBody myBB(2.73);
     1133// We define a square filter from 100 - 200 GHz
     1134SquareFilter mySF(100,200);
     1135// Compute the filtered integrated flux :
     1136double flux = myBB.filteredIntegratedFlux(mySF);
     1137\end{verbatim}
     1138
     1139A more detailed description of SkyT module can be found in:
     1140{\it The SkyMixer (SkyT and PMixer modules) - Sophya Note No 2. }
     1141available also from Sophya Web site.
     1142
     1143\newpage
    9921144\section{Module FitsIOServer}
    9931145\begin{figure}[hbt]
     
    9951147\dclsb{FitsOutFile}
    9961148\end{figure}
    997 \index{FITS}
     1149\index{FITS} \index{FitsInFile} \index{FitsOutFile}
    9981150This 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 :
    9991151\begin{verbatim}
     
    10301182\end{verbatim}
    10311183
    1032 
     1184The operators {\tt operator << (FitsOutFile ...)} and
     1185{\tt operator >> (FitsInFile ...)} are defined in order
     1186to facilitate the FITS file operations:
     1187\begin{verbatim}
     1188// Writing an array object to a FITS file
     1189#include "fitstarray.h"
     1190FitsOutFile fio("arr.fits");
     1191Matrix m(20,30);
     1192m = 12345.;
     1193fio << m;
     1194// .....
     1195// Reading a binary table to a XNTuple
     1196#include "fitsxntuple.h"
     1197XNTuple xn;
     1198FitsInFile fii("table.fits");
     1199fii >> xn;
     1200\end{verbatim}
     1201
     1202
     1203\newpage
     1204\section{LinAlg and IFFTW modules}
     1205An interface to use LAPACK library (available from {\tt http://www.netlib.org})
     1206is implemented by the {\bf LapackServer} class, in module LinAlg.
     1207\index{LapackServer}.
     1208The sample code below shows how to use SVD (Singular Value Decomposition)
     1209through LapackServer:
     1210\begin{verbatim}
     1211#include "intflapack.h"
     1212// ...
     1213// Use FortranMemoryMapping as default
     1214BaseArray::SetDefaultMemoryMapping(BaseArray::FortranMemoryMapping);
     1215// Create an fill the arrays A and its copy AA
     1216int n = 20;
     1217Matrix A(n , n), AA;
     1218A = RandomSequence(RandomSequence::Gaussian, 0., 4.); 
     1219AA = A;  // AA is a copy of A
     1220// Compute the SVD decomposition
     1221Vector S;  // Vector of singular values
     1222Matrix U, VT;
     1223LapackServer<r_8> lpks;
     1224lpks.SVD(AA, S, U, VT);
     1225// We create a diagonal matrix using S
     1226Matrix SM(n, n);
     1227for(int k=0; k<n; k++) SM(k,k) = S(k);
     1228// Check the result : A = U*SM*VT
     1229Matrix diff = U*(SM*VT) - A;
     1230double min, max;
     1231diff.MinMax(min, max);
     1232cout << " Min/Max difference Matrix (?=0) , Min= " << min
     1233     << " Max= " << max << endl;
     1234\end{verbatim}
     1235
     1236\index{FFTWServer}
     1237The {\bf FFTWServer} class (in module FFTW) implements FFTServerInterface class
     1238methods, for one dimensional and multi-dimensional Fourier
     1239transforms on double precision data using the FFTW package
     1240(available from {\tt http://www.fftw.org}).
    10331241
    10341242\newpage
     
    11091317\end{verbatim}
    11101318
    1111 At this step, all libraries sould have been made. Programs using
     1319At this step, all libraries should have been made. Programs using
    11121320Sophya libraries can now be built:
    11131321\begin{verbatim}
     
    11301338makefiles for each module.
    11311339\begin{itemize}
    1132 \item {\bf Makefile} Top level Makefile for builiding the libraries.
    1133 \item {\bf Makefile.h} contains the defintion of compilation flags for the
     1340\item {\bf Makefile} Top level Makefile for building the libraries.
     1341\item {\bf Makefile.h} contains the definition of compilation flags for the
    11341342different compilers and systems. This file is used for building the
    11351343library and generating {\bf MakefileUser.h} (to be included in makefiles).
     
    11621370\index{Exception classes} \index{PThrowable} \index{PError} \index{PException}
    11631371SOPHYA library defines a set of exceptions which are used
    1164 for signaling error conditions. The figure below shows a partial
     1372for signalling error conditions. The figure below shows a partial
    11651373class diagram for exception classes in SOPHYA.
    11661374\begin{figure}[hbt]
Note: See TracChangeset for help on using the changeset viewer.