Commit 2919a9e2dae4c0b916072c9e7f155e93b02fa905

Authored by daniau
1 parent 410c0dfaf8

git-svn-id: https://lxsd.femto-st.fr/svn/fvn@45 b657c933-2333-4658-acf2-d3c7c2708721

Showing 15 changed files with 1377 additions and 1290 deletions Side-by-side Diff

No preview for this file type
... ... @@ -29,7 +29,7 @@
29 29  
30 30 \section{Whatis fvn,license}
31 31 \subsection{Whatis fvn}
32   -fvn is a Fortran95 mathematical library/module. It provides various usefull subroutine covering linear algebra, numerical integration, least square polynomial, spline interpolation, zero finding, special functions etc.
  32 +fvn is a Fortran95 mathematical library with several modules. It provides various usefull subroutine covering linear algebra, numerical integration, least square polynomial, spline interpolation, zero finding, special functions etc.
33 33  
34 34 Most of the work for linear algebra is done by interfacing Lapack \url{http://www.netlib.org/lapack} which means that Lapack and Blas \url{http://www.netlib.org/blas} must be available on your system for linking fvn. If you use an AMD microprocessor, the good idea is to use ACML ( AMD Core Math Library \url{http://developer.amd.com/acml.jsp} which contains an optimized Blas/Lapack.
35 35  
36 36  
... ... @@ -87,10 +87,14 @@
87 87  
88 88 For each routine, there is a generic interface (simply remove \verb'_*' in the name), so using the specific routine is not mandatory.
89 89  
  90 +
  91 +There's a general module called ``\verb'fvn''' that include all fvn submodules. So whatever part of the library is used in the program a ``\verb'use fvn''' will be sufficient instead of specifying the specific module.
  92 +
90 93 \section{Linear algebra}
91 94 The linear algebra routines of fvn are an interface to lapack, which make it easier to use.
92 95 \subsection{Matrix inversion}
93 96 \begin{verbatim}
  97 +Module : use fvn_linear
94 98 call fvn_matinv(d,a,inva,status)
95 99 \end{verbatim}
96 100 \begin{itemize}
... ... @@ -103,7 +107,7 @@
103 107 \subsubsection*{Example}
104 108 \begin{verbatim}
105 109 program inv
106   - use fvn
  110 + use fvn_linear
107 111 implicit none
108 112  
109 113 real(8),dimension(3,3) :: a,inva
... ... @@ -124,6 +128,7 @@
124 128  
125 129 \subsection{Matrix determinants}
126 130 \begin{verbatim}
  131 +Module : use fvn_linear
127 132 det=fvn_det(d,a,status)
128 133 \end{verbatim}
129 134 \begin{itemize}
... ... @@ -135,7 +140,7 @@
135 140 \subsubsection*{Example}
136 141 \begin{verbatim}
137 142 program det
138   - use fvn
  143 + use fvn_linear
139 144 implicit none
140 145  
141 146 real(8),dimension(3,3) :: a
... ... @@ -157,6 +162,7 @@
157 162  
158 163 \subsection{Matrix condition}
159 164 \begin{verbatim}
  165 +Module : use fvn_linear
160 166 call fvn_matcon(d,a,rcond,status)
161 167 \end{verbatim}
162 168 \begin{itemize}
... ... @@ -181,7 +187,7 @@
181 187 \subsubsection*{Example}
182 188 \begin{verbatim}
183 189 program cond
184   - use fvn
  190 + use fvn_linear
185 191 implicit none
186 192  
187 193 real(8),dimension(3,3) :: a
... ... @@ -202,6 +208,7 @@
202 208  
203 209 \subsection{Eigenvalues/Eigenvectors}
204 210 \begin{verbatim}
  211 +Module : use fvn_linear
205 212 call fvn_matev(d,a,evala,eveca,status)
206 213 \end{verbatim}
207 214 \begin{itemize}
208 215  
... ... @@ -212,10 +219,11 @@
212 219 \item status (out) is an optional integer equal to zero if something went wrong
213 220 \end{itemize}
214 221  
  222 +
215 223 \subsubsection*{Example}
216 224 \begin{verbatim}
217 225 program eigen
218   - use fvn
  226 + use fvn_linear
219 227 implicit none
220 228  
221 229 real(8),dimension(3,3) :: a
... ... @@ -249,6 +257,7 @@
249 257 The provided routines solves the equation $Ax=B$ where A is sparse and given in its triplet form.
250 258  
251 259 \begin{verbatim}
  260 +Module : fvn_sparse
252 261 call fvn_sparse_solve(n,nz,T,Ti,Tj,B,x,status)
253 262 \end{verbatim}
254 263 \begin{itemize}
255 264  
... ... @@ -262,11 +271,12 @@
262 271 \item status (out) is an integer which contain non-zero is something went wrong
263 272 \end{itemize}
264 273  
  274 +
265 275 \subsubsection*{Example}
266 276 \begin{verbatim}
267 277 program test_sparse
268 278  
269   - use fvn
  279 + use fvn_sparse
270 280 implicit none
271 281  
272 282 integer(8), parameter :: nz=12
... ... @@ -292,7 +302,7 @@
292 302  
293 303 program test_sparse
294 304  
295   -use fvn
  305 +use fvn_sparse
296 306 implicit none
297 307  
298 308 integer(4), parameter :: nz=12
299 309  
300 310  
... ... @@ -320,15 +330,20 @@
320 330  
321 331 \subsection{Identity matrix}
322 332 \begin{verbatim}
  333 + Module : use fvn_linear
323 334 I=fvn_*_ident(n) (*=s,d,c,z)
324 335 \end{verbatim}
325 336 \begin{itemize}
326 337 \item n (in) is an integer equal to the matrix rank
327 338 \end{itemize}
  339 +
328 340 This function return the identity matrix of rank n, in the specified type. No generic interface for this one.
329 341  
330 342 \subsection{Operators}
331 343 fvn defines some linear operators similar to those defined in IMSL\textregistered (\url{http://www.vni.com/products/imsl/}), that can be used for matrix operations.
  344 +\begin{verbatim}
  345 + Module : use fvn_linear
  346 +\end{verbatim}
332 347  
333 348 \subsubsection{Unary operators}
334 349 \paragraph{.i.}
... ... @@ -403,6 +418,7 @@
403 418 fvn provide function for interpolating values of a tabulated function of 1, 2 or 3 variables, for both single and double precision.
404 419 \subsubsection{One variable function}
405 420 \begin{verbatim}
  421 + Module : use fvn_interpol
406 422 value=fvn_quad_interpol(x,n,xdata,ydata)
407 423 \end{verbatim}
408 424 \begin{itemize}
... ... @@ -417,7 +433,7 @@
417 433 \begin{verbatim}
418 434 program inter1d
419 435  
420   -use fvn
  436 +use fvn_interpol
421 437 implicit none
422 438  
423 439 integer(kind=4),parameter :: ndata=33
... ... @@ -454,6 +470,7 @@
454 470  
455 471 \subsubsection{Two variables function}
456 472 \begin{verbatim}
  473 +Module : use fvn_interpol
457 474 value=fvn_quad_2d_interpol(x,y,nx,xdata,ny,ydata,zdata)
458 475 \end{verbatim}
459 476 \begin{itemize}
... ... @@ -471,7 +488,7 @@
471 488  
472 489 \begin{verbatim}
473 490 program inter2d
474   -use fvn
  491 +use fvn_interpol
475 492 implicit none
476 493  
477 494 integer(kind=4),parameter :: nx=21,ny=42
... ... @@ -513,6 +530,7 @@
513 530  
514 531 \subsubsection{Three variables function}
515 532 \begin{verbatim}
  533 + Module : use fvn_interpol
516 534 value=fvn_quad_3d_interpol(x,y,z,nx,xdata,ny,ydata,nz,zdata,tdata)
517 535 \end{verbatim}
518 536 \begin{itemize}
... ... @@ -531,7 +549,7 @@
531 549 \paragraph*{Example}
532 550 \begin{verbatim}
533 551 program inter3d
534   -use fvn
  552 +use fvn_interpol
535 553  
536 554 implicit none
537 555  
... ... @@ -579,6 +597,7 @@
579 597 \subsubsection{Utility procedure}
580 598 fvn provides a simple utility procedure to locate the interval in which a value is located in an increasingly ordered array.
581 599 \begin{verbatim}
  600 +Module : use fvn_interpol
582 601 call fvn_find_interval(x,i,xdata,n)
583 602 \end{verbatim}
584 603 \begin{itemize}
... ... @@ -595,6 +614,7 @@
595 614 fvn provides Akima spline interpolation and evaluation for both single and double precision real.
596 615 \subsubsection{Interpolation}
597 616 \begin{verbatim}
  617 +Module : use fvn_interpol
598 618 call fvn_akima(n,x,y,br,co)
599 619 \end{verbatim}
600 620 \begin{itemize}
... ... @@ -606,6 +626,7 @@
606 626  
607 627 \subsubsection{Evaluation}
608 628 \begin{verbatim}
  629 +Module : use fvn_interpol
609 630 y=fvn_spline_eval(x,n,br,co)
610 631 \end{verbatim}
611 632 \begin{itemize}
... ... @@ -621,7 +642,7 @@
621 642  
622 643 \begin{verbatim}
623 644 program akima
624   - use fvn
  645 + use fvn_interpol
625 646 implicit none
626 647  
627 648 integer :: nbpoints,nppoints,i
... ... @@ -681,6 +702,7 @@
681 702 fvn provide a function to find a least square polynomial of a given degree, for real in single or double precision. It is performed using Lapack subroutine sgels (dgels), which solve this problem.
682 703  
683 704 \begin{verbatim}
  705 +Module : use fvn_linear
684 706 call fvn_lspoly(np,x,y,deg,coeff,status)
685 707 \end{verbatim}
686 708 \begin{itemize}
... ... @@ -695,7 +717,7 @@
695 717 Here's a simple example : we've got 13 measurement points and we want to find the least square degree 3 polynomial for these points :
696 718 \begin{verbatim}
697 719 program lsp
698   - use fvn
  720 + use fvn_linear
699 721 implicit none
700 722  
701 723 integer,parameter :: npoints=13,deg=3
... ... @@ -760,6 +782,7 @@
760 782 fvn provide a routine for finding zeros of a complex function using Muller algorithm (only for double complex type). It is based on a version provided on the web by Hans D Mittelmann \url{http://plato.asu.edu/ftp/other\_software/muller.f}.
761 783  
762 784 \begin{verbatim}
  785 + Module : use fvn_misc
763 786 call fvn_muller(f,eps,eps1,kn,nguess,n,x,itmax,infer,ier)
764 787 \end{verbatim}
765 788 \begin{itemize}
... ... @@ -780,7 +803,7 @@
780 803 Example to find the ten roots of $x^{10}-1$
781 804 \begin{verbatim}
782 805 program muller
783   - use fvn
  806 + use fvn_misc
784 807 implicit none
785 808  
786 809 integer :: i,info
... ... @@ -811,6 +834,7 @@
811 834 \subsection{Gauss Legendre Abscissas and Weigth}
812 835 This subroutine was inspired by Numerical Recipes routine gauleg.
813 836 \begin{verbatim}
  837 +Module : use fvn_integ
814 838 call fvn_gauss_legendre(n,qx,qw)
815 839 \end{verbatim}
816 840 \begin{itemize}
... ... @@ -822,6 +846,7 @@
822 846  
823 847 \subsection{Gauss Legendre Numerical Integration}
824 848 \begin{verbatim}
  849 +Module : use fvn_integ
825 850 call fvn_gl_integ(f,a,b,n,res)
826 851 \end{verbatim}
827 852 \begin{itemize}
... ... @@ -836,6 +861,7 @@
836 861 This kind of numerical integration is an iterative procedure which try to achieve a given precision.
837 862 \subsubsection{Numerical integration of a one variable function}
838 863 \begin{verbatim}
  864 +Module : use fvn_integ
839 865 call fvn_integ_1_gk(f,a,b,epsabs,epsrel,key,res,abserr,ier,limit)
840 866 \end{verbatim}
841 867 This routine evaluate the integral of function f as in equation \ref{intsple}
... ... @@ -875,6 +901,7 @@
875 901  
876 902 \subsubsection{Numerical integration of a two variable function}
877 903 \begin{verbatim}
  904 +Module : use fvn_integ
878 905 call fvn_integ_2_gk(f,a,b,g,h,epsabs,epsrel,key,res,abserr,ier,limit)
879 906 \end{verbatim}
880 907 This function evaluate the integral of a function f(x,y) as defined in equation \ref{intdble}. The parameters of same name as in the previous paragraph have exactly the same function and behaviour thus only what differs is decribed here
... ... @@ -891,7 +918,7 @@
891 918 \subsubsection*{Example}
892 919 \begin{verbatim}
893 920 program integ
894   - use fvn
  921 + use fvn_integ
895 922 implicit none
896 923  
897 924 real(8), external :: f1,f2,g,h
898 925  
... ... @@ -943,8 +970,12 @@
943 970 \section{Special functions}
944 971 Specials functions are available in fvn by using an implementation of fnlib \url{http://www.netlib.org/fn} with some additions. This can be used separatly from the rest of fvn by using the module \verb'fvn_fnlib' and linking the library \verb'libfvn_fnlib.a' . The module provides a generic interfaces to all the routines. Specific names of the routines are given in the description.
945 972  
  973 +\begin{verbatim}
  974 + Module : use fvn_fnlib
  975 +\end{verbatim}
  976 +
946 977 \paragraph{Important Note}
947   -Due to the addition of fnlib to fvn, some functions that were in fvn and are redondant will be removed from fvn, so update your code now and replace them with the fnlib version. These are listed here after :
  978 +Due to the addition of fnlib to fvn, some functions that were in fvn and are redondant are now removed from fvn, so update your code now and replace them with the fnlib version. These are listed here after :
948 979 \begin{itemize}
949 980 \item \verb'fvn_z_acos' replaced by \verb'acos'
950 981 \item \verb'fvn_z_asin' replaced by \verb'asin'
fvn_test/test_akima.f90
1 1 program akima
2   - use fvn
  2 + use fvn_interpol
3 3 implicit none
4 4 integer :: nbpoints,nppoints,i
5 5 real(8),dimension(:),allocatable :: x_d,y_d,breakpoints_d
fvn_test/test_det.f90
1 1 program test_det
2   -use fvn
  2 +use fvn_linear
3 3 implicit none
4 4 real(8),dimension(3,3) :: a
5 5 real(8) :: deta
fvn_test/test_integ.f90
1 1 program integ
2   - use fvn
  2 + use fvn_integ
3 3 implicit none
4 4 real(8), external :: f1,f2,g,h
5 5 real(8) :: a,b,epsabs,epsrel,abserr,res
fvn_test/test_inter1d.f90
1 1 program inter1d
2   -use fvn
  2 +use fvn_interpol
3 3 implicit none
4 4 integer(kind=4),parameter :: ndata=33
5 5 integer(kind=4) :: i,nout
fvn_test/test_inter2d.f90
1 1 program inter2d
2   -use fvn
  2 +use fvn_interpol
3 3 implicit none
4 4 integer(kind=4),parameter :: nx=21,ny=42
5 5 integer(kind=4) :: i,j
fvn_test/test_inter3d.f90
1 1 program test_inter3d
2   -use fvn
  2 +use fvn_interpol
3 3 implicit none
4 4 integer(kind=4),parameter :: nx=21,ny=42,nz=18
5 5 integer(kind=4) :: i,j,k
fvn_test/test_lsp.f90
1 1 program lsp
2   -use fvn
  2 +use fvn_linear
3 3 implicit none
4 4 integer,parameter :: npoints=13,deg=3
5 5 integer :: status,i
fvn_test/test_matcon.f90
1 1 program test_matcon
2   -use fvn
  2 +use fvn_linear
3 3 implicit none
4 4 real(8),dimension(3,3) :: a
5 5 real(8) :: rcond
fvn_test/test_matev.f90
1 1 program test_matev
2   -use fvn
  2 +use fvn_linear
3 3 implicit none
4 4 real(8),dimension(3,3) :: a
5 5 complex(8),dimension(3) :: evala
fvn_test/test_matinv.f90
1 1 program test_matinv
2   -use fvn
  2 +use fvn_linear
3 3 implicit none
4 4 integer(4), parameter :: n=3
5 5 integer(4) :: status,i
fvn_test/test_muller.f90
1 1 program muller
2   -use fvn
  2 +use fvn_misc
3 3 implicit none
4 4 integer :: i,info
5 5 complex(8),dimension(10) :: roots
fvn_test/test_operators.f90
1 1 program test_matinv
2   -use fvn
  2 +use fvn_linear
3 3 implicit none
4 4  
5 5 integer, parameter :: n=3
fvn_test/test_sparse.f90
1 1 program test_sparse
2   -use fvn
  2 +use fvn_sparse
3 3 implicit none
4 4 integer(4), parameter :: nz=12
5 5 integer(4), parameter :: n=5