Fixing copyright issues and code contributors
[alexxy/gromacs.git] / include / gmx_arpack.h
1 /*
2  * This file is part of the GROMACS molecular simulation package.
3  *
4  * This file is part of Gromacs        Copyright (c) 1991-2004
5  * David van der Spoel, Erik Lindahl, University of Groningen.
6  * Copyright (c) 2012,2013, by the GROMACS development team, led by
7  * David van der Spoel, Berk Hess, Erik Lindahl, and including many
8  * others, as listed in the AUTHORS file in the top-level source
9  * directory and at http://www.gromacs.org.
10  *
11  * GROMACS is free software; you can redistribute it and/or
12  * modify it under the terms of the GNU Lesser General Public License
13  * as published by the Free Software Foundation; either version 2.1
14  * of the License, or (at your option) any later version.
15  *
16  * GROMACS is distributed in the hope that it will be useful,
17  * but WITHOUT ANY WARRANTY; without even the implied warranty of
18  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
19  * Lesser General Public License for more details.
20  *
21  * You should have received a copy of the GNU Lesser General Public
22  * License along with GROMACS; if not, see
23  * http://www.gnu.org/licenses, or write to the Free Software Foundation,
24  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA.
25  *
26  * If you want to redistribute modifications to GROMACS, please
27  * consider that scientific software is very special. Version
28  * control is crucial - bugs must be traceable. We will be happy to
29  * consider code for inclusion in the official distribution, but
30  * derived work must not be called official GROMACS. Details are found
31  * in the README & COPYING files - if they are missing, get the
32  * official version at http://www.gromacs.org.
33  *
34  * To help us fund GROMACS development, we humbly ask that you cite
35  * the research papers on the package. Check out http://www.gromacs.org.
36  */
37
38 #ifndef _GMX_ARPACK_H
39 #define _GMX_ARPACK_H
40
41 #include "visibility.h"
42 #ifdef __cplusplus
43 extern "C" {
44 #endif
45
46 /*! \file
47  * \brief Selected routines from ARPACK
48  *
49  * This file contains a subset of ARPACK functions to perform
50  * diagonalization and SVD for sparse matrices in Gromacs.
51  *
52  * Consult the main ARPACK site for detailed documentation:
53  * http://www.caam.rice.edu/software/ARPACK/
54  *
55  * Below, we just list the options and any specific differences
56  * from ARPACK. The code is essentially the same, but the routines
57  * have been made thread-safe by using extra workspace arrays.
58  */
59
60
61 /*! \brief Implicitly Restarted Arnoldi Iteration, double precision.
62  *
63  *  Reverse communication interface for the Implicitly Restarted Arnoldi 
64  *  Iteration.  For symmetric problems this reduces to a variant of the
65  *  Lanczos method. See the ARPACK site for details.
66  *
67  *  \param ido     Reverse communication flag. Set to 0 first time.
68  *                 Upon return with ido=-1 or ido=1 you should calculate
69  *                 Y=A*X and recall the routine. Return with ido=2 means
70  *                 Y=B*X should be calculated. ipntr[0] is the pointer in
71  *                 workd for X, ipntr[1] is the index for Y.
72  *                 Return with ido=99 means it finished.
73  *  \param bmat    'I' for standard eigenproblem, 'G' for generalized.
74  *  \param n       Order of eigenproblem.
75  *  \param which   Which eigenvalues to calculate. 'LA' for largest 
76  *                 algebraic, 'SA' for smallest algebraic, 'LM' for largest
77  *                 magnitude, 'SM' for smallest magnitude, and finally
78  *                 'BE' (both ends) to calculate half from each end of
79  *                 the spectrum.
80  *  \param nev     Number of eigenvalues to calculate. 0<nev<n.
81  *  \param tol     Tolerance. Machine precision of it is 0.
82  *  \param resid   Optional starting residual vector at input if info=1,
83  *                 otherwise a random one is used. Final residual vector on 
84  *                 return.
85  *  \param ncv     Number of columns in matrix v.
86  *  \param v       N*NCV matrix. V contain the Lanczos basis vectors.
87  *  \param ldv     Leading dimension of v.
88  *  \param iparam  Integer array, size 11. Same contents as arpack.
89  *  \param ipntr   Integer array, size 11. Points to starting locations
90  *                 in the workd/workl arrays. Same contents as arpack.
91  *  \param workd   Double precision work array, length 3*n+4. 
92  *                 Provide the same array for all calls, and don't touch it.
93  *                 IMPORTANT: This is 4 units larger than standard ARPACK!
94  *  \param iwork   Integer work array, size 80. 
95  *                 Provide the same array for all calls, and don't touch it.
96  *                 IMPORTANT: New argument compared to standard ARPACK!
97  *  \param workl   Double precision work array, length lwork.
98  *  \param lworkl  Length of the work array workl. Must be at least ncv*(ncv+8)
99  *  \param info    Set info to 0 to use random initial residual vector,
100  *                 or to 1 if you provide a one. On output, info=0 means 
101  *                 normal exit, 1 that max number of iterations was reached,
102  *                 and 3 that no shifts could be applied. Negative numbers
103  *                 correspond to errors in the arguments provided.
104  */
105 GMX_LIBGMX_EXPORT
106 void
107 F77_FUNC(dsaupd,DSAUPD)(int *     ido, 
108                         const char *    bmat, 
109                         int *     n, 
110                         const char *      which, 
111                         int *     nev, 
112                         double *  tol, 
113                         double *  resid, 
114                         int *     ncv,
115                         double *  v, 
116                         int *     ldv, 
117                         int *     iparam,
118                         int *     ipntr, 
119                         double *  workd, 
120                         int *     iwork,
121                         double *  workl, 
122                         int *     lworkl,
123                         int *     info);
124
125
126
127 /*! \brief Get eigenvalues/vectors after Arnoldi iteration, double prec.
128  *
129  *  See the ARPACK site for details. You must have finished the interative
130  *  part with dsaupd() before calling this function.
131  *
132  *  \param rvec    1 if you want eigenvectors, 0 if not.
133  *  \param howmny  'A' if you want all nvec vectors, 'S' if you
134  *                 provide a subset selection in select[].
135  *  \param select  Integer array, dimension nev. Indices of the 
136  *                 eigenvectors to calculate. Fortran code means we
137  *                 start counting on 1. This array must be given even in
138  *                 howmny is 'A'. (Arpack documentation is wrong on this).
139  *  \param d       Double precision array, length nev. Eigenvalues.              
140  *  \param z       Double precision array, n*nev. Eigenvectors.           
141  *  \param ldz     Leading dimension of z. Normally n.
142  *  \param sigma   Shift if iparam[6] is 3,4, or 5. Ignored otherwise.
143  *  \param bmat    Provide the same argument as you did to dsaupd()
144  *  \param n       Provide the same argument as you did to dsaupd()
145  *  \param which   Provide the same argument as you did to dsaupd()
146  *  \param nev     Provide the same argument as you did to dsaupd()
147  *  \param tol     Provide the same argument as you did to dsaupd()
148  *  \param resid   Provide the same argument as you did to dsaupd()
149  *                 The array must not be touched between the two function calls!
150  *  \param ncv     Provide the same argument as you did to dsaupd()
151  *  \param v       Provide the same argument as you did to dsaupd()
152  *                 The array must not be touched between the two function calls!
153  *  \param ldv     Provide the same argument as you did to dsaupd()
154  *  \param iparam  Provide the same argument as you did to dsaupd()
155  *                 The array must not be touched between the two function calls!
156  *  \param ipntr   Provide the same argument as you did to dsaupd()
157  *                 The array must not be touched between the two function calls!
158  *  \param workd   Provide the same argument as you did to dsaupd()
159  *                 The array must not be touched between the two function calls!
160  *  \param workl   Double precision work array, length lwork.
161  *                 The array must not be touched between the two function calls!
162  *  \param lworkl  Provide the same argument as you did to dsaupd()
163  *  \param info    Provide the same argument as you did to dsaupd()
164  */
165 GMX_LIBGMX_EXPORT
166 void
167 F77_FUNC(dseupd,DSEUPD)(int *     rvec, 
168                         const char *    howmny, 
169                         int *     select, 
170                         double *  d, 
171                         double *  z, 
172                         int *     ldz, 
173                         double *  sigma, 
174                         const char *    bmat, 
175                         int *     n, 
176                         const char *    which, 
177                         int *     nev, 
178                         double *  tol, 
179                         double *  resid, 
180                         int *     ncv, 
181                         double *  v,
182                         int *     ldv, 
183                         int *     iparam, 
184                         int *     ipntr, 
185                         double *  workd, 
186                         double *  workl, 
187                         int *     lworkl, 
188                         int *     info);
189
190
191
192
193
194 /*! \brief Implicitly Restarted Arnoldi Iteration, single precision.
195  *
196  *  Reverse communication interface for the Implicitly Restarted Arnoldi 
197  *  Iteration.  For symmetric problems this reduces to a variant of the
198  *  Lanczos method. See the ARPACK site for details.
199  *
200  *  \param ido     Reverse communication flag. Set to 0 first time.
201  *                 Upon return with ido=-1 or ido=1 you should calculate
202  *                 Y=A*X and recall the routine. Return with ido=2 means
203  *                 Y=B*X should be calculated. ipntr[0] is the pointer in
204  *                 workd for X, ipntr[1] is the index for Y.
205  *                 Return with ido=99 means it finished.
206  *  \param bmat    'I' for standard eigenproblem, 'G' for generalized.
207  *  \param n       Order of eigenproblem.
208  *  \param which   Which eigenvalues to calculate. 'LA' for largest 
209  *                 algebraic, 'SA' for smallest algebraic, 'LM' for largest
210  *                 magnitude, 'SM' for smallest magnitude, and finally
211  *                 'BE' (both ends) to calculate half from each end of
212  *                 the spectrum.
213  *  \param nev     Number of eigenvalues to calculate. 0<nev<n.
214  *  \param tol     Tolerance. Machine precision of it is 0.
215  *  \param resid   Optional starting residual vector at input if info=1,
216  *                 otherwise a random one is used. Final residual vector on 
217  *                 return.
218  *  \param ncv     Number of columns in matrix v.
219  *  \param v       N*NCV matrix. V contain the Lanczos basis vectors.
220  *  \param ldv     Leading dimension of v.
221  *  \param iparam  Integer array, size 11. Same contents as arpack.
222  *  \param ipntr   Integer array, size 11. Points to starting locations
223  *                 in the workd/workl arrays. Same contents as arpack.
224  *  \param workd   Single precision work array, length 3*n+4. 
225  *                 Provide the same array for all calls, and don't touch it.
226  *                 IMPORTANT: This is 4 units larger than standard ARPACK!
227  *  \param iwork   Integer work array, size 80. 
228  *                 Provide the same array for all calls, and don't touch it.
229  *                 IMPORTANT: New argument compared to standard ARPACK!
230  *  \param workl   Single precision work array, length lwork.
231  *  \param lworkl  Length of the work array workl. Must be at least ncv*(ncv+8)
232  *  \param info    Set info to 0 to use random initial residual vector,
233  *                 or to 1 if you provide a one. On output, info=0 means 
234  *                 normal exit, 1 that max number of iterations was reached,
235  *                 and 3 that no shifts could be applied. Negative numbers
236  *                 correspond to errors in the arguments provided.
237  */
238 GMX_LIBGMX_EXPORT
239 void 
240 F77_FUNC(ssaupd,SSAUPD)(int *     ido, 
241                         const char *    bmat, 
242                         int *     n, 
243                         const char *    which, 
244                         int *     nev, 
245                         float *   tol, 
246                         float *   resid, 
247                         int *     ncv,
248                         float *   v, 
249                         int *     ldv, 
250                         int *     iparam,
251                         int *     ipntr, 
252                         float *   workd, 
253                         int *     iwork,
254                         float *   workl, 
255                         int *     lworkl,
256                         int *     info);
257
258
259
260
261
262 /*! \brief Get eigenvalues/vectors after Arnoldi iteration, single prec.
263  *
264  *  See the ARPACK site for details. You must have finished the interative
265  *  part with ssaupd() before calling this function.
266  *
267  *  \param rvec    1 if you want eigenvectors, 0 if not.
268  *  \param howmny  'A' if you want all nvec vectors, 'S' if you
269  *                 provide a subset selection in select[].
270  *  \param select  Integer array, dimension nev. Indices of the 
271  *                 eigenvectors to calculate. Fortran code means we
272  *                 start counting on 1. This array must be given even in
273  *                 howmny is 'A'. (Arpack documentation is wrong on this).
274  *  \param d       Single precision array, length nev. Eigenvalues.              
275  *  \param z       Single precision array, n*nev. Eigenvectors.           
276  *  \param ldz     Leading dimension of z. Normally n.
277  *  \param sigma   Shift if iparam[6] is 3,4, or 5. Ignored otherwise.
278  *  \param bmat    Provide the same argument as you did to ssaupd()
279  *  \param n       Provide the same argument as you did to ssaupd()
280  *  \param which   Provide the same argument as you did to ssaupd()
281  *  \param nev     Provide the same argument as you did to ssaupd()
282  *  \param tol     Provide the same argument as you did to ssaupd()
283  *  \param resid   Provide the same argument as you did to ssaupd()
284  *                 The array must not be touched between the two function calls!
285  *  \param ncv     Provide the same argument as you did to ssaupd()
286  *  \param v       Provide the same argument as you did to ssaupd()
287  *                 The array must not be touched between the two function calls!
288  *  \param ldv     Provide the same argument as you did to ssaupd()
289  *  \param iparam  Provide the same argument as you did to ssaupd()
290  *                 The array must not be touched between the two function calls!
291  *  \param ipntr   Provide the same argument as you did to ssaupd()
292  *                 The array must not be touched between the two function calls!
293  *  \param workd   Provide the same argument as you did to ssaupd()
294  *                 The array must not be touched between the two function calls!
295  *  \param workl   Single precision work array, length lwork.
296  *                 The array must not be touched between the two function calls!
297  *  \param lworkl  Provide the same argument as you did to ssaupd()
298  *  \param info    Provide the same argument as you did to ssaupd()
299  */
300 GMX_LIBGMX_EXPORT
301 void
302 F77_FUNC(sseupd,SSEUPD)(int *     rvec, 
303                         const char *    howmny, 
304                         int *     select, 
305                         float *   d, 
306                         float *   z, 
307                         int *     ldz, 
308                         float *   sigma, 
309                         const char *    bmat, 
310                         int *     n, 
311                         const char *    which, 
312                         int *     nev, 
313                         float *   tol, 
314                         float *   resid, 
315                         int *     ncv, 
316                         float *   v,
317                         int *     ldv, 
318                         int *     iparam, 
319                         int *     ipntr, 
320                         float *   workd, 
321                         float *   workl, 
322                         int *     lworkl, 
323                         int *     info);
324
325 #ifdef __cplusplus
326 }
327 #endif
328
329 #endif
330