Skip to content

Commit 2c222f1

Browse files
authored
Modify complex CBLAS functions to take void pointers
Modify complex CBLAS functions to take void pointers instead of float or double arguments (to bring the prototypes in line with netlib and other implementations' cblas.h)
1 parent 66ac898 commit 2c222f1

31 files changed

+233
-76
lines changed

interface/asum.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,8 +68,12 @@ FLOATRET NAME(blasint *N, FLOAT *x, blasint *INCX){
6868
}
6969

7070
#else
71-
71+
#ifdef COMPLEX
72+
FLOAT CNAME(blasint n, void *vx, blasint incx){
73+
FLOAT *x = (FLOAT*) vx;
74+
#else
7275
FLOAT CNAME(blasint n, FLOAT *x, blasint incx){
76+
#endif
7377

7478
FLOAT ret;
7579

interface/copy.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,13 @@ void NAME(blasint *N, FLOAT *x, blasint *INCX, FLOAT *y, blasint *INCY){
5454

5555
#else
5656

57+
#ifdef COMPLEX
58+
void CNAME(blasint n, void *vx, blasint incx, void *vy, blasint incy){
59+
FLOAT *x = (FLOAT*) vx;
60+
FLOAT *y = (FLOAT*) vy;
61+
#else
5762
void CNAME(blasint n, FLOAT *x, blasint incx, FLOAT *y, blasint incy){
63+
#endif
5864

5965
PRINT_DEBUG_CNAME;
6066

interface/gemm.c

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -220,17 +220,22 @@ void CNAME(enum CBLAS_ORDER order, enum CBLAS_TRANSPOSE TransA, enum CBLAS_TRANS
220220
blasint m, blasint n, blasint k,
221221
#ifndef COMPLEX
222222
FLOAT alpha,
223-
#else
224-
FLOAT *alpha,
225-
#endif
226223
FLOAT *a, blasint lda,
227224
FLOAT *b, blasint ldb,
228-
#ifndef COMPLEX
229225
FLOAT beta,
226+
FLOAT *c, blasint ldc) {
230227
#else
231-
FLOAT *beta,
228+
void *valpha,
229+
void *va, blasint lda,
230+
void *vb, blasint ldb,
231+
void *vbeta,
232+
void *vc, blasint ldc) {
233+
FLOAT *alpha = (FLOAT*) valpha;
234+
FLOAT *beta = (FLOAT*) vbeta;
235+
FLOAT *a = (FLOAT*) va;
236+
FLOAT *b = (FLOAT*) vb;
237+
FLOAT *c = (FLOAT*) vc;
232238
#endif
233-
FLOAT *c, blasint ldc) {
234239

235240
blas_arg_t args;
236241
int transa, transb;

interface/imax.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,8 +146,12 @@ blasint NAME(blasint *N, FLOAT *x, blasint *INCX){
146146
}
147147

148148
#else
149-
149+
#ifdef COMPLEX
150+
CBLAS_INDEX CNAME(blasint n, void *vx, blasint incx){
151+
FLOAT *x = (FLOAT*) vx;
152+
#else
150153
CBLAS_INDEX CNAME(blasint n, FLOAT *x, blasint incx){
154+
#endif
151155

152156
CBLAS_INDEX ret;
153157

interface/nrm2.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,12 @@ FLOATRET NAME(blasint *N, FLOAT *x, blasint *INCX){
6969

7070
#else
7171

72+
#ifdef COMPLEX
73+
FLOAT CNAME(blasint n, void *vx, blasint incx){
74+
FLOAT *x = (FLOAT*) vx;
75+
#else
7276
FLOAT CNAME(blasint n, FLOAT *x, blasint incx){
77+
#endif
7378

7479
FLOAT ret;
7580

interface/symm.c

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -228,17 +228,22 @@ void CNAME(enum CBLAS_ORDER order, enum CBLAS_SIDE Side, enum CBLAS_UPLO Uplo,
228228
blasint m, blasint n,
229229
#ifndef COMPLEX
230230
FLOAT alpha,
231-
#else
232-
FLOAT *alpha,
233-
#endif
234231
FLOAT *a, blasint lda,
235232
FLOAT *b, blasint ldb,
236-
#ifndef COMPLEX
237233
FLOAT beta,
234+
FLOAT *c, blasint ldc) {
238235
#else
239-
FLOAT *beta,
236+
void *valpha,
237+
void *va, blasint lda,
238+
void *vb, blasint ldb,
239+
void *vbeta,
240+
void *vc, blasint ldc) {
241+
FLOAT *alpha = (FLOAT*) valpha;
242+
FLOAT *beta = (FLOAT*) vbeta;
243+
FLOAT *a = (FLOAT*) va;
244+
FLOAT *b = (FLOAT*) vb;
245+
FLOAT *c = (FLOAT*) vc;
240246
#endif
241-
FLOAT *c, blasint ldc) {
242247

243248
blas_arg_t args;
244249
int side, uplo;

interface/syr2k.c

Lines changed: 22 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -185,17 +185,34 @@ void CNAME(enum CBLAS_ORDER order, enum CBLAS_UPLO Uplo, enum CBLAS_TRANSPOSE Tr
185185
blasint n, blasint k,
186186
#ifndef COMPLEX
187187
FLOAT alpha,
188-
#else
189-
FLOAT *alpha,
190-
#endif
191188
FLOAT *a, blasint lda,
192189
FLOAT *b, blasint ldb,
190+
#else
191+
void *valpha,
192+
void *va, blasint lda,
193+
void *vb, blasint ldb,
194+
#endif
193195
#if !defined(COMPLEX) || defined(HEMM)
194196
FLOAT beta,
195197
#else
196-
FLOAT *beta,
198+
void *vbeta,
199+
#endif
200+
#ifndef COMPLEX
201+
FLOAT *c,
202+
#else
203+
void *vc,
204+
#endif
205+
blasint ldc) {
206+
207+
#ifdef COMPLEX
208+
FLOAT* alpha = (FLOAT*) valpha;
209+
#if !defined(HEMM)
210+
FLOAT* beta = (FLOAT*) vbeta;
211+
#endif
212+
FLOAT* a = (FLOAT*) va;
213+
FLOAT* b = (FLOAT*) vb;
214+
FLOAT* c = (FLOAT*) vc;
197215
#endif
198-
FLOAT *c, blasint ldc) {
199216

200217
blas_arg_t args;
201218
int uplo, trans;

interface/syrk.c

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -188,15 +188,32 @@ void CNAME(enum CBLAS_ORDER order, enum CBLAS_UPLO Uplo, enum CBLAS_TRANSPOSE Tr
188188
#if !defined(COMPLEX) || defined(HEMM)
189189
FLOAT alpha,
190190
#else
191-
FLOAT *alpha,
191+
void *valpha,
192192
#endif
193+
#if !defined(COMPLEX)
193194
FLOAT *a, blasint lda,
195+
#else
196+
void *va, blasint lda,
197+
#endif
194198
#if !defined(COMPLEX) || defined(HEMM)
195199
FLOAT beta,
196200
#else
197-
FLOAT *beta,
201+
void *vbeta,
198202
#endif
203+
#if !defined(COMPLEX)
199204
FLOAT *c, blasint ldc) {
205+
#else
206+
void *vc, blasint ldc) {
207+
#endif
208+
209+
#ifdef COMPLEX
210+
#if !defined(HEMM)
211+
FLOAT* alpha = (FLOAT*) valpha;
212+
FLOAT* beta = (FLOAT*) vbeta;
213+
#endif
214+
FLOAT* a = (FLOAT*) va;
215+
FLOAT* c = (FLOAT*) vc;
216+
#endif
200217

201218
blas_arg_t args;
202219
int uplo, trans;

interface/tpmv.c

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,10 +135,17 @@ void NAME(char *UPLO, char *TRANS, char *DIAG,
135135
}
136136

137137
#else
138-
138+
#ifndef COMPLEX
139139
void CNAME(enum CBLAS_ORDER order, enum CBLAS_UPLO Uplo,
140140
enum CBLAS_TRANSPOSE TransA, enum CBLAS_DIAG Diag,
141141
blasint n, FLOAT *a, FLOAT *x, blasint incx) {
142+
#else
143+
void CNAME(enum CBLAS_ORDER order, enum CBLAS_UPLO Uplo,
144+
enum CBLAS_TRANSPOSE TransA, enum CBLAS_DIAG Diag,
145+
blasint n, void *va, void *vx, blasint incx) {
146+
FLOAT *a = (FLOAT*) va;
147+
FLOAT *x = (FLOAT*) vx;
148+
#endif
142149

143150
int trans, uplo, unit;
144151
blasint info;

interface/trsm.c

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -210,11 +210,16 @@ void CNAME(enum CBLAS_ORDER order,
210210
blasint m, blasint n,
211211
#ifndef COMPLEX
212212
FLOAT alpha,
213-
#else
214-
FLOAT *alpha,
215-
#endif
216213
FLOAT *a, blasint lda,
217214
FLOAT *b, blasint ldb) {
215+
#else
216+
void *valpha,
217+
void *va, blasint lda,
218+
void *vb, blasint ldb) {
219+
FLOAT *alpha = (FLOAT*) valpha;
220+
FLOAT *a = (FLOAT*) va;
221+
FLOAT *b = (FLOAT*) vb;
222+
#endif
218223

219224
blas_arg_t args;
220225
int side, uplo, trans, unit;

0 commit comments

Comments
 (0)