Statistics
| Revision:

root / tmp / org.txm.statsengine.r.core.win32 / res / win32 / include / R_ext / BLAS.h @ 2486

History | View | Annotate | Download (15.5 kB)

1
/*
2
 *  R : A Computer Language for Statistical Data Analysis
3
 *  Copyright (C) 2003-12 The R Core Team.
4
 *
5
 *  This program is free software; you can redistribute it and/or modify
6
 *  it under the terms of the GNU Lesser General Public License as published by
7
 *  the Free Software Foundation; either version 2.1 of the License, or
8
 *  (at your option) any later version.
9
 *
10
 *  This program is distributed in the hope that it will be useful,
11
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
12
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13
 *  GNU Lesser General Public License for more details.
14
 *
15
 *  You should have received a copy of the GNU Lesser General Public License
16
 *  along with this program; if not, a copy is available at
17
 *  http://www.r-project.org/Licenses/
18
 */
19

    
20
/*
21
   C declarations of BLAS Fortran subroutines always available in R.
22

23
   Part of the API.
24

25
   R packages that use these should have PKG_LIBS in src/Makevars include 
26
   $(BLAS_LIBS) $(FLIBS)
27
 */
28

    
29
/* Part of the API */
30

    
31
#ifndef R_BLAS_H
32
#define R_BLAS_H
33

    
34
#include <R_ext/RS.h>                /* for F77_... */
35
#include <R_ext/Complex.h>        /* for Rcomplex */
36

    
37
#ifdef  __cplusplus
38
extern "C" {
39
#endif
40

    
41
// never defined in R itself.
42
#ifndef BLAS_extern
43
#define BLAS_extern extern
44
#endif
45

    
46
/* Double Precision Level 1 BLAS */
47

    
48
BLAS_extern double /* DASUM - sum of absolute values of a one-dimensional array */
49
F77_NAME(dasum)(const int *n, const double *dx, const int *incx);
50
BLAS_extern void   /* DAXPY - replace y by alpha*x + y */
51
F77_NAME(daxpy)(const int *n, const double *alpha,
52
                const double *dx, const int *incx,
53
                double *dy, const int *incy);
54
BLAS_extern void   /* DCOPY - copy x to y */
55
F77_NAME(dcopy)(const int *n, const double *dx, const int *incx,
56
                double *dy, const int *incy);
57
BLAS_extern double /* DDOT - inner product of x and y */
58
F77_NAME(ddot)(const int *n, const double *dx, const int *incx,
59
               const double *dy, const int *incy);
60
BLAS_extern double /* DNRM2 - 2-norm of a vector */
61
F77_NAME(dnrm2)(const int *n, const double *dx, const int *incx);
62
BLAS_extern void   /* DROT - apply a Given's rotation */
63
F77_NAME(drot)(const int *n, double *dx, const int *incx,
64
               double *dy, const int *incy, const double *c, const double *s);
65
BLAS_extern void   /* DROTG - generate a Given's rotation */
66
F77_NAME(drotg)(const double *a, const double *b, double *c, double *s);
67
BLAS_extern void   /* DROTM - apply a modified Given's rotation */
68
F77_NAME(drotm)(const int *n, double *dx, const int *incx,
69
                double *dy, const int *incy, const double *dparam);
70
BLAS_extern void   /* DROTMG - generate a modified Given's rotation */
71
F77_NAME(drotmg)(const double *dd1, const double *dd2, const double *dx1,
72
                 const double *dy1, double *param);
73
BLAS_extern void   /* DSCAL - scale a one-dimensional array */
74
F77_NAME(dscal)(const int *n, const double *alpha, double *dx, const int *incx);
75
BLAS_extern void   /* DSWAP - interchange one-dimensional arrays */
76
F77_NAME(dswap)(const int *n, double *dx, const int *incx,
77
                double *dy, const int *incy);
78
BLAS_extern int    /* IDAMAX - return the index of the element with max abs value */
79
F77_NAME(idamax)(const int *n, const double *dx, const int *incx);
80

    
81
/* Double Precision Level 2 BLAS */
82

    
83
/* DGBMV - perform one of the matrix-vector operations */
84
/* y := alpha*A*x + beta*y, or y := alpha*A'*x + beta*y, */
85
BLAS_extern void
86
F77_NAME(dgbmv)(const char *trans, const int *m, const int *n,
87
                const int *kl,const int *ku,
88
                const double *alpha, const double *a, const int *lda,
89
                const double *x, const int *incx,
90
                const double *beta, double *y, const int *incy);
91
/* DGEMV - perform one of the matrix-vector operations */
92
/* y := alpha*A*x + beta*y, or y := alpha*A'*x + beta*y,  */
93
BLAS_extern void
94
F77_NAME(dgemv)(const char *trans, const int *m, const int *n,
95
                const double *alpha, const double *a, const int *lda,
96
                const double *x, const int *incx, const double *beta,
97
                double *y, const int *incy);
98
/* DSBMV - perform the matrix-vector operation */
99
/* y := alpha*A*x + beta*y, */
100
BLAS_extern void
101
F77_NAME(dsbmv)(const char *uplo, const int *n, const int *k,
102
                const double *alpha, const double *a, const int *lda,
103
                const double *x, const int *incx,
104
                const double *beta, double *y, const int *incy);
105
/* DSPMV - perform the matrix-vector operation */
106
/* y := alpha*A*x + beta*y, */
107
BLAS_extern void
108
F77_NAME(dspmv)(const char *uplo, const int *n,
109
                const double *alpha, const double *ap,
110
                const double *x, const int *incx,
111
                const double *beta, double *y, const int *incy);
112

    
113
/* DSYMV - perform the matrix-vector operation */
114
/*  y := alpha*A*x + beta*y, */
115
BLAS_extern void
116
F77_NAME(dsymv)(const char *uplo, const int *n, const double *alpha,
117
                const double *a, const int *lda,
118
                const double *x, const int *incx,
119
                const double *beta, double *y, const int *incy);
120
/* DTBMV - perform one of the matrix-vector operations */
121
/* x := A*x, or x := A'*x, */
122
BLAS_extern void
123
F77_NAME(dtbmv)(const char *uplo, const char *trans,
124
                const char *diag, const int *n, const int *k,
125
                const double *a, const int *lda,
126
                double *x, const int *incx);
127
/* DTPMV - perform one of the matrix-vector operations */
128
/* x := A*x, or x := A'*x, */
129
BLAS_extern void
130
F77_NAME(dtpmv)(const char *uplo, const char *trans, const char *diag,
131
                const int *n, const double *ap,
132
                double *x, const int *incx);
133
/* DTRMV - perform one of the matrix-vector operations  */
134
/* x := A*x, or x := A'*x, */
135
BLAS_extern void
136
F77_NAME(dtrmv)(const char *uplo, const char *trans, const char *diag,
137
                const int *n, const double *a, const int *lda,
138
                double *x, const int *incx);
139
/* DTBSV - solve one of the systems of equations */
140
/* A*x = b, or A'*x = b, */
141
BLAS_extern void
142
F77_NAME(dtbsv)(const char *uplo, const char *trans,
143
                const char *diag, const int *n, const int *k,
144
                const double *a, const int *lda,
145
                double *x, const int *incx);
146
/* DTPSV - solve one of the systems of equations */
147
/* A*x = b, or A'*x = b, */
148
BLAS_extern void
149
F77_NAME(dtpsv)(const char *uplo, const char *trans,
150
                const char *diag, const int *n,
151
                const double *ap, double *x, const int *incx);
152
/* DTRSV - solve one of the systems of equations */
153
/* A*x = b, or A'*x = b, */
154
BLAS_extern void
155
F77_NAME(dtrsv)(const char *uplo, const char *trans,
156
                const char *diag, const int *n,
157
                const double *a, const int *lda,
158
                double *x, const int *incx);
159
/* DGER - perform the rank 1 operation   A := alpha*x*y' + A */
160
BLAS_extern void
161
F77_NAME(dger)(const int *m, const int *n, const double *alpha,
162
               const double *x, const int *incx,
163
               const double *y, const int *incy,
164
               double *a, const int *lda);
165
/* DSYR - perform the symmetric rank 1 operation A := alpha*x*x' + A */
166
BLAS_extern void
167
F77_NAME(dsyr)(const char *uplo, const int *n, const double *alpha,
168
               const double *x, const int *incx,
169
               double *a, const int *lda);
170
/* DSPR - perform the symmetric rank 1 operation A := alpha*x*x' + A */
171
BLAS_extern void
172
F77_NAME(dspr)(const char *uplo, const int *n, const double *alpha,
173
               const double *x, const int *incx, double *ap);
174
/* DSYR2 - perform the symmetric rank 2 operation */
175
/* A := alpha*x*y' + alpha*y*x' + A, */
176
BLAS_extern void
177
F77_NAME(dsyr2)(const char *uplo, const int *n, const double *alpha,
178
                const double *x, const int *incx,
179
                const double *y, const int *incy,
180
                double *a, const int *lda);
181
/* DSPR2 - perform the symmetric rank 2 operation */
182
/* A := alpha*x*y' + alpha*y*x' + A,  */
183
BLAS_extern void
184
F77_NAME(dspr2)(const char *uplo, const int *n, const double *alpha,
185
                const double *x, const int *incx,
186
                const double *y, const int *incy, double *ap);
187

    
188
/* Double Precision Level 3 BLAS */
189

    
190
/* DGEMM - perform one of the matrix-matrix operations    */
191
/* C := alpha*op( A )*op( B ) + beta*C */
192
BLAS_extern void
193
F77_NAME(dgemm)(const char *transa, const char *transb, const int *m,
194
                const int *n, const int *k, const double *alpha,
195
                const double *a, const int *lda,
196
                const double *b, const int *ldb,
197
                const double *beta, double *c, const int *ldc);
198
/* DTRSM - solve one of the matrix equations  */
199
/* op(A)*X = alpha*B, or  X*op(A) = alpha*B  */
200
BLAS_extern void
201
F77_NAME(dtrsm)(const char *side, const char *uplo,
202
                const char *transa, const char *diag,
203
                const int *m, const int *n, const double *alpha,
204
                const double *a, const int *lda,
205
                double *b, const int *ldb);
206
/* DTRMM - perform one of the matrix-matrix operations */
207
/* B := alpha*op( A )*B, or B := alpha*B*op( A ) */
208
BLAS_extern void
209
F77_NAME(dtrmm)(const char *side, const char *uplo, const char *transa,
210
                const char *diag, const int *m, const int *n,
211
                const double *alpha, const double *a, const int *lda,
212
                double *b, const int *ldb);
213
/* DSYMM - perform one of the matrix-matrix operations   */
214
/*  C := alpha*A*B + beta*C, */
215
BLAS_extern void
216
F77_NAME(dsymm)(const char *side, const char *uplo, const int *m,
217
                const int *n, const double *alpha,
218
                const double *a, const int *lda,
219
                const double *b, const int *ldb,
220
                const double *beta, double *c, const int *ldc);
221
/* DSYRK - perform one of the symmetric rank k operations */
222
/* C := alpha*A*A' + beta*C or C := alpha*A'*A + beta*C */
223
BLAS_extern void
224
F77_NAME(dsyrk)(const char *uplo, const char *trans,
225
                const int *n, const int *k,
226
                const double *alpha, const double *a, const int *lda,
227
                const double *beta, double *c, const int *ldc);
228
/* DSYR2K - perform one of the symmetric rank 2k operations */
229
/* C := alpha*A*B' + alpha*B*A' + beta*C or */
230
/* C := alpha*A'*B + alpha*B'*A + beta*C */
231
BLAS_extern void
232
F77_NAME(dsyr2k)(const char *uplo, const char *trans,
233
                 const int *n, const int *k,
234
                 const double *alpha, const double *a, const int *lda,
235
                 const double *b, const int *ldb,
236
                 const double *beta, double *c, const int *ldc);
237
/*
238
  LSAME is a LAPACK support routine, not part of BLAS
239
*/
240

    
241
/* Double complex BLAS routines added for 2.3.0 */
242
/* #ifdef HAVE_FORTRAN_DOUBLE_COMPLEX */
243
    BLAS_extern double
244
    F77_NAME(dcabs1)(double *z);
245
    BLAS_extern double
246
    F77_NAME(dzasum)(int *n, Rcomplex *zx, int *incx);
247
    BLAS_extern double
248
    F77_NAME(dznrm2)(int *n, Rcomplex *x, int *incx);
249
    BLAS_extern int
250
    F77_NAME(izamax)(int *n, Rcomplex *zx, int *incx);
251
    BLAS_extern void
252
    F77_NAME(zaxpy)(int *n, Rcomplex *za, Rcomplex *zx,
253
                    int *incx, Rcomplex *zy, int *incy);
254
    BLAS_extern void
255
    F77_NAME(zcopy)(int *n, Rcomplex *zx, int *incx,
256
                    Rcomplex *zy, int *incy);
257

    
258
    /* WARNING!  The next two return a value that may not be
259
       compatible between C and Fortran, and even if it is, this might
260
       not be the right translation to C.  Only use after
261
       configure-testing with your compilers.
262
     */
263
    BLAS_extern Rcomplex
264
    F77_NAME(zdotc)(int *n,
265
                    Rcomplex *zx, int *incx, Rcomplex *zy, int *incy);
266
    BLAS_extern Rcomplex
267
    F77_NAME(zdotu)(int *n,
268
                    Rcomplex *zx, int *incx, Rcomplex *zy, int *incy);
269

    
270
    BLAS_extern void
271
    F77_NAME(zdrot)(int *n, Rcomplex *zx, int *incx, Rcomplex *zy,
272
                int *incy, double *c, double *s);
273
    BLAS_extern void
274
    F77_NAME(zdscal)(int *n, double *da, Rcomplex *zx, int *incx);
275
    BLAS_extern void
276
    F77_NAME(zgbmv)(char *trans, int *m, int *n, int *kl,
277
                    int *ku, Rcomplex *alpha, Rcomplex *a, int *lda,
278
                    Rcomplex *x, int *incx, Rcomplex *beta, Rcomplex *y,
279
                    int *incy);
280
    BLAS_extern void
281
    F77_NAME(zgemm)(const char *transa, const char *transb, const int *m,
282
                    const int *n, const int *k, const Rcomplex *alpha,
283
                    const Rcomplex *a, const int *lda,
284
                    const Rcomplex *b, const int *ldb,
285
                    const Rcomplex *beta, Rcomplex *c, const int *ldc);
286
    BLAS_extern void
287
    F77_NAME(zgemv)(char *trans, int *m, int *n, Rcomplex *alpha,
288
                    Rcomplex *a, int *lda, Rcomplex *x, int *incx,
289
                    Rcomplex *beta, Rcomplex *y, int * incy);
290
    BLAS_extern void
291
    F77_NAME(zgerc)(int *m, int *n, Rcomplex *alpha, Rcomplex *x,
292
                    int *incx, Rcomplex *y, int *incy, Rcomplex *a, int *lda);
293
    BLAS_extern void
294
    F77_NAME(zgeru)(int *m, int *n, Rcomplex *alpha, Rcomplex *x,
295
                    int *incx, Rcomplex *y, int *incy, Rcomplex *a, int *lda);
296
    BLAS_extern void
297
    F77_NAME(zhbmv)(char *uplo, int *n, int *k, Rcomplex *alpha,
298
                    Rcomplex *a, int *lda, Rcomplex *x, int *incx,
299
                    Rcomplex *beta, Rcomplex *y, int *incy);
300
    BLAS_extern void
301
    F77_NAME(zhemm)(char *side, char *uplo, int *m, int *n,
302
                    Rcomplex *alpha, Rcomplex *a, int *lda, Rcomplex *b,
303
                    int *ldb, Rcomplex *beta, Rcomplex *c, int *ldc);
304
    BLAS_extern void
305
    F77_NAME(zhemv)(char *uplo, int *n, Rcomplex *alpha, Rcomplex *a,
306
                    int *lda, Rcomplex *x, int *incx, Rcomplex *beta,
307
                    Rcomplex *y, int *incy);
308
    BLAS_extern void
309
    F77_NAME(zher)(char *uplo, int *n, double *alpha, Rcomplex *x,
310
                   int *incx, Rcomplex *a, int *lda);
311
    BLAS_extern void
312
    F77_NAME(zher2)(char *uplo, int *n, Rcomplex *alpha, Rcomplex *x,
313
                    int *incx, Rcomplex *y, int *incy, Rcomplex *a, int *lda);
314
    BLAS_extern void
315
    F77_NAME(zher2k)(char *uplo, char *trans, int *n, int *k,
316
                     Rcomplex *alpha, Rcomplex *a, int *lda, Rcomplex *b,
317
                     int *ldb, double *beta, Rcomplex *c, int *ldc);
318
    BLAS_extern void
319
    F77_NAME(zherk)(char *uplo, char *trans, int *n, int *k,
320
                    double *alpha, Rcomplex *a, int *lda, double *beta,
321
                    Rcomplex *c, int *ldc);
322
    BLAS_extern void
323
    F77_NAME(zhpmv)(char *uplo, int *n, Rcomplex *alpha, Rcomplex *ap,
324
                    Rcomplex *x, int *incx, Rcomplex * beta, Rcomplex *y,
325
                    int *incy);
326
    BLAS_extern void
327
    F77_NAME(zhpr)(char *uplo, int *n, double *alpha,
328
                   Rcomplex *x, int *incx, Rcomplex *ap);
329
    BLAS_extern void
330
    F77_NAME(zhpr2)(char *uplo, int *n, Rcomplex *alpha, Rcomplex *x,
331
                    int *incx, Rcomplex *y, int *incy, Rcomplex *ap);
332
    BLAS_extern void
333
    F77_NAME(zrotg)(Rcomplex *ca, Rcomplex *cb, double *c, Rcomplex *s);
334
    BLAS_extern void
335
    F77_NAME(zscal)(int *n, Rcomplex *za, Rcomplex *zx, int *incx);
336
    BLAS_extern void
337
    F77_NAME(zswap)(int *n, Rcomplex *zx, int *incx, Rcomplex *zy, int *incy);
338
    BLAS_extern void
339
    F77_NAME(zsymm)(char *side, char *uplo, int *m, int *n,
340
                    Rcomplex *alpha, Rcomplex *a, int *lda, Rcomplex *b,
341
                    int *ldb, Rcomplex *beta, Rcomplex *c, int *ldc);
342
    BLAS_extern void
343
    F77_NAME(zsyr2k)(char *uplo, char *trans, int *n, int *k,
344
                     Rcomplex *alpha, Rcomplex *a, int *lda, Rcomplex *b,
345
                     int *ldb, Rcomplex *beta, Rcomplex *c, int *ldc);
346
    BLAS_extern void
347
    F77_NAME(zsyrk)(char *uplo, char *trans, int *n, int *k,
348
                    Rcomplex *alpha, Rcomplex *a, int *lda,
349
                    Rcomplex *beta, Rcomplex *c, int *ldc);
350
    BLAS_extern void
351
    F77_NAME(ztbmv)(char *uplo, char *trans, char *diag, int *n, int *k,
352
                    Rcomplex *a, int *lda, Rcomplex *x, int *incx);
353
    BLAS_extern void
354
    F77_NAME(ztbsv)(char *uplo, char *trans, char *diag, int *n, int *k,
355
                    Rcomplex *a, int *lda, Rcomplex *x, int *incx);
356
    BLAS_extern void
357
    F77_NAME(ztpmv)(char *uplo, char *trans, char *diag, int *n,
358
                    Rcomplex *ap, Rcomplex *x, int *incx);
359
    BLAS_extern void
360
    F77_NAME(ztpsv)(char *uplo, char *trans, char *diag, int *n,
361
                    Rcomplex *ap, Rcomplex *x, int *incx);
362
    BLAS_extern void
363
    F77_NAME(ztrmm)(char *side, char *uplo, char *transa, char *diag,
364
                    int *m, int *n, Rcomplex *alpha, Rcomplex *a,
365
                    int *lda, Rcomplex *b, int *ldb);
366
    BLAS_extern void
367
    F77_NAME(ztrmv)(char *uplo, char *trans, char *diag, int *n,
368
                    Rcomplex *a, int *lda, Rcomplex *x, int *incx);
369
    BLAS_extern void
370
    F77_NAME(ztrsm)(char *side, char *uplo, char *transa, char *diag,
371
                    int *m, int *n, Rcomplex *alpha, Rcomplex *a,
372
                    int *lda, Rcomplex *b, int *ldb);
373
    BLAS_extern void
374
    F77_NAME(ztrsv)(char *uplo, char *trans, char *diag, int *n,
375
                    Rcomplex *a, int *lda, Rcomplex *x, int *incx);
376
/* #endif */
377

    
378
#ifdef  __cplusplus
379
}
380
#endif
381

    
382
#endif /* R_BLAS_H */