2 * This file is part of the GROMACS molecular simulation package.
4 * Copyright (c) 1991-2000, University of Groningen, The Netherlands.
5 * Copyright (c) 2001-2008, The GROMACS development team.
6 * Copyright (c) 2012,2013,2014,2019, by the GROMACS development team, led by
7 * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
8 * and including many others, as listed in the AUTHORS file in the
9 * top-level source directory and at http://www.gromacs.org.
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.
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.
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.
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.
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.
39 * Header definitions for the standard LAPACK library.
41 * This is the subset of LAPACK routines used for the
42 * linear algebra operations in Gromacs. Most of the execution time
43 * will be spent in the BLAS routines, which you hopefully have an
44 * optimized version of. Gromacs includes reference implementations
45 * of both BLAS and LAPACK so it compiles everywhere, but you should
46 * really try to find a vendor or otherwise optimized version at least
47 * of BLAS for better performance.
49 * Do NOT use this code for other purposes - we only provide this as a
50 * simple fallback/reference implementation when no optimized BLAS
51 * is present. If you need an implementation for your own code
52 * there are several much faster versions out there.
54 * All routines are compatible with the LAPACK/BLAS reference implementations,
55 * meaning they assume fortran-style matrix row/column organization.
57 * There is plenty of documentation for these routines available
58 * at http://www.netlib.org/lapack , so there is no point in repeating
68 /* These are not required by this file, but by the internal LAPACK
69 * implementation. In principle, they could be included in each file
70 * that requires them, but this is simpler. Since the header is internal
71 * to the linearyalgebra/ module, the added complexity may not be worth it. */
72 #include "gromacs/utility/basedefinitions.h"
73 #include "gromacs/utility/real.h"
82 /* Double precision */
84 void F77_FUNC(dbdsdc, DBDSDC)(const char* uplo,
99 void F77_FUNC(dgetf2, DGETF2)(int* m, int* n, double* a, int* lda, int* ipiv, int* info);
101 void F77_FUNC(dlamrg, DLAMRG)(int* n1, int* n2, double* a, int* dtrd1, int* dtrd2, int* index);
103 void F77_FUNC(dlarnv, DLARNV)(int* idist, int* iseed, int* n, double* x);
105 void F77_FUNC(dlasd0, DLASD0)(int* n,
118 void F77_FUNC(dlasda, DLASDA)(int* icompq,
143 void F77_FUNC(dlasq6, DLASQ6)(int* i0,
154 void F77_FUNC(dorgl2,
155 DORGL2)(int* m, int* n, int* k, double* a, int* lda, double* tau, double* work, int* info);
157 void F77_FUNC(dbdsqr, DBDSQR)(const char* uplo,
173 void F77_FUNC(dgetrf, DGETRF)(int* m, int* n, double* a, int* lda, int* ipiv, int* info);
175 void F77_FUNC(dgetri,
176 DGETRI)(int* n, double* a, int* lda, int* ipiv, double* work, int* lwork, int* info);
178 void F77_FUNC(dgetrs, DGETRS)(const char* trans,
188 void F77_FUNC(dtrtri,
189 DTRTRI)(const char* uplo, const char* diag, int* n, double* a, int* lda, int* info);
191 void F77_FUNC(dtrti2,
192 DTRTI2)(const char* uplo, const char* diag, int* n, double* a, int* lda, int* info);
194 double F77_FUNC(dlange, DLANGE)(const char* norm, int* m, int* n, double* a, int* lda, double* work);
196 void F77_FUNC(dlarrbx, DLARRBX)(int* n,
213 void F77_FUNC(dlasd1, DLASD1)(int* nl,
228 void F77_FUNC(dlasdq, DLASDQ)(const char* uplo,
245 void F77_FUNC(dlasr, DLASR)(const char* side,
255 void F77_FUNC(dorglq,
256 DORGLQ)(int* m, int* n, int* k, double* a, int* lda, double* tau, double* work, int* lwork, int* info);
258 void F77_FUNC(dormtr, DORMTR)(const char* side,
272 void F77_FUNC(dgebd2, DGEBD2)(int* m,
283 void F77_FUNC(dlabrd, DLABRD)(int* m,
297 double F77_FUNC(dlanst, DLANST)(const char* norm, int* n, double* d, double* e);
299 double F77_FUNC(dlansy,
300 DLANSY)(const char* norm, const char* uplo, int* n, double* a, int* lda, double* work);
302 void F77_FUNC(dlarrex, DLARREX)(const char* range,
322 void F77_FUNC(dlasd2, DLASD2)(int* nl,
346 void F77_FUNC(dlasdt, DLASDT)(int* n, int* lvl, int* nd, int* inode, int* ndiml, int* ndimr, int* msub);
348 void F77_FUNC(dlasrt, DLASRT)(const char* id, int* n, double* d, int* info);
350 void F77_FUNC(dlasrt2, DLASRT2)(const char* id, int* n, double* d, int* key, int* info);
352 void F77_FUNC(ilasrt2, ILASRT2)(const char* id, int* n, int* d, int* key, int* info);
354 void F77_FUNC(dorgqr,
355 DORGQR)(int* m, int* n, int* k, double* a, int* lda, double* tau, double* work, int* lwork, int* info);
357 void F77_FUNC(dstebz, DSTEBZ)(const char* range,
376 void F77_FUNC(dsteqr, DSTEQR)(const char* compz,
385 void F77_FUNC(dgebrd, DGEBRD)(int* m,
397 void F77_FUNC(dlacpy,
398 DLACPY)(const char* uplo, int* m, int* n, double* a, int* lda, double* b, int* ldb);
400 double F77_FUNC(dlapy2, DLAPY2)(double* x, double* y);
403 void F77_FUNC(dlarrfx, DLARRFX)(int* n,
417 void F77_FUNC(dlasd3, DLASD3)(int* nl,
438 void F77_FUNC(dlaset,
439 DLASET)(const char* uplo, int* m, int* n, double* alpha, double* beta, double* a, int* lda);
441 void F77_FUNC(dlassq, DLASSQ)(int* n, double* x, int* incx, double* scale, double* sumsq);
443 void F77_FUNC(dorm2l, DORM2L)(const char* side,
456 void F77_FUNC(dstegr, DSTEGR)(const char* jobz,
477 void F77_FUNC(ssteqr,
478 SSTEQR)(const char* compz, int* n, float* d__, float* e, float* z__, int* ldz, float* work, int* info);
480 void F77_FUNC(dgelq2, DGELQ2)(int* m, int* n, double* a, int* lda, double* tau, double* work, int* info);
482 void F77_FUNC(dlae2, DLAE2)(double* a, double* b, double* c, double* rt1, double* rt2);
484 void F77_FUNC(dlaev2,
485 DLAEV2)(double* a, double* b, double* c, double* rt1, double* rt2, double* cs1, double* cs2);
487 void F77_FUNC(dlar1vx, DLAR1VX)(int* n,
504 void F77_FUNC(dlarrvx, DLARRVX)(int* n,
521 void F77_FUNC(dlasd4, DLASD4)(int* n,
531 void F77_FUNC(dlasq1, DLASQ1)(int* n, double* d, double* e, double* work, int* info);
534 void F77_FUNC(dlasv2, DLASV2)(double* f,
544 void F77_FUNC(dorm2r, DORM2R)(const char* side,
557 void F77_FUNC(dstein, DSTEIN)(int* n,
571 void F77_FUNC(dgelqf,
572 DGELQF)(int* m, int* n, double* a, int* lda, double* tau, double* work, int* lwork, int* info);
574 void F77_FUNC(dlaebz, DLAEBZ)(int* ijob,
595 void F77_FUNC(dlarf, DLARF)(const char* side,
605 void F77_FUNC(dlartg, DLARTG)(double* f, double* g, double* cs, double* sn, double* r);
607 void F77_FUNC(dlasd5,
608 DLASD5)(int* i, double* d, double* z, double* delta, double* rho, double* dsigma, double* work);
610 void F77_FUNC(dlasq2, DLASQ2)(int* n, double* z, int* info);
612 void F77_FUNC(dlasq3, DLASQ3)(int* i0,
625 void F77_FUNC(dlaswp, DLASWP)(int* n, double* a, int* lda, int* k1, int* k2, int* ipiv, int* incx);
627 void F77_FUNC(dormbr, DORMBR)(const char* vect,
642 void F77_FUNC(dsterf, DSTERF)(int* n, double* d, double* e, int* info);
644 void F77_FUNC(dgeqr2, DGEQR2)(int* m, int* n, double* a, int* lda, double* tau, double* work, int* info);
646 void F77_FUNC(dlaed6, DLAED6)(int* kniter,
655 void F77_FUNC(dlarfb, DLARFB)(const char* side,
671 void F77_FUNC(dlaruv, DLARUV)(int* iseed, int* n, double* x);
673 void F77_FUNC(dlasd6, DLASD6)(int* icompq,
700 void F77_FUNC(dlatrd, DLATRD)(const char* uplo,
710 void F77_FUNC(dorml2, DORML2)(const char* side,
723 void F77_FUNC(dstevr, DSTEVR)(const char* jobz,
744 void F77_FUNC(dsytrd, DSYTRD)(const char* uplo,
755 void F77_FUNC(dsyevr, DSYEVR)(const char* jobz,
777 void F77_FUNC(dormql, DORMQL)(const char* side,
791 void F77_FUNC(dormqr, DORMQR)(const char* side,
805 void F77_FUNC(dorgbr, DORGBR)(const char* vect,
816 void F77_FUNC(dlasq5, DLASQ5)(int* i0,
829 void F77_FUNC(dlasd8, DLASD8)(int* icompq,
842 void F77_FUNC(dlascl, DLASCL)(const char* type,
853 void F77_FUNC(dlarft, DLARFT)(const char* direct,
863 void F77_FUNC(dlagts, DLAGTS)(int* job,
874 void F77_FUNC(dgesdd, DGESDD)(const char* jobz,
889 void F77_FUNC(dsytd2,
890 DSYTD2)(const char* uplo, int* n, double* a, int* lda, double* d, double* e, double* tau, int* info);
892 void F77_FUNC(dormlq, DORMLQ)(const char* side,
906 void F77_FUNC(dorg2r,
907 DORG2R)(int* m, int* n, int* k, double* a, int* lda, double* tau, double* work, int* info);
909 void F77_FUNC(dlasq4, DLASQ4)(int* i0,
923 void F77_FUNC(dlasd7, DLASD7)(int* icompq,
951 void F77_FUNC(dlas2, DLAS2)(double* f, double* g, double* h, double* ssmin, double* ssmax);
953 void F77_FUNC(dlarfg, DLARFG)(int* n, double* alpha, double* x, int* incx, double* tau);
955 void F77_FUNC(dlagtf, DLAGTF)(int* n,
965 void F77_FUNC(dgeqrf,
966 DGEQRF)(int* m, int* n, double* a, int* lda, double* tau, double* work, int* lwork, int* info);
969 /* Single precision */
971 void F77_FUNC(sbdsdc, SBDSDC)(const char* uplo,
986 void F77_FUNC(sgetf2, SGETF2)(int* m, int* n, float* a, int* lda, int* ipiv, int* info);
988 void F77_FUNC(slamrg, SLAMRG)(int* n1, int* n2, float* a, int* dtrd1, int* dtrd2, int* index);
990 void F77_FUNC(slarnv, SLARNV)(int* idist, int* iseed, int* n, float* x);
992 void F77_FUNC(slasd0, SLASD0)(int* n,
1005 void F77_FUNC(slasda, SLASDA)(int* icompq,
1030 void F77_FUNC(slasq6, SLASQ6)(int* i0,
1041 void F77_FUNC(sorgl2,
1042 SORGL2)(int* m, int* n, int* k, float* a, int* lda, float* tau, float* work, int* info);
1044 void F77_FUNC(sbdsqr, SBDSQR)(const char* uplo,
1060 void F77_FUNC(sgetrf, SGETRF)(int* m, int* n, float* a, int* lda, int* ipiv, int* info);
1062 void F77_FUNC(sgetri, SGETRI)(int* n, float* a, int* lda, int* ipiv, float* work, int* lwork, int* info);
1064 void F77_FUNC(sgetrs, SGETRS)(const char* trans,
1074 void F77_FUNC(strtri, STRTRI)(const char* uplo, const char* diag, int* n, float* a, int* lda, int* info);
1076 void F77_FUNC(strti2, STRTI2)(const char* uplo, const char* diag, int* n, float* a, int* lda, int* info);
1078 float F77_FUNC(slange, SLANGE)(const char* norm, int* m, int* n, float* a, int* lda, float* work);
1080 void F77_FUNC(slarrbx, SLARRBX)(int* n,
1097 void F77_FUNC(slasd1, SLASD1)(int* nl,
1112 void F77_FUNC(slasdq, SLASDQ)(const char* uplo,
1129 void F77_FUNC(slasr, SLASR)(const char* side,
1139 void F77_FUNC(sorglq,
1140 SORGLQ)(int* m, int* n, int* k, float* a, int* lda, float* tau, float* work, int* lwork, int* info);
1142 void F77_FUNC(sormtr, SORMTR)(const char* side,
1156 void F77_FUNC(sgebd2, SGEBD2)(int* m,
1167 void F77_FUNC(slabrd, SLABRD)(int* m,
1181 float F77_FUNC(slanst, SLANST)(const char* norm, int* n, float* d, float* e);
1183 float F77_FUNC(slansy,
1184 SLANSY)(const char* norm, const char* uplo, int* n, float* a, int* lda, float* work);
1186 void F77_FUNC(slarrex, SLARREX)(const char* range,
1206 void F77_FUNC(slasd2, SLASD2)(int* nl,
1230 void F77_FUNC(slasdt, SLASDT)(int* n, int* lvl, int* nd, int* inode, int* ndiml, int* ndimr, int* msub);
1232 void F77_FUNC(slasrt, SLASRT)(const char* id, int* n, float* d, int* info);
1234 void F77_FUNC(slasrt2, SLASRT2)(const char* id, int* n, float* d, int* key, int* info);
1236 void F77_FUNC(sorgqr,
1237 SORGQR)(int* m, int* n, int* k, float* a, int* lda, float* tau, float* work, int* lwork, int* info);
1239 void F77_FUNC(sstebz, SSTEBZ)(const char* range,
1258 void F77_FUNC(sgebrd, SGEBRD)(int* m,
1270 void F77_FUNC(slacpy, SLACPY)(const char* uplo, int* m, int* n, float* a, int* lda, float* b, int* ldb);
1272 float F77_FUNC(slapy2, SLAPY2)(float* x, float* y);
1274 void F77_FUNC(slarrfx, SLARRFX)(int* n,
1288 void F77_FUNC(slasd3, SLASD3)(int* nl,
1309 void F77_FUNC(slaset,
1310 SLASET)(const char* uplo, int* m, int* n, float* alpha, float* beta, float* a, int* lda);
1312 void F77_FUNC(slassq, SLASSQ)(int* n, float* x, int* incx, float* scale, float* sumsq);
1314 void F77_FUNC(sorm2l, SORM2L)(const char* side,
1327 void F77_FUNC(sstegr, SSTEGR)(const char* jobz,
1348 void F77_FUNC(sgelq2, SGELQ2)(int* m, int* n, float* a, int* lda, float* tau, float* work, int* info);
1350 void F77_FUNC(slae2, SLAE2)(float* a, float* b, float* c, float* rt1, float* rt2);
1352 void F77_FUNC(slaev2,
1353 SLAEV2)(float* a, float* b, float* c, float* rt1, float* rt2, float* cs1, float* cs2);
1355 void F77_FUNC(slar1vx, SLAR1VX)(int* n,
1372 void F77_FUNC(slarrvx, SLARRVX)(int* n,
1389 void F77_FUNC(slasd4, SLASD4)(int* n,
1399 void F77_FUNC(slasq1, SLASQ1)(int* n, float* d, float* e, float* work, int* info);
1402 void F77_FUNC(slasv2, SLASV2)(float* f,
1412 void F77_FUNC(sorm2r, SORM2R)(const char* side,
1425 void F77_FUNC(sstein, SSTEIN)(int* n,
1439 void F77_FUNC(sgelqf,
1440 SGELQF)(int* m, int* n, float* a, int* lda, float* tau, float* work, int* lwork, int* info);
1442 void F77_FUNC(slaebz, SLAEBZ)(int* ijob,
1463 void F77_FUNC(slarf,
1464 SLARF)(const char* side, int* m, int* n, float* v, int* incv, float* tau, float* c, int* ldc, float* work);
1466 void F77_FUNC(slartg, SLARTG)(float* f, float* g, float* cs, float* sn, float* r);
1468 void F77_FUNC(slasd5,
1469 SLASD5)(int* i, float* d, float* z, float* delta, float* rho, float* dsigma, float* work);
1471 void F77_FUNC(slasq2, SLASQ2)(int* n, float* z, int* info);
1473 void F77_FUNC(slasq3, SLASQ3)(int* i0,
1486 void F77_FUNC(slaswp, SLASWP)(int* n, float* a, int* lda, int* k1, int* k2, int* ipiv, int* incx);
1488 void F77_FUNC(sormbr, SORMBR)(const char* vect,
1503 void F77_FUNC(ssterf, SSTERF)(int* n, float* d, float* e, int* info);
1505 void F77_FUNC(sgeqr2, SGEQR2)(int* m, int* n, float* a, int* lda, float* tau, float* work, int* info);
1507 void F77_FUNC(slaed6,
1508 SLAED6)(int* kniter, int* orgati, float* rho, float* d, float* z, float* finit, float* tau, int* info);
1510 void F77_FUNC(slarfb, SLARFB)(const char* side,
1526 void F77_FUNC(slaruv, SLARUV)(int* iseed, int* n, float* x);
1528 void F77_FUNC(slasd6, SLASD6)(int* icompq,
1555 void F77_FUNC(slatrd,
1556 SLATRD)(const char* uplo, int* n, int* nb, float* a, int* lda, float* e, float* tau, float* w, int* ldw);
1558 void F77_FUNC(sorml2, SORML2)(const char* side,
1571 void F77_FUNC(sstevr, SSTEVR)(const char* jobz,
1592 void F77_FUNC(ssytrd, SSYTRD)(const char* uplo,
1603 void F77_FUNC(ssyevr, SSYEVR)(const char* jobz,
1625 void F77_FUNC(sormql, SORMQL)(const char* side,
1639 void F77_FUNC(sormqr, SORMQR)(const char* side,
1653 void F77_FUNC(sorgbr, SORGBR)(const char* vect,
1664 void F77_FUNC(slasq5, SLASQ5)(int* i0,
1677 void F77_FUNC(slasd8, SLASD8)(int* icompq,
1690 void F77_FUNC(slascl, SLASCL)(const char* type,
1701 void F77_FUNC(slarft, SLARFT)(const char* direct,
1711 void F77_FUNC(slagts,
1712 SLAGTS)(int* job, int* n, float* a, float* b, float* c, float* d, int* in, float* y, float* tol, int* info);
1714 void F77_FUNC(sgesdd, SGESDD)(const char* jobz,
1729 void F77_FUNC(ssytd2,
1730 SSYTD2)(const char* uplo, int* n, float* a, int* lda, float* d, float* e, float* tau, int* info);
1732 void F77_FUNC(sormlq, SORMLQ)(const char* side,
1746 void F77_FUNC(sorg2r,
1747 SORG2R)(int* m, int* n, int* k, float* a, int* lda, float* tau, float* work, int* info);
1749 void F77_FUNC(slasq4, SLASQ4)(int* i0,
1763 void F77_FUNC(slasd7, SLASD7)(int* icompq,
1791 void F77_FUNC(slas2, SLAS2)(float* f, float* g, float* h, float* ssmin, float* ssmax);
1793 void F77_FUNC(slarfg, SLARFG)(int* n, float* alpha, float* x, int* incx, float* tau);
1795 void F77_FUNC(slagtf,
1796 SLAGTF)(int* n, float* a, float* lambda, float* b, float* c, float* tol, float* d, int* in, int* info);
1798 void F77_FUNC(sgeqrf,
1799 SGEQRF)(int* m, int* n, float* a, int* lda, float* tau, float* work, int* lwork, int* info);
1808 #endif /* GMX_LAPACK_H */