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
33 * Selected routines from ARPACK
35 * This file contains a subset of ARPACK functions to perform
36 * diagonalization and SVD for sparse matrices in Gromacs.
38 * Consult the main ARPACK site for detailed documentation:
39 * http://www.caam.rice.edu/software/ARPACK/
41 * Below, we just list the options and any specific differences
42 * from ARPACK. The code is essentially the same, but the routines
43 * have been made thread-safe by using extra workspace arrays.
55 /*! \brief Implicitly Restarted Arnoldi Iteration, double precision.
57 * Reverse communication interface for the Implicitly Restarted Arnoldi
58 * Iteration. For symmetric problems this reduces to a variant of the
59 * Lanczos method. See the ARPACK site for details.
61 * \param ido Reverse communication flag. Set to 0 first time.
62 * Upon return with ido=-1 or ido=1 you should calculate
63 * Y=A*X and recall the routine. Return with ido=2 means
64 * Y=B*X should be calculated. ipntr[0] is the pointer in
65 * workd for X, ipntr[1] is the index for Y.
66 * Return with ido=99 means it finished.
67 * \param bmat 'I' for standard eigenproblem, 'G' for generalized.
68 * \param n Order of eigenproblem.
69 * \param which Which eigenvalues to calculate. 'LA' for largest
70 * algebraic, 'SA' for smallest algebraic, 'LM' for largest
71 * magnitude, 'SM' for smallest magnitude, and finally
72 * 'BE' (both ends) to calculate half from each end of
74 * \param nev Number of eigenvalues to calculate. 0<nev<n.
75 * \param tol Tolerance. Machine precision of it is 0.
76 * \param resid Optional starting residual vector at input if info=1,
77 * otherwise a random one is used. Final residual vector on
79 * \param ncv Number of columns in matrix v.
80 * \param v N*NCV matrix. V contain the Lanczos basis vectors.
81 * \param ldv Leading dimension of v.
82 * \param iparam Integer array, size 11. Same contents as arpack.
83 * \param ipntr Integer array, size 11. Points to starting locations
84 * in the workd/workl arrays. Same contents as arpack.
85 * \param workd Double precision work array, length 3*n+4.
86 * Provide the same array for all calls, and don't touch it.
87 * IMPORTANT: This is 4 units larger than standard ARPACK!
88 * \param iwork Integer work array, size 80.
89 * Provide the same array for all calls, and don't touch it.
90 * IMPORTANT: New argument compared to standard ARPACK!
91 * \param workl Double precision work array, length lwork.
92 * \param lworkl Length of the work array workl. Must be at least ncv*(ncv+8)
93 * \param info Set info to 0 to use random initial residual vector,
94 * or to 1 if you provide a one. On output, info=0 means
95 * normal exit, 1 that max number of iterations was reached,
96 * and 3 that no shifts could be applied. Negative numbers
97 * correspond to errors in the arguments provided.
100 F77_FUNC(dsaupd, DSAUPD) (int * ido,
120 /*! \brief Get eigenvalues/vectors after Arnoldi iteration, double prec.
122 * See the ARPACK site for details. You must have finished the interative
123 * part with dsaupd() before calling this function.
125 * \param rvec 1 if you want eigenvectors, 0 if not.
126 * \param howmny 'A' if you want all nvec vectors, 'S' if you
127 * provide a subset selection in select[].
128 * \param select Integer array, dimension nev. Indices of the
129 * eigenvectors to calculate. Fortran code means we
130 * start counting on 1. This array must be given even in
131 * howmny is 'A'. (Arpack documentation is wrong on this).
132 * \param d Double precision array, length nev. Eigenvalues.
133 * \param z Double precision array, n*nev. Eigenvectors.
134 * \param ldz Leading dimension of z. Normally n.
135 * \param sigma Shift if iparam[6] is 3,4, or 5. Ignored otherwise.
136 * \param bmat Provide the same argument as you did to dsaupd()
137 * \param n Provide the same argument as you did to dsaupd()
138 * \param which Provide the same argument as you did to dsaupd()
139 * \param nev Provide the same argument as you did to dsaupd()
140 * \param tol Provide the same argument as you did to dsaupd()
141 * \param resid Provide the same argument as you did to dsaupd()
142 * The array must not be touched between the two function calls!
143 * \param ncv Provide the same argument as you did to dsaupd()
144 * \param v Provide the same argument as you did to dsaupd()
145 * The array must not be touched between the two function calls!
146 * \param ldv Provide the same argument as you did to dsaupd()
147 * \param iparam Provide the same argument as you did to dsaupd()
148 * The array must not be touched between the two function calls!
149 * \param ipntr Provide the same argument as you did to dsaupd()
150 * The array must not be touched between the two function calls!
151 * \param workd Provide the same argument as you did to dsaupd()
152 * The array must not be touched between the two function calls!
153 * \param workl Double precision work array, length lwork.
154 * The array must not be touched between the two function calls!
155 * \param lworkl Provide the same argument as you did to dsaupd()
156 * \param info Provide the same argument as you did to dsaupd()
159 F77_FUNC(dseupd, DSEUPD) (int * rvec,
186 /*! \brief Implicitly Restarted Arnoldi Iteration, single precision.
188 * Reverse communication interface for the Implicitly Restarted Arnoldi
189 * Iteration. For symmetric problems this reduces to a variant of the
190 * Lanczos method. See the ARPACK site for details.
192 * \param ido Reverse communication flag. Set to 0 first time.
193 * Upon return with ido=-1 or ido=1 you should calculate
194 * Y=A*X and recall the routine. Return with ido=2 means
195 * Y=B*X should be calculated. ipntr[0] is the pointer in
196 * workd for X, ipntr[1] is the index for Y.
197 * Return with ido=99 means it finished.
198 * \param bmat 'I' for standard eigenproblem, 'G' for generalized.
199 * \param n Order of eigenproblem.
200 * \param which Which eigenvalues to calculate. 'LA' for largest
201 * algebraic, 'SA' for smallest algebraic, 'LM' for largest
202 * magnitude, 'SM' for smallest magnitude, and finally
203 * 'BE' (both ends) to calculate half from each end of
205 * \param nev Number of eigenvalues to calculate. 0<nev<n.
206 * \param tol Tolerance. Machine precision of it is 0.
207 * \param resid Optional starting residual vector at input if info=1,
208 * otherwise a random one is used. Final residual vector on
210 * \param ncv Number of columns in matrix v.
211 * \param v N*NCV matrix. V contain the Lanczos basis vectors.
212 * \param ldv Leading dimension of v.
213 * \param iparam Integer array, size 11. Same contents as arpack.
214 * \param ipntr Integer array, size 11. Points to starting locations
215 * in the workd/workl arrays. Same contents as arpack.
216 * \param workd Single precision work array, length 3*n+4.
217 * Provide the same array for all calls, and don't touch it.
218 * IMPORTANT: This is 4 units larger than standard ARPACK!
219 * \param iwork Integer work array, size 80.
220 * Provide the same array for all calls, and don't touch it.
221 * IMPORTANT: New argument compared to standard ARPACK!
222 * \param workl Single precision work array, length lwork.
223 * \param lworkl Length of the work array workl. Must be at least ncv*(ncv+8)
224 * \param info Set info to 0 to use random initial residual vector,
225 * or to 1 if you provide a one. On output, info=0 means
226 * normal exit, 1 that max number of iterations was reached,
227 * and 3 that no shifts could be applied. Negative numbers
228 * correspond to errors in the arguments provided.
231 F77_FUNC(ssaupd, SSAUPD) (int * ido,
253 /*! \brief Get eigenvalues/vectors after Arnoldi iteration, single prec.
255 * See the ARPACK site for details. You must have finished the interative
256 * part with ssaupd() before calling this function.
258 * \param rvec 1 if you want eigenvectors, 0 if not.
259 * \param howmny 'A' if you want all nvec vectors, 'S' if you
260 * provide a subset selection in select[].
261 * \param select Integer array, dimension nev. Indices of the
262 * eigenvectors to calculate. Fortran code means we
263 * start counting on 1. This array must be given even in
264 * howmny is 'A'. (Arpack documentation is wrong on this).
265 * \param d Single precision array, length nev. Eigenvalues.
266 * \param z Single precision array, n*nev. Eigenvectors.
267 * \param ldz Leading dimension of z. Normally n.
268 * \param sigma Shift if iparam[6] is 3,4, or 5. Ignored otherwise.
269 * \param bmat Provide the same argument as you did to ssaupd()
270 * \param n Provide the same argument as you did to ssaupd()
271 * \param which Provide the same argument as you did to ssaupd()
272 * \param nev Provide the same argument as you did to ssaupd()
273 * \param tol Provide the same argument as you did to ssaupd()
274 * \param resid Provide the same argument as you did to ssaupd()
275 * The array must not be touched between the two function calls!
276 * \param ncv Provide the same argument as you did to ssaupd()
277 * \param v Provide the same argument as you did to ssaupd()
278 * The array must not be touched between the two function calls!
279 * \param ldv Provide the same argument as you did to ssaupd()
280 * \param iparam Provide the same argument as you did to ssaupd()
281 * The array must not be touched between the two function calls!
282 * \param ipntr Provide the same argument as you did to ssaupd()
283 * The array must not be touched between the two function calls!
284 * \param workd Provide the same argument as you did to ssaupd()
285 * The array must not be touched between the two function calls!
286 * \param workl Single precision work array, length lwork.
287 * The array must not be touched between the two function calls!
288 * \param lworkl Provide the same argument as you did to ssaupd()
289 * \param info Provide the same argument as you did to ssaupd()
292 F77_FUNC(sseupd, SSEUPD) (int * rvec,