54190c4a65795175499e9892e9f064622e994a97
[alexxy/gromacs.git] / src / gromacs / linearalgebra / gmx_blas.h
1 /*
2  *
3  *                This source code is part of
4  *
5  *                 G   R   O   M   A   C   S
6  *
7  *          GROningen MAchine for Chemical Simulations
8  *
9  * Written by David van der Spoel, Erik Lindahl, Berk Hess, and others.
10  * Copyright (c) 1991-2000, University of Groningen, The Netherlands.
11  * Copyright (c) 2001-2008, The GROMACS development team,
12  * check out http://www.gromacs.org for more information.
13
14  * This program is free software; you can redistribute it and/or
15  * modify it under the terms of the GNU General Public License
16  * as published by the Free Software Foundation; either version 2
17  * of the License, or (at your option) any later version.
18  *
19  * If you want to redistribute modifications, please consider that
20  * scientific software is very special. Version control is crucial -
21  * bugs must be traceable. We will be happy to consider code for
22  * inclusion in the official distribution, but derived work must not
23  * be called official GROMACS. Details are found in the README & COPYING
24  * files - if they are missing, get the official version at www.gromacs.org.
25  *
26  * To help us fund GROMACS development, we humbly ask that you cite
27  * the papers on the package - you can find them in the top README file.
28  *
29  * For more info, check our website at http://www.gromacs.org
30  *
31  * And Hey:
32  * Gallium Rubidium Oxygen Manganese Argon Carbon Silicon
33  */
34 /*! \internal \file
35  * \brief
36  * Header definitions for the standard BLAS library.
37  *
38  * This is the subset of BLAS routines used for the
39  * linear algebra operations in Gromacs.
40  * Do NOT use this for other purposes - we only provide this as a
41  * simple fallback/reference implementation when no optimized BLAS
42  * is present. If you need an implementation for your own code
43  * there are several much faster versions out there.
44  *
45  * All routines are compatible with the BLAS reference implementation,
46  * meaning they assume fortran-style matrix row/column organization.
47  *
48  * There is plenty of documentation for these routines available
49  * at http://www.netlib.org/blas , so there is no point in repeating
50  * it here.
51  */
52 #ifndef GMX_BLAS_H
53 #define GMX_BLAS_H
54
55 /*! \cond */
56
57 #ifdef HAVE_CONFIG_H
58 #include "config.h"
59 #endif
60
61 /* Suppress Cygwin compiler warnings from using newlib version of
62  * ctype.h */
63 #ifdef GMX_CYGWIN
64 #undef toupper
65 #endif
66
67 #ifdef __cplusplus
68 extern "C" {
69 #endif
70 #if 0
71 }
72 #endif
73
74 /* Double precision versions */
75 double
76     F77_FUNC(dasum, DASUM) (int *n, double *dx, int *incx);
77
78 void
79     F77_FUNC(daxpy, DAXPY) (int *n, double *da, double *dx, int *incx, double *dy, int *incy);
80
81 void
82     F77_FUNC(dcopy, DCOPY) (int *n, double *dx, int *incx, double *dy, int *incy);
83
84 double
85     F77_FUNC(ddot, DDOT) (int *n, double *dx, int *incx, double *dy, int *incy);
86
87 void
88     F77_FUNC(dgemm, DGEMM) (const char *transa, const char *transb, int *m, int *n, int *k,
89                             double *alpha, double *a, int *lda, double *b, int *ldb,
90                             double *beta, double *c, int *ldc);
91
92 void
93     F77_FUNC(dgemv, DGEMV) (const char *trans, int *m, int *n, double *alpha, double *a, int *lda,
94                             double *x, int *incx, double *beta, double *y, int *incy);
95
96 void
97     F77_FUNC(dger, DGER) (int *m, int *n, double *alpha, double *x, int *incx,
98                           double *y, int *incy, double *a, int *lda);
99
100 double
101     F77_FUNC(dnrm2, DNRM2) (int  *n, double *x, int *incx);
102
103 void
104     F77_FUNC(drot, DROT) (int *n, double *dx, int *incx,
105                           double *dy, int *incy, double *c, double *s);
106
107 void
108     F77_FUNC(dscal, DSCAL) (int *n, double *fact, double *dx, int *incx);
109
110 void
111     F77_FUNC(dswap, DSWAP) (int *n, double *dx, int *incx, double *dy, int *incy);
112
113 void
114     F77_FUNC(dsymv, DSYMV) (const char *uplo, int *n, double *alpha, double *a, int *lda,
115                             double *x, int *incx, double *beta, double *y, int *incy);
116
117 void
118     F77_FUNC(dsyr2, DSYR2) (const char *uplo, int *n, double *alpha, double *x, int *incx,
119                             double *y, int *incy, double *a, int *lda);
120
121 void
122     F77_FUNC(dsyr2k, DSYR2K) (const char *uplo, const char *trans, int *n, int *k, double *alpha, double *a,
123                               int *lda, double *b, int *ldb, double *beta, double *c, int *ldc);
124
125 void
126     F77_FUNC(dtrmm, DTRMM) (const char *side, const char *uplo, const char *transa, const char *diag, int *m, int *n,
127                             double *alpha, double *a, int *lda, double *b, int *ldb);
128
129 void
130     F77_FUNC(dtrmv, DTRMV) (const char *uplo, const char *trans, const char *diag, int *n,
131                             double *a, int *lda, double *x, int *incx);
132
133 void
134     F77_FUNC(dtrsm, DTRSM) (const char *side, const char *uplo, const char *transa, const char *diag, int *m, int *n,
135                             double *alpha, double *a, int *lda, double *b, int *ldb);
136
137 int
138     F77_FUNC(idamax, IDAMAX) (int *n, double *dx, int *incx);
139
140
141
142 /* Single precision versions */
143 float
144     F77_FUNC(sasum, SASUM) (int *n, float *dx, int *incx);
145
146 void
147     F77_FUNC(saxpy, SAXPY) (int *n, float *da, float *dx, int *incx, float *dy, int *incy);
148
149 void
150     F77_FUNC(scopy, SCOPY) (int *n, float *dx, int *incx, float *dy, int *incy);
151
152 float
153     F77_FUNC(sdot, SDOT) (int *n, float *dx, int *incx, float *dy, int *incy);
154
155 void
156     F77_FUNC(sgemm, SGEMM) (const char *transa, const char *transb, int *m, int *n, int *k,
157                             float *alpha, float *a, int *lda, float *b, int *ldb,
158                             float *beta, float *c, int *ldc);
159
160 void
161     F77_FUNC(sgemv, SGEMV) (const char *trans, int *m, int *n, float *alpha, float *a, int *lda,
162                             float *x, int *incx, float *beta, float *y, int *incy);
163
164 void
165     F77_FUNC(sger, SGER) (int *m, int *n, float *alpha, float *x, int *incx,
166                           float *y, int *incy, float *a, int *lda);
167
168 float
169     F77_FUNC(snrm2, SNRM2) (int  *n, float *x, int *incx);
170
171 void
172     F77_FUNC(srot, SROT) (int *n, float *dx, int *incx,
173                           float *dy, int *incy, float *c, float *s);
174
175 void
176     F77_FUNC(sscal, SSCAL) (int *n, float *fact, float *dx, int *incx);
177
178 void
179     F77_FUNC(sswap, SSWAP) (int *n, float *dx, int *incx, float *dy, int *incy);
180
181 void
182     F77_FUNC(ssymv, SSYMV) (const char *uplo, int *n, float *alpha, float *a, int *lda,
183                             float *x, int *incx, float *beta, float *y, int *incy);
184
185 void
186     F77_FUNC(ssyr2, SSYR2) (const char *uplo, int *n, float *alpha, float *x, int *incx,
187                             float *y, int *incy, float *a, int *lda);
188
189 void
190     F77_FUNC(ssyr2k, SSYR2K) (const char *uplo, const char *trans, int *n, int *k, float *alpha, float *a,
191                               int *lda, float *b, int *ldb, float *beta, float *c, int *ldc);
192
193 void
194     F77_FUNC(strmm, STRMM) (const char *side, const char *uplo, const char *transa, const char *diag, int *m, int *n,
195                             float *alpha, float *a, int *lda, float *b, int *ldb);
196
197 void
198     F77_FUNC(strmv, STRMV) (const char *uplo, const char *trans, const char *diag, int *n,
199                             float *a, int *lda, float *x, int *incx);
200
201 void
202     F77_FUNC(strsm, STRSM) (const char *side, const char *uplo, const char *transa, const char *diag, int *m, int *n,
203                             float *alpha, float *a, int *lda, float *b, int *ldb);
204
205 int
206     F77_FUNC(isamax, ISAMAX) (int *n, float *dx, int *incx);
207
208
209 #ifdef __cplusplus
210 }
211 #endif
212
213 /*! \endcond */
214
215 #endif /* GMX_BLAS_H */