3 * This file is part of Gromacs Copyright (c) 1991-2004
4 * David van der Spoel, Erik Lindahl, University of Groningen.
6 * This file contains a subset of ARPACK functions to perform
7 * diagonalization and SVD for sparse matrices in Gromacs.
9 * The code has been translated to C to avoid being dependent on
10 * a Fotran compiler, and it has been made threadsafe by using
11 * additional workspace arrays to store data during reverse communication.
13 * You might prefer the original ARPACK library for general use, but
14 * in case you want to this version can be redistributed freely, just
15 * as the original library. However, please make clear that it is the
16 * hacked version from Gromacs so any bugs are blamed on us and not
17 * the original authors. You should also be aware that the double
18 * precision work array workd needs to be of size (3*N+4) here
19 * (4 more than the general library), and there is an extra argument
20 * iwork, which should be an integer work array of length 80.
22 * ARPACK was written by
24 * Danny Sorensen Phuong Vu
25 * Riconst chard Lehoucq CRPC / Rice University
26 * Dept. of Computational & Houston, Texas
44 * \brief Selected routines from ARPACK
46 * This file contains a subset of ARPACK functions to perform
47 * diagonalization and SVD for sparse matrices in Gromacs.
49 * Consult the main ARPACK site for detailed documentation:
50 * http://www.caam.rice.edu/software/ARPACK/
52 * Below, we just list the options and any specific differences
53 * from ARPACK. The code is essentially the same, but the routines
54 * have been made thread-safe by using extra workspace arrays.
58 #define F77_FUNC(name,NAME) name ## _
62 /*! \brief Implicitly Restarted Arnoldi Iteration, double precision.
64 * Reverse communication interface for the Implicitly Restarted Arnoldi
65 * Iteration. For symmetric problems this reduces to a variant of the
66 * Lanczos method. See the ARPACK site for details.
68 * \param ido Reverse communication flag. Set to 0 first time.
69 * Upon return with ido=-1 or ido=1 you should calculate
70 * Y=A*X and recall the routine. Return with ido=2 means
71 * Y=B*X should be calculated. ipntr[0] is the pointer in
72 * workd for X, ipntr[1] is the index for Y.
73 * Return with ido=99 means it finished.
74 * \param bmat 'I' for standard eigenproblem, 'G' for generalized.
75 * \param n Order of eigenproblem.
76 * \param which Which eigenvalues to calculate. 'LA' for largest
77 * algebraic, 'SA' for smallest algebraic, 'LM' for largest
78 * magnitude, 'SM' for smallest magnitude, and finally
79 * 'BE' (both ends) to calculate half from each end of
81 * \param nev Number of eigenvalues to calculate. 0<nev<n.
82 * \param tol Tolerance. Machine precision of it is 0.
83 * \param resid Optional starting residual vector at input if info=1,
84 * otherwise a random one is used. Final residual vector on
86 * \param ncv Number of columns in matrix v.
87 * \param v N*NCV matrix. V contain the Lanczos basis vectors.
88 * \param ldv Leading dimension of v.
89 * \param iparam Integer array, size 11. Same contents as arpack.
90 * \param ipntr Integer array, size 11. Points to starting locations
91 * in the workd/workl arrays. Same contents as arpack.
92 * \param workd Double precision work array, length 3*n+4.
93 * Provide the same array for all calls, and don't touch it.
94 * IMPORTANT: This is 4 units larger than standard ARPACK!
95 * \param iwork Integer work array, size 80.
96 * Provide the same array for all calls, and don't touch it.
97 * IMPORTANT: New argument compared to standard ARPACK!
98 * \param workl Double precision work array, length lwork.
99 * \param lworkl Length of the work array workl. Must be at least ncv*(ncv+8)
100 * \param info Set info to 0 to use random initial residual vector,
101 * or to 1 if you provide a one. On output, info=0 means
102 * normal exit, 1 that max number of iterations was reached,
103 * and 3 that no shifts could be applied. Negative numbers
104 * correspond to errors in the arguments provided.
107 F77_FUNC(dsaupd
,DSAUPD
)(int * ido
,
127 /*! \brief Get eigenvalues/vectors after Arnoldi iteration, double prec.
129 * See the ARPACK site for details. You must have finished the interative
130 * part with dsaupd() before calling this function.
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()
166 F77_FUNC(dseupd
,DSEUPD
)(int * rvec
,
193 /*! \brief Implicitly Restarted Arnoldi Iteration, single precision.
195 * Reverse communication interface for the Implicitly Restarted Arnoldi
196 * Iteration. For symmetric problems this reduces to a variant of the
197 * Lanczos method. See the ARPACK site for details.
199 * \param ido Reverse communication flag. Set to 0 first time.
200 * Upon return with ido=-1 or ido=1 you should calculate
201 * Y=A*X and recall the routine. Return with ido=2 means
202 * Y=B*X should be calculated. ipntr[0] is the pointer in
203 * workd for X, ipntr[1] is the index for Y.
204 * Return with ido=99 means it finished.
205 * \param bmat 'I' for standard eigenproblem, 'G' for generalized.
206 * \param n Order of eigenproblem.
207 * \param which Which eigenvalues to calculate. 'LA' for largest
208 * algebraic, 'SA' for smallest algebraic, 'LM' for largest
209 * magnitude, 'SM' for smallest magnitude, and finally
210 * 'BE' (both ends) to calculate half from each end of
212 * \param nev Number of eigenvalues to calculate. 0<nev<n.
213 * \param tol Tolerance. Machine precision of it is 0.
214 * \param resid Optional starting residual vector at input if info=1,
215 * otherwise a random one is used. Final residual vector on
217 * \param ncv Number of columns in matrix v.
218 * \param v N*NCV matrix. V contain the Lanczos basis vectors.
219 * \param ldv Leading dimension of v.
220 * \param iparam Integer array, size 11. Same contents as arpack.
221 * \param ipntr Integer array, size 11. Points to starting locations
222 * in the workd/workl arrays. Same contents as arpack.
223 * \param workd Single precision work array, length 3*n+4.
224 * Provide the same array for all calls, and don't touch it.
225 * IMPORTANT: This is 4 units larger than standard ARPACK!
226 * \param iwork Integer work array, size 80.
227 * Provide the same array for all calls, and don't touch it.
228 * IMPORTANT: New argument compared to standard ARPACK!
229 * \param workl Single precision work array, length lwork.
230 * \param lworkl Length of the work array workl. Must be at least ncv*(ncv+8)
231 * \param info Set info to 0 to use random initial residual vector,
232 * or to 1 if you provide a one. On output, info=0 means
233 * normal exit, 1 that max number of iterations was reached,
234 * and 3 that no shifts could be applied. Negative numbers
235 * correspond to errors in the arguments provided.
238 F77_FUNC(ssaupd
,SSAUPD
)(int * ido
,
260 /*! \brief Get eigenvalues/vectors after Arnoldi iteration, single prec.
262 * See the ARPACK site for details. You must have finished the interative
263 * part with ssaupd() before calling this function.
265 * \param rvec 1 if you want eigenvectors, 0 if not.
266 * \param howmny 'A' if you want all nvec vectors, 'S' if you
267 * provide a subset selection in select[].
268 * \param select Integer array, dimension nev. Indices of the
269 * eigenvectors to calculate. Fortran code means we
270 * start counting on 1. This array must be given even in
271 * howmny is 'A'. (Arpack documentation is wrong on this).
272 * \param d Single precision array, length nev. Eigenvalues.
273 * \param z Single precision array, n*nev. Eigenvectors.
274 * \param ldz Leading dimension of z. Normally n.
275 * \param sigma Shift if iparam[6] is 3,4, or 5. Ignored otherwise.
276 * \param bmat Provide the same argument as you did to ssaupd()
277 * \param n Provide the same argument as you did to ssaupd()
278 * \param which Provide the same argument as you did to ssaupd()
279 * \param nev Provide the same argument as you did to ssaupd()
280 * \param tol Provide the same argument as you did to ssaupd()
281 * \param resid Provide the same argument as you did to ssaupd()
282 * The array must not be touched between the two function calls!
283 * \param ncv Provide the same argument as you did to ssaupd()
284 * \param v Provide the same argument as you did to ssaupd()
285 * The array must not be touched between the two function calls!
286 * \param ldv Provide the same argument as you did to ssaupd()
287 * \param iparam Provide the same argument as you did to ssaupd()
288 * The array must not be touched between the two function calls!
289 * \param ipntr Provide the same argument as you did to ssaupd()
290 * The array must not be touched between the two function calls!
291 * \param workd Provide the same argument as you did to ssaupd()
292 * The array must not be touched between the two function calls!
293 * \param workl Single precision work array, length lwork.
294 * The array must not be touched between the two function calls!
295 * \param lworkl Provide the same argument as you did to ssaupd()
296 * \param info Provide the same argument as you did to ssaupd()
299 F77_FUNC(sseupd
,SSEUPD
)(int * rvec
,