Changeset 4065 in Sophya for trunk/SophyaLib/Manual/sophya.tex
- Timestamp:
- Apr 27, 2012, 12:39:18 AM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/SophyaLib/Manual/sophya.tex
r3858 r4065 20 20 \usepackage[ps2pdf,bookmarks,bookmarksnumbered,% 21 21 urlcolor=blue,citecolor=blue,linkcolor=blue,% 22 pagecolor=blue, %hyperindex,%22 pagecolor=blue, % hyperindex, % 23 23 colorlinks=true,hyperfigures=true,hyperindex=true 24 24 ]{hyperref} … … 49 49 \vspace{1cm} 50 50 \begin{center} 51 {\bf \Large SOPHYA Version: 2.2 (V\_Sep2010) }51 {\bf \Large SOPHYA Version: 2.230 (V\_Avr2012) } 52 52 \end{center} 53 53 \titrebp{1} … … 234 234 \item[] {\bf AnaLC} contains program files extracted from the EROS/PEIDA software 235 235 and adapted to be compiled with SOPHYA. It can be used in particular to read and analyse 236 EROS light curve data files (fichiers de suivi). 236 EROS light curve data files (fichiers de suivi). Check the README file in AnaLC directory. 237 237 \item[] {\bf LUC} ( {\bf L}ittle {\bf U}niverse {\bf C}alculator) is a module containing classes to 238 238 perform basic computation related to the universe geometry (FRW metric). … … 295 295 In order to use the shared libraries, the {\bf LD\_LIBRARY\_PATH} variable 296 296 should contain the Sophya shared library path 297 ({\tt \$SOPHYABASE/slb}). 297 ({\tt \$SOPHYABASE/slb}). On Mac OSX, the environment variable {\bf DYLD\_LIBRARY\_PATH} 298 is used instead of LD\_LIBRARY\_PATH. 298 299 On Silicon Graphics machines with IRIX64 operating system, 299 300 the default SOPHYA configuration correspond to the 64 bit architecture. … … 951 952 \end{enumerate} 952 953 954 \subsection{Prime and rational numbers} 955 \index{PrimeNumbers} \index{QNumber} \label{primeqnumb} 956 The library provides basic computation possibilities for prime and rational numbers 957 through the {\bf PrimeNumbers} and {\bf QNumber} classes. Check the header file 958 {\tt pqnumber.h} to see the provided functionalities. 959 The class {\bf PrimeNumbers} can be used to perform basic computation with 960 prime numbers. Integer numbers are represented by machine size long integer (8 bytes). 961 The class is thread safe, whith basic algorithms to find prime numbers or perform 962 decomposition to prime factors. It has been mainly designed to 963 enable computation with rational numbers. 964 \begin{verbatim} 965 // Create a PrimeNumbers object 966 PrimeNumbers primes; 967 // Print the prime numbers from rank 20 to 25 ... 968 cout << " Primes[20...30]: " ; 969 for(size_t k=19; k<30; k++) cout << primes(k) << " "; 970 // Print all prime numbers less than some max values 971 uint_8 p = primes.Next(); uint_8 pmax = 223; 972 cout << endl << " Primes < " << pmax << " : " << endl; 973 while (p<pmax) { 974 cout << p << " "; 975 p = primes.Next(); 976 } 977 cout << endl; 978 // Compute and print prime factor decomposition: 979 uint_8 nombre=247890; 980 vector<uint_8> pfac=primes.PrimeFactors(nombre, true); 981 cout << " PrimeFactors[" << nombre << "]: "; 982 for(size_t i=0; i<pfac.size(); i++) cout << pfac[i] << " "; 983 cout << endl; 984 \end{verbatim} 985 986 The class {\bf QNumber} can be used to represent and perform computation on rational 987 numbers. The four basic arithmetic operations (addition $+$, subtraction $-$, multiplication $\times$ 988 division $/$) are defined, as well as comparison operators ($== , != , < , > , \leq , \geq $). 989 The QNumber class does not inherit from AnyDataObj, but can be serialized to/from PPF streams 990 as a pair of long integers. 991 \begin{verbatim} 992 // Create rational numbers from pairs of integers 993 QNumber q1(3,4), q2(5,6), q3(6,8); 994 // Operations and comparsion 995 QNumber q4 = q1+q2; 996 cout << q1 << " + " << q2 << " = " << q4 << endl; 997 QNumber qa(q1), qb(q2); 998 cout << " Test qa==qb : -> " << qa << " ?== " << qb; 999 if (qa == qb) cout << " -> true " << endl; 1000 else cout << " -> false " << endl; 1001 qb = q3; 1002 cout << " Test qa==qb : -> " << qa << " ?== " << qb; 1003 if (qa == qb) cout << " -> true " << endl; 1004 else cout << " -> false " << endl; 1005 QNumber qq(3*7*17*5,(-5)*7*11*2); 1006 cout << " qq= " << qq << " qq.Simplify() = " << qq.Simplify() << endl; 1007 \end{verbatim} 1008 1009 \subsection{Physical units and constants} 1010 \index{Units} \index{PhysQty} \label{physunits} 1011 \begin{figure}[hbt] 1012 \dclsbb{AnyDataObj}{Units} 1013 \dclsbb{AnyDataObj}{PhysQty} 1014 \end{figure} 1015 The {\bf Units} class is used to represent physical quantities in terms of the SI system base 1016 quantities: length, mass, time, electrical current, thermodynamic temperature, amount of substance 1017 and luminous intensity. Check the BIPM 1018 \href{http://www.bipm.org/fr/si/}{http://www.bipm.org/fr/si/} 1019 or NIST \href{http://physics.nist.gov/cuu/Units/}{http://physics.nist.gov/cuu/Units/} 1020 web sites for detailed information on the SI system and units. Basic usage of this class 1021 consist of calling static methods which return usual units. New units can be constructed using the 1022 product and divide operators (*,/) or the {\tt power} method. The Unit class has a PPF handler and 1023 can be serialized to or from PPF streams. 1024 \begin{verbatim} 1025 Units w=Units::watt(); 1026 cout << " Power unit (watt) : " << w.Name() << " (" << w << ")" << endl; 1027 // define the speed SI unit (m/s) : 1028 Units mos = Units::meter()/Units::second() ; 1029 cout << " SI speed unit : " << mos << " -> "; mos.Print() ; 1030 // mutiple of an existing unit : 1031 Units mw=Units::watt().mega(); 1032 cout << " Megawatt: " << mw.Name() << " (" << mw << ") -> "; mw.Print() ; 1033 \end{verbatim} 1034 1035 This class represents physical quantities and constants, corresponding to a value associated 1036 with a unit. A relative precision and a name are optionally associated with the object. Most 1037 physical constants and usual quantities can be obtained as PhysQty objects through static methods. 1038 The PhysQty class has a PPF handler and can be serialized to or from PPF streams. 1039 \begin{verbatim} 1040 cout << " k_Boltzmann: " << PhysQty::k() << endl; 1041 cout << " m_e: " << PhysQty::electron_mass() << endl; 1042 // Conversion of a quantity to a different unit 1043 PhysQty aj(Units::joule(), 25.); 1044 PhysQty aev=aj.ConvertTo(Units::electronvolt().giga()); 1045 cout << " A : " << aj << " -> " << aev << endl; 1046 \end{verbatim} 1047 1048 953 1049 %%%%%%%%%%%% 954 1050 \newpage … … 3223 3319 csh> tmtdt SWFITS 50000 1 3224 3320 \end{verbatim} 3225 3321 \item {\bf tcmd } tests the command interpreter and expression evaluator classes 3322 (Commander, CExpressionEvaluator, RPNExpressionEvaluator) and the Timer class 3323 \begin{verbatim} 3324 csh> tcmd cexptst 3325 ===> OK if RC=0 3326 csh> tcmd cexptv 3327 ===> OK if RC=0 3328 csh> tcmd cexptvp 3329 ===> OK if RC=0 3330 csh> tcmd rpntst 3331 ===> OK if RC=0 3332 csh> tcmd timer 3333 ===> Check output 3334 csh> tcmd commander 3335 ===> Interactive Commander class test 3336 \end{verbatim} 3337 3226 3338 \end{enumerate} 3227 3339 … … 3232 3344 SOPHYA library defines a set of exceptions which are used 3233 3345 for signalling error conditions. From version V2.2 , all SOPHYA exceptions inherit from 3234 the standard C++ exception class ( {\bf std:: std::exception}). The method {\tt const char* what()} is3346 the standard C++ exception class ( {\bf std::exception}). The method {\tt const char* what()} is 3235 3347 thus implemented and returns the corresponding error message. 3236 3348 The figure below shows a partial class diagram for exception classes in SOPHYA. … … 3262 3374 \addcontentsline{toc}{section}{Index} 3263 3375 \printindex 3376 3264 3377 \end{document} 3265 3378
Note:
See TracChangeset
for help on using the changeset viewer.