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