2 * This file is part of the GROMACS molecular simulation package.
4 * Copyright (c) 1991-2004 David van der Spoel, Erik Lindahl, University of Groningen.
5 * Copyright (c) 2012,2013, by the GROMACS development team, led by
6 * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
7 * and including many others, as listed in the AUTHORS file in the
8 * top-level source directory and at http://www.gromacs.org.
10 * GROMACS is free software; you can redistribute it and/or
11 * modify it under the terms of the GNU Lesser General Public License
12 * as published by the Free Software Foundation; either version 2.1
13 * of the License, or (at your option) any later version.
15 * GROMACS is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18 * Lesser General Public License for more details.
20 * You should have received a copy of the GNU Lesser General Public
21 * License along with GROMACS; if not, see
22 * http://www.gnu.org/licenses, or write to the Free Software Foundation,
23 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
25 * If you want to redistribute modifications to GROMACS, please
26 * consider that scientific software is very special. Version
27 * control is crucial - bugs must be traceable. We will be happy to
28 * consider code for inclusion in the official distribution, but
29 * derived work must not be called official GROMACS. Details are found
30 * in the README & COPYING files - if they are missing, get the
31 * official version at http://www.gromacs.org.
33 * To help us fund GROMACS development, we humbly ask that you cite
34 * the research papers on the package. Check out http://www.gromacs.org.
38 * Selected routines from ARPACK
40 * This file contains a subset of ARPACK functions to perform
41 * diagonalization and SVD for sparse matrices in Gromacs.
43 * Consult the main ARPACK site for detailed documentation:
44 * http://www.caam.rice.edu/software/ARPACK/
46 * Below, we just list the options and any specific differences
47 * from ARPACK. The code is essentially the same, but the routines
48 * have been made thread-safe by using extra workspace arrays.
60 /*! \brief Implicitly Restarted Arnoldi Iteration, double precision.
62 * Reverse communication interface for the Implicitly Restarted Arnoldi
63 * Iteration. For symmetric problems this reduces to a variant of the
64 * Lanczos method. See the ARPACK site for details.
66 * \param ido Reverse communication flag. Set to 0 first time.
67 * Upon return with ido=-1 or ido=1 you should calculate
68 * Y=A*X and recall the routine. Return with ido=2 means
69 * Y=B*X should be calculated. ipntr[0] is the pointer in
70 * workd for X, ipntr[1] is the index for Y.
71 * Return with ido=99 means it finished.
72 * \param bmat 'I' for standard eigenproblem, 'G' for generalized.
73 * \param n Order of eigenproblem.
74 * \param which Which eigenvalues to calculate. 'LA' for largest
75 * algebraic, 'SA' for smallest algebraic, 'LM' for largest
76 * magnitude, 'SM' for smallest magnitude, and finally
77 * 'BE' (both ends) to calculate half from each end of
79 * \param nev Number of eigenvalues to calculate. 0<nev<n.
80 * \param tol Tolerance. Machine precision of it is 0.
81 * \param resid Optional starting residual vector at input if info=1,
82 * otherwise a random one is used. Final residual vector on
84 * \param ncv Number of columns in matrix v.
85 * \param v N*NCV matrix. V contain the Lanczos basis vectors.
86 * \param ldv Leading dimension of v.
87 * \param iparam Integer array, size 11. Same contents as arpack.
88 * \param ipntr Integer array, size 11. Points to starting locations
89 * in the workd/workl arrays. Same contents as arpack.
90 * \param workd Double precision work array, length 3*n+4.
91 * Provide the same array for all calls, and don't touch it.
92 * IMPORTANT: This is 4 units larger than standard ARPACK!
93 * \param iwork Integer work array, size 80.
94 * Provide the same array for all calls, and don't touch it.
95 * IMPORTANT: New argument compared to standard ARPACK!
96 * \param workl Double precision work array, length lwork.
97 * \param lworkl Length of the work array workl. Must be at least ncv*(ncv+8)
98 * \param info Set info to 0 to use random initial residual vector,
99 * or to 1 if you provide a one. On output, info=0 means
100 * normal exit, 1 that max number of iterations was reached,
101 * and 3 that no shifts could be applied. Negative numbers
102 * correspond to errors in the arguments provided.
105 F77_FUNC(dsaupd, DSAUPD) (int * ido,
125 /*! \brief Get eigenvalues/vectors after Arnoldi iteration, double prec.
127 * See the ARPACK site for details. You must have finished the interative
128 * part with dsaupd() before calling this function.
130 * \param rvec 1 if you want eigenvectors, 0 if not.
131 * \param howmny 'A' if you want all nvec vectors, 'S' if you
132 * provide a subset selection in select[].
133 * \param select Integer array, dimension nev. Indices of the
134 * eigenvectors to calculate. Fortran code means we
135 * start counting on 1. This array must be given even in
136 * howmny is 'A'. (Arpack documentation is wrong on this).
137 * \param d Double precision array, length nev. Eigenvalues.
138 * \param z Double precision array, n*nev. Eigenvectors.
139 * \param ldz Leading dimension of z. Normally n.
140 * \param sigma Shift if iparam[6] is 3,4, or 5. Ignored otherwise.
141 * \param bmat Provide the same argument as you did to dsaupd()
142 * \param n Provide the same argument as you did to dsaupd()
143 * \param which Provide the same argument as you did to dsaupd()
144 * \param nev Provide the same argument as you did to dsaupd()
145 * \param tol Provide the same argument as you did to dsaupd()
146 * \param resid Provide the same argument as you did to dsaupd()
147 * The array must not be touched between the two function calls!
148 * \param ncv Provide the same argument as you did to dsaupd()
149 * \param v Provide the same argument as you did to dsaupd()
150 * The array must not be touched between the two function calls!
151 * \param ldv Provide the same argument as you did to dsaupd()
152 * \param iparam Provide the same argument as you did to dsaupd()
153 * The array must not be touched between the two function calls!
154 * \param ipntr Provide the same argument as you did to dsaupd()
155 * The array must not be touched between the two function calls!
156 * \param workd Provide the same argument as you did to dsaupd()
157 * The array must not be touched between the two function calls!
158 * \param workl Double precision work array, length lwork.
159 * The array must not be touched between the two function calls!
160 * \param lworkl Provide the same argument as you did to dsaupd()
161 * \param info Provide the same argument as you did to dsaupd()
164 F77_FUNC(dseupd, DSEUPD) (int * rvec,
191 /*! \brief Implicitly Restarted Arnoldi Iteration, single precision.
193 * Reverse communication interface for the Implicitly Restarted Arnoldi
194 * Iteration. For symmetric problems this reduces to a variant of the
195 * Lanczos method. See the ARPACK site for details.
197 * \param ido Reverse communication flag. Set to 0 first time.
198 * Upon return with ido=-1 or ido=1 you should calculate
199 * Y=A*X and recall the routine. Return with ido=2 means
200 * Y=B*X should be calculated. ipntr[0] is the pointer in
201 * workd for X, ipntr[1] is the index for Y.
202 * Return with ido=99 means it finished.
203 * \param bmat 'I' for standard eigenproblem, 'G' for generalized.
204 * \param n Order of eigenproblem.
205 * \param which Which eigenvalues to calculate. 'LA' for largest
206 * algebraic, 'SA' for smallest algebraic, 'LM' for largest
207 * magnitude, 'SM' for smallest magnitude, and finally
208 * 'BE' (both ends) to calculate half from each end of
210 * \param nev Number of eigenvalues to calculate. 0<nev<n.
211 * \param tol Tolerance. Machine precision of it is 0.
212 * \param resid Optional starting residual vector at input if info=1,
213 * otherwise a random one is used. Final residual vector on
215 * \param ncv Number of columns in matrix v.
216 * \param v N*NCV matrix. V contain the Lanczos basis vectors.
217 * \param ldv Leading dimension of v.
218 * \param iparam Integer array, size 11. Same contents as arpack.
219 * \param ipntr Integer array, size 11. Points to starting locations
220 * in the workd/workl arrays. Same contents as arpack.
221 * \param workd Single precision work array, length 3*n+4.
222 * Provide the same array for all calls, and don't touch it.
223 * IMPORTANT: This is 4 units larger than standard ARPACK!
224 * \param iwork Integer work array, size 80.
225 * Provide the same array for all calls, and don't touch it.
226 * IMPORTANT: New argument compared to standard ARPACK!
227 * \param workl Single precision work array, length lwork.
228 * \param lworkl Length of the work array workl. Must be at least ncv*(ncv+8)
229 * \param info Set info to 0 to use random initial residual vector,
230 * or to 1 if you provide a one. On output, info=0 means
231 * normal exit, 1 that max number of iterations was reached,
232 * and 3 that no shifts could be applied. Negative numbers
233 * correspond to errors in the arguments provided.
236 F77_FUNC(ssaupd, SSAUPD) (int * ido,
258 /*! \brief Get eigenvalues/vectors after Arnoldi iteration, single prec.
260 * See the ARPACK site for details. You must have finished the interative
261 * part with ssaupd() before calling this function.
263 * \param rvec 1 if you want eigenvectors, 0 if not.
264 * \param howmny 'A' if you want all nvec vectors, 'S' if you
265 * provide a subset selection in select[].
266 * \param select Integer array, dimension nev. Indices of the
267 * eigenvectors to calculate. Fortran code means we
268 * start counting on 1. This array must be given even in
269 * howmny is 'A'. (Arpack documentation is wrong on this).
270 * \param d Single precision array, length nev. Eigenvalues.
271 * \param z Single precision array, n*nev. Eigenvectors.
272 * \param ldz Leading dimension of z. Normally n.
273 * \param sigma Shift if iparam[6] is 3,4, or 5. Ignored otherwise.
274 * \param bmat Provide the same argument as you did to ssaupd()
275 * \param n Provide the same argument as you did to ssaupd()
276 * \param which Provide the same argument as you did to ssaupd()
277 * \param nev Provide the same argument as you did to ssaupd()
278 * \param tol Provide the same argument as you did to ssaupd()
279 * \param resid Provide the same argument as you did to ssaupd()
280 * The array must not be touched between the two function calls!
281 * \param ncv Provide the same argument as you did to ssaupd()
282 * \param v Provide the same argument as you did to ssaupd()
283 * The array must not be touched between the two function calls!
284 * \param ldv Provide the same argument as you did to ssaupd()
285 * \param iparam Provide the same argument as you did to ssaupd()
286 * The array must not be touched between the two function calls!
287 * \param ipntr Provide the same argument as you did to ssaupd()
288 * The array must not be touched between the two function calls!
289 * \param workd Provide the same argument as you did to ssaupd()
290 * The array must not be touched between the two function calls!
291 * \param workl Single precision work array, length lwork.
292 * The array must not be touched between the two function calls!
293 * \param lworkl Provide the same argument as you did to ssaupd()
294 * \param info Provide the same argument as you did to ssaupd()
297 F77_FUNC(sseupd, SSEUPD) (int * rvec,