| 23063 |
bates |
1 |
#ifndef R_BLAS_H
|
|
|
2 |
#define R_BLAS_H
|
|
|
3 |
/* C declarations of BLAS routines. R packages that use these should have */
|
|
|
4 |
/* src/Makevars declare PKG_LIBS = $(BLAS_LIBS) $(FLIBS) */
|
|
|
5 |
|
|
|
6 |
#include <R_ext/RS.h> /* for F77_... */
|
|
|
7 |
#include <R_ext/Complex.h> /* for Rcomplex */
|
|
|
8 |
|
|
|
9 |
#ifdef __cplusplus
|
|
|
10 |
extern "C" {
|
|
|
11 |
#endif
|
|
|
12 |
|
|
|
13 |
/* Double Precision Level 1 BLAS */
|
|
|
14 |
|
|
|
15 |
double /* DASUM - sum of absolute values of a one-dimensional array */
|
|
|
16 |
F77_NAME(dasum)(const int *n, const double *dx, const int *incx);
|
|
|
17 |
void /* DAXPY - replace y by alpha*x + y */
|
|
|
18 |
F77_NAME(daxpy)(const int *n, const double *alpha,
|
|
|
19 |
const double *dx, const int *incx,
|
|
|
20 |
double *dy, const int *incy);
|
|
|
21 |
void /* DCOPY - copy x to y */
|
|
|
22 |
F77_NAME(dcopy)(const int *n, const double *dx, const int *incx,
|
|
|
23 |
double *dy, const int *incy);
|
|
|
24 |
double /* DDOT - inner product of x and y */
|
|
|
25 |
F77_NAME(ddot)(const int *n, const double *dx, const int *incx,
|
|
|
26 |
const double *dy, const int *incy);
|
|
|
27 |
double /* DNRM2 - 2-norm of a vector */
|
|
|
28 |
F77_NAME(dnrm2)(const int *n, const double *dx, const int *incx);
|
|
|
29 |
void /* DROT - apply a Given's rotation */
|
|
|
30 |
F77_NAME(drot)(const int *n, double *dx, const int *incx,
|
|
|
31 |
double *dy, const int *incy, const double *c, const double *s);
|
|
|
32 |
void /* DROTG - generate a Given's rotation */
|
|
|
33 |
F77_NAME(drotg)(const double *a, const double *b, double *c, double *s);
|
|
|
34 |
void /* DSCAL - scale a one-dimensional array */
|
|
|
35 |
F77_NAME(dscal)(const int *n, const double *alpha, double *dx, const int *incx);
|
|
|
36 |
void /* DSWAP - interchange one-dimensional arrays */
|
|
|
37 |
F77_NAME(dswap)(const int *n, double *dx, const int *incx,
|
|
|
38 |
double *dy, const int *incy);
|
|
|
39 |
int /* IDAMAX - return the index of the element with max abs value */
|
|
|
40 |
F77_NAME(idamax)(const int *n, const double *dx, const int *incx);
|
|
|
41 |
|
|
|
42 |
/* Double Precision Level 2 BLAS */
|
|
|
43 |
|
|
|
44 |
/* DGBMV - perform one of the matrix-vector operations */
|
|
|
45 |
/* y := alpha*A*x + beta*y, or y := alpha*A'*x + beta*y, */
|
|
|
46 |
void
|
|
|
47 |
F77_NAME(dgbmv)(const char *trans, const int *m, const int *n,
|
|
|
48 |
const int *kl,const int *ku,
|
|
|
49 |
const double *alpha, const double *a, const int *lda,
|
|
|
50 |
const double *x, const int *incx,
|
|
|
51 |
const double *beta, double *y, const int *incy);
|
|
|
52 |
/* DGEMV - perform one of the matrix-vector operations */
|
|
|
53 |
/* y := alpha*A*x + beta*y, or y := alpha*A'*x + beta*y, */
|
|
|
54 |
void
|
|
|
55 |
F77_NAME(dgemv)(const char *trans, const int *m, const int *n,
|
|
|
56 |
const double *alpha, const double *a, const int *lda,
|
|
|
57 |
const double *x, const int *incx, const double *beta,
|
|
|
58 |
double *y, const int *incy);
|
|
|
59 |
/* DSBMV - perform the matrix-vector operation */
|
|
|
60 |
/* y := alpha*A*x + beta*y, */
|
|
|
61 |
void
|
|
|
62 |
F77_NAME(dsbmv)(const char *uplo, const int *n, const int *k,
|
|
|
63 |
const double *alpha, const double *a, const int *lda,
|
|
|
64 |
const double *x, const int *incx,
|
|
|
65 |
const double *beta, double *y, const int *incy);
|
|
|
66 |
/* DSPMV - perform the matrix-vector operation */
|
|
|
67 |
/* y := alpha*A*x + beta*y, */
|
|
|
68 |
void
|
|
|
69 |
F77_NAME(dspmv)(const char *uplo, const int *n,
|
|
|
70 |
const double *alpha, const double *ap,
|
|
|
71 |
const double *x, const int *incx,
|
|
|
72 |
const double *beta, double *y, const int *incy);
|
|
|
73 |
|
|
|
74 |
/* DSYMV - perform the matrix-vector operation */
|
|
|
75 |
/* y := alpha*A*x + beta*y, */
|
|
|
76 |
void
|
|
|
77 |
F77_NAME(dsymv)(const char *uplo, const int *n, const double *alpha,
|
|
|
78 |
const double *a, const int *lda,
|
|
|
79 |
const double *x, const int *incx,
|
|
|
80 |
const double *beta, double *y, const int *incy);
|
|
|
81 |
/* DTBMV - perform one of the matrix-vector operations */
|
|
|
82 |
/* x := A*x, or x := A'*x, */
|
|
|
83 |
void
|
|
|
84 |
F77_NAME(dtbmv)(const char *uplo, const char *trans,
|
|
|
85 |
const char *diag, const int *n, const int *k,
|
|
|
86 |
const double *a, const int *lda,
|
|
|
87 |
double *x, const int *incx);
|
|
|
88 |
/* DTPMV - perform one of the matrix-vector operations */
|
|
|
89 |
/* x := A*x, or x := A'*x, */
|
|
|
90 |
void
|
|
|
91 |
F77_NAME(dtpmv)(const char *uplo, const char *trans, const char *diag,
|
|
|
92 |
const int *n, const double *ap,
|
|
|
93 |
double *x, const int *incx);
|
|
|
94 |
/* DTRMV - perform one of the matrix-vector operations */
|
|
|
95 |
/* x := A*x, or x := A'*x, */
|
|
|
96 |
void
|
|
|
97 |
F77_NAME(dtrmv)(const char *uplo, const char *trans, const char *diag,
|
|
|
98 |
const int *n, const double *a, const int *lda,
|
|
|
99 |
double *x, const int *incx);
|
|
|
100 |
/* DTBSV - solve one of the systems of equations */
|
|
|
101 |
/* A*x = b, or A'*x = b, */
|
|
|
102 |
void
|
|
|
103 |
F77_NAME(dtbsv)(const char *uplo, const char *trans,
|
|
|
104 |
const char *diag, const int *n, const int *k,
|
|
|
105 |
const double *a, const int *lda,
|
|
|
106 |
double *x, const int *incx);
|
|
|
107 |
/* DTPSV - solve one of the systems of equations */
|
|
|
108 |
/* A*x = b, or A'*x = b, */
|
|
|
109 |
void
|
|
|
110 |
F77_NAME(dtpsv)(const char *uplo, const char *trans,
|
|
|
111 |
const char *diag, const int *n,
|
|
|
112 |
const double *ap, double *x, const int *incx);
|
|
|
113 |
/* DTRSV - solve one of the systems of equations */
|
|
|
114 |
/* A*x = b, or A'*x = b, */
|
|
|
115 |
void
|
|
|
116 |
F77_NAME(dtrsv)(const char *uplo, const char *trans,
|
|
|
117 |
const char *diag, const int *n,
|
|
|
118 |
const double *a, const int *lda,
|
|
|
119 |
double *x, const int *incx);
|
|
|
120 |
/* DGER - perform the rank 1 operation A := alpha*x*y' + A */
|
|
|
121 |
void
|
|
|
122 |
F77_NAME(dger)(const int *m, const int *n, const double *alpha,
|
|
|
123 |
double *x, const int *incx,
|
|
|
124 |
double *y, const int *incy,
|
|
|
125 |
double *a, const int *lda);
|
|
|
126 |
/* DSYR - perform the symmetric rank 1 operation A := alpha*x*x' + A */
|
|
|
127 |
void
|
|
|
128 |
F77_NAME(dsyr)(const char *uplo, const int *n, const double *alpha,
|
|
|
129 |
const double *x, const int *incx,
|
|
|
130 |
double *a, const int *lda);
|
|
|
131 |
/* DSPR - perform the symmetric rank 1 operation A := alpha*x*x' + A */
|
|
|
132 |
void
|
|
|
133 |
F77_NAME(dspr)(const char *uplo, const int *n, const double *alpha,
|
|
|
134 |
const double *x, const int *incx, double *ap);
|
|
|
135 |
/* DSYR2 - perform the symmetric rank 2 operation */
|
|
|
136 |
/* A := alpha*x*y' + alpha*y*x' + A, */
|
|
|
137 |
void
|
|
|
138 |
F77_NAME(dsyr2)(const char *uplo, const int *n, const double *alpha,
|
|
|
139 |
const double *x, const int *incx,
|
|
|
140 |
const double *y, const int *incy,
|
|
|
141 |
double *a, const int *lda);
|
|
|
142 |
/* DSPR2 - perform the symmetric rank 2 operation */
|
|
|
143 |
/* A := alpha*x*y' + alpha*y*x' + A, */
|
|
|
144 |
void
|
|
|
145 |
F77_NAME(dspr2)(const char *uplo, const int *n, const double *alpha,
|
|
|
146 |
const double *x, const int *incx,
|
|
|
147 |
const double *y, const int *incy, double *ap);
|
|
|
148 |
|
|
|
149 |
/* Double Precision Level 3 BLAS */
|
|
|
150 |
|
|
|
151 |
/* DGEMM - perform one of the matrix-matrix operations */
|
|
|
152 |
/* C := alpha*op( A )*op( B ) + beta*C */
|
|
|
153 |
void
|
|
|
154 |
F77_NAME(dgemm)(const char *transa, const char *transb, const int *m,
|
|
|
155 |
const int *n, const int *k, const double *alpha,
|
|
|
156 |
const double *a, const int *lda,
|
|
|
157 |
const double *b, const int *ldb,
|
|
|
158 |
const double *beta, double *c, const int *ldc);
|
|
|
159 |
/* DTRSM - solve one of the matrix equations */
|
|
|
160 |
/* op(A)*X = alpha*B, or X*op(A) = alpha*B */
|
|
|
161 |
void
|
|
|
162 |
F77_NAME(dtrsm)(const char *side, const char *uplo,
|
|
|
163 |
const char *transa, const char *diag,
|
|
|
164 |
const int *m, const int *n, const double *alpha,
|
|
|
165 |
const double *a, const int *lda,
|
|
|
166 |
double *b, const int *ldb);
|
|
|
167 |
/* DTRMM - perform one of the matrix-matrix operations */
|
|
|
168 |
/* B := alpha*op( A )*B, or B := alpha*B*op( A ) */
|
|
|
169 |
void
|
|
|
170 |
F77_NAME(dtrmm)(const char *side, const char *uplo, const char *transa,
|
|
|
171 |
const char *diag, const int *m, const int *n,
|
|
|
172 |
const double *alpha, const double *a, const int *lda,
|
|
|
173 |
double *b, const int *ldb);
|
|
|
174 |
/* DSYMM - perform one of the matrix-matrix operations */
|
|
|
175 |
/* C := alpha*A*B + beta*C, */
|
|
|
176 |
void
|
|
|
177 |
F77_NAME(dsymm)(const char *side, const char *uplo, const int *m,
|
|
|
178 |
const int *n, const double *alpha,
|
|
|
179 |
const double *a, const int *lda,
|
|
|
180 |
const double *b, const int *ldb,
|
|
|
181 |
const double *beta, double *c, const int *ldc);
|
|
|
182 |
/* DSYRK - perform one of the symmetric rank k operations */
|
|
|
183 |
/* C := alpha*A*A' + beta*C or C := alpha*A'*A + beta*C */
|
|
|
184 |
void
|
|
|
185 |
F77_NAME(dsyrk)(const char *uplo, const char *trans,
|
|
|
186 |
const int *n, const int *k,
|
|
|
187 |
const double *alpha, const double *a, const int *lda,
|
|
|
188 |
const double *beta, double *c, const int *ldc);
|
|
|
189 |
/* DSYR2K - perform one of the symmetric rank 2k operations */
|
|
|
190 |
/* C := alpha*A*B' + alpha*B*A' + beta*C or */
|
|
|
191 |
/* C := alpha*A'*B + alpha*B'*A + beta*C */
|
|
|
192 |
void
|
|
|
193 |
F77_NAME(dsyr2k)(const char *uplo, const char *trans,
|
|
|
194 |
const int *n, const int *k,
|
|
|
195 |
const double *alpha, const double *a, const int *lda,
|
|
|
196 |
const double *b, const int *ldb,
|
|
|
197 |
const double *beta, double *c, const int *ldc);
|
|
|
198 |
#ifdef __cplusplus
|
|
|
199 |
}
|
|
|
200 |
#endif
|
|
|
201 |
|
|
|
202 |
#endif /* R_BLAS_H */
|