Skip to content

Commit 79a37b2

Browse files
Merge pull request #721 from angsch/cblas
Fix 2 CBLAS issues
2 parents 7012e36 + a8028e9 commit 79a37b2

File tree

12 files changed

+177
-17
lines changed

12 files changed

+177
-17
lines changed

CBLAS/include/cblas.h

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -143,19 +143,13 @@ void cblas_zaxpy(const CBLAS_INT N, const void *alpha, const void *X,
143143
/*
144144
* Routines with S and D prefix only
145145
*/
146-
void cblas_srotg(float *a, float *b, float *c, float *s);
147146
void cblas_srotmg(float *d1, float *d2, float *b1, const float b2, float *P);
148-
void cblas_srot(const CBLAS_INT N, float *X, const CBLAS_INT incX,
149-
float *Y, const CBLAS_INT incY, const float c, const float s);
150147
void cblas_srotm(const CBLAS_INT N, float *X, const CBLAS_INT incX,
151-
float *Y, const CBLAS_INT incY, const float *P);
152-
153-
void cblas_drotg(double *a, double *b, double *c, double *s);
148+
float *Y, const CBLAS_INT incY, const float *P);
154149
void cblas_drotmg(double *d1, double *d2, double *b1, const double b2, double *P);
155-
void cblas_drot(const CBLAS_INT N, double *X, const CBLAS_INT incX,
156-
double *Y, const CBLAS_INT incY, const double c, const double s);
157150
void cblas_drotm(const CBLAS_INT N, double *X, const CBLAS_INT incX,
158-
double *Y, const CBLAS_INT incY, const double *P);
151+
double *Y, const CBLAS_INT incY, const double *P);
152+
159153

160154

161155
/*
@@ -168,6 +162,20 @@ void cblas_zscal(const CBLAS_INT N, const void *alpha, void *X, const CBLAS_INT
168162
void cblas_csscal(const CBLAS_INT N, const float alpha, void *X, const CBLAS_INT incX);
169163
void cblas_zdscal(const CBLAS_INT N, const double alpha, void *X, const CBLAS_INT incX);
170164

165+
void cblas_srotg(float *a, float *b, float *c, float *s);
166+
void cblas_drotg(double *a, double *b, double *c, double *s);
167+
void cblas_crotg(void *a, void *b, float *c, void *s);
168+
void cblas_zrotg(void *a, void *b, double *c, void *s);
169+
170+
void cblas_srot(const CBLAS_INT N, float *X, const CBLAS_INT incX,
171+
float *Y, const CBLAS_INT incY, const float c, const float s);
172+
void cblas_drot(const CBLAS_INT N, double *X, const CBLAS_INT incX,
173+
double *Y, const CBLAS_INT incY, const double c, const double s);
174+
void cblas_csrot(const CBLAS_INT N, void *X, const CBLAS_INT incX,
175+
void *Y, const CBLAS_INT incY, const float c, const float s);
176+
void cblas_zdrot(const CBLAS_INT N, void *X, const CBLAS_INT incX,
177+
void *Y, const CBLAS_INT incY, const double c, const double s);
178+
171179
/*
172180
* ===========================================================================
173181
* Prototypes for level 2 BLAS

CBLAS/include/cblas_f77.h

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,13 @@
9393
#define F77_dznrm2_sub_base F77_GLOBAL(dznrm2sub,DZNRM2SUB)
9494
#define F77_dzasum_sub_base F77_GLOBAL(dzasumsub,DZASUMSUB)
9595
#define F77_sdsdot_sub_base F77_GLOBAL(sdsdotsub,SDSDOTSUB)
96+
#define F77_crotg_base F77_GLOBAL(crotg, CROTG)
97+
#define F77_csrot_base F77_GLOBAL(csrot, CSROT)
98+
#define F77_zrotg_base F77_GLOBAL(zrotg, ZROTG)
99+
#define F77_zdrot_base F77_GLOBAL(zdrot, ZDROT)
100+
#define F77_scabs1_sub_base F77_GLOBAL(scabs1sub, SCABS1SUB)
101+
#define F77_dcabs1_sub_base F77_GLOBAL(dcabs1sub, DCABS1SUB)
102+
96103
/*
97104
* Level 2 BLAS
98105
*/
@@ -200,6 +207,7 @@
200207
* Level 1 Fortran variadic definitions
201208
*/
202209

210+
203211
/* Single Precision */
204212

205213
#define F77_srot(...) F77_srot_base(__VA_ARGS__)
@@ -215,6 +223,7 @@
215223
#define F77_snrm2_sub(...) F77_snrm2_sub_base(__VA_ARGS__)
216224
#define F77_sasum_sub(...) F77_sasum_sub_base(__VA_ARGS__)
217225
#define F77_isamax_sub(...) F77_isamax_sub_base(__VA_ARGS__)
226+
#define F77_scabs1_sub(...) F77_scabs1_sub_base(__VA_ARGS__)
218227

219228
/* Double Precision */
220229

@@ -232,9 +241,12 @@
232241
#define F77_dnrm2_sub(...) F77_dnrm2_sub_base(__VA_ARGS__)
233242
#define F77_dasum_sub(...) F77_dasum_sub_base(__VA_ARGS__)
234243
#define F77_idamax_sub(...) F77_idamax_sub_base(__VA_ARGS__)
244+
#define F77_dcabs1_sub(...) F77_dcabs1_sub_base(__VA_ARGS__)
235245

236246
/* Single Complex Precision */
237247

248+
#define F77_crotg(...) F77_crotg_base(__VA_ARGS__)
249+
#define F77_csrot(...) F77_csrot_base(__VA_ARGS__)
238250
#define F77_cswap(...) F77_cswap_base(__VA_ARGS__)
239251
#define F77_ccopy(...) F77_ccopy_base(__VA_ARGS__)
240252
#define F77_caxpy(...) F77_caxpy_base(__VA_ARGS__)
@@ -249,6 +261,8 @@
249261

250262
/* Double Complex Precision */
251263

264+
#define F77_zrotg(...) F77_zrotg_base(__VA_ARGS__)
265+
#define F77_zdrot(...) F77_zdrot_base(__VA_ARGS__)
252266
#define F77_zswap(...) F77_zswap_base(__VA_ARGS__)
253267
#define F77_zcopy(...) F77_zcopy_base(__VA_ARGS__)
254268
#define F77_zaxpy(...) F77_zaxpy_base(__VA_ARGS__)
@@ -579,6 +593,8 @@ void F77_xerbla_base(FCHAR, void *
579593

580594
/* Single Complex Precision */
581595

596+
void F77_crotg_base(void *, void *, float *, void *);
597+
void F77_csrot_base(FINT, void *X, FINT, void *, FINT, const float *, const float *);
582598
void F77_cswap_base( FINT, void *, FINT, void *, FINT);
583599
void F77_ccopy_base( FINT, const void *, FINT, void *, FINT);
584600
void F77_caxpy_base( FINT, const void *, const void *, FINT, void *, FINT);
@@ -590,9 +606,12 @@ void F77_xerbla_base(FCHAR, void *
590606
void F77_csscal_base( FINT, const float *, void *, FINT);
591607
void F77_scnrm2_sub_base( FINT, const void *, FINT, float *);
592608
void F77_scasum_sub_base( FINT, const void *, FINT, float *);
609+
void F77_scabs1_sub_base( const void *, float *);
593610

594611
/* Double Complex Precision */
595612

613+
void F77_zrotg_base(void *, void *, double *, void *);
614+
void F77_zdrot_base(FINT, void *X, FINT, void *, FINT, const double *, const double *);
596615
void F77_zswap_base( FINT, void *, FINT, void *, FINT);
597616
void F77_zcopy_base( FINT, const void *, FINT, void *, FINT);
598617
void F77_zaxpy_base( FINT, const void *, const void *, FINT, void *, FINT);
@@ -604,6 +623,7 @@ void F77_xerbla_base(FCHAR, void *
604623
void F77_dznrm2_sub_base( FINT, const void *, FINT, double *);
605624
void F77_dzasum_sub_base( FINT, const void *, FINT, double *);
606625
void F77_izamax_sub_base( FINT, const void *, FINT, FINT2);
626+
void F77_dcabs1_sub_base( const void *, double *);
607627

608628
/*
609629
* Level 2 Fortran Prototypes

CBLAS/src/CMakeLists.txt

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,15 +26,19 @@ set(DLEV1 cblas_drotg.c cblas_drotmg.c cblas_drot.c cblas_drotm.c
2626
dasumsub.f idamaxsub.f)
2727

2828
# Files for level 1 single precision complex
29-
set(CLEV1 cblas_cswap.c cblas_cscal.c cblas_csscal.c cblas_ccopy.c
29+
set(CLEV1 cblas_crotg.c cblas_csrot.c
30+
cblas_cswap.c cblas_cscal.c cblas_csscal.c cblas_ccopy.c
3031
cblas_caxpy.c cblas_cdotu_sub.c cblas_cdotc_sub.c
31-
cblas_icamax.c cdotcsub.f cdotusub.f icamaxsub.f)
32+
cblas_icamax.c cdotcsub.f cdotusub.f icamaxsub.f
33+
cblas_scabs1.c scabs1sub.f )
3234

3335
# Files for level 1 double precision complex
34-
set(ZLEV1 cblas_zswap.c cblas_zscal.c cblas_zdscal.c cblas_zcopy.c
36+
set(ZLEV1 cblas_zrotg.c cblas_zdrot.c
37+
cblas_zswap.c cblas_zscal.c cblas_zdscal.c cblas_zcopy.c
3538
cblas_zaxpy.c cblas_zdotu_sub.c cblas_zdotc_sub.c cblas_dznrm2.c
3639
cblas_dzasum.c cblas_izamax.c zdotcsub.f zdotusub.f
37-
dzasumsub.f dznrm2sub.f izamaxsub.f)
40+
dzasumsub.f dznrm2sub.f izamaxsub.f
41+
cblas_dcabs1.c dcabs1sub.f)
3842

3943
# Common files for level 1 single precision
4044
set(SCLEV1 cblas_scasum.c scasumsub.f cblas_scnrm2.c scnrm2sub.f)

CBLAS/src/Makefile

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,15 +36,19 @@ dlev1 = cblas_drotg.o cblas_drotmg.o cblas_drot.o cblas_drotm.o \
3636
dasumsub.o idamaxsub.o
3737

3838
# Files for level 1 single precision complex
39-
clev1 = cblas_cswap.o cblas_cscal.o cblas_csscal.o cblas_ccopy.o \
39+
clev1 = cblas_crotg.o cblas_csrot.o \
40+
cblas_cswap.o cblas_cscal.o cblas_csscal.o cblas_ccopy.o \
4041
cblas_caxpy.o cblas_cdotu_sub.o cblas_cdotc_sub.o \
41-
cblas_icamax.o cdotcsub.o cdotusub.o icamaxsub.o
42+
cblas_icamax.o cdotcsub.o cdotusub.o icamaxsub.o \
43+
cblas_scabs1.o scabs1sub.o
4244

4345
# Files for level 1 double precision complex
44-
zlev1 = cblas_zswap.o cblas_zscal.o cblas_zdscal.o cblas_zcopy.o \
46+
zlev1 = cblas_zrotg.o cblas_zdrot.o \
47+
cblas_zswap.o cblas_zscal.o cblas_zdscal.o cblas_zcopy.o \
4548
cblas_zaxpy.o cblas_zdotu_sub.o cblas_zdotc_sub.o cblas_dznrm2.o \
4649
cblas_dzasum.o cblas_izamax.o zdotcsub.o zdotusub.o \
47-
dzasumsub.o dznrm2sub.o izamaxsub.o
50+
dzasumsub.o dznrm2sub.o izamaxsub.o \
51+
cblas_dcabs1.o dcabs1sub.o
4852

4953
# Common files for level 1 single precision
5054
sclev1 = cblas_scasum.o scasumsub.o cblas_scnrm2.o scnrm2sub.o

CBLAS/src/cblas_crotg.c

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
/*
2+
* cblas_crotg.c
3+
*
4+
* The program is a C interface to crotg.
5+
*
6+
*/
7+
#include "cblas.h"
8+
#include "cblas_f77.h"
9+
void cblas_crotg(void *a, void *b, float *c, void *s)
10+
{
11+
F77_crotg(a,b,c,s);
12+
}
13+

CBLAS/src/cblas_csrot.c

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
/*
2+
* cblas_csrot.c
3+
*
4+
* The program is a C interface to csrot.
5+
*
6+
*/
7+
#include "cblas.h"
8+
#include "cblas_f77.h"
9+
void cblas_csrot(const CBLAS_INT N, void *X, const CBLAS_INT incX,
10+
void *Y, const CBLAS_INT incY, const float c, const float s)
11+
{
12+
#ifdef F77_INT
13+
F77_INT F77_N=N, F77_incX=incX, F77_incY=incY;
14+
#else
15+
#define F77_N N
16+
#define F77_incX incX
17+
#define F77_incY incY
18+
#endif
19+
F77_csrot(&F77_N, X, &F77_incX, Y, &F77_incY, &c, &s);
20+
return;
21+
}

CBLAS/src/cblas_dcabs1.c

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
/*
2+
* cblas_scabs1.c
3+
*
4+
* The program is a C interface to scabs1.
5+
*
6+
*/
7+
#include "cblas.h"
8+
#include "cblas_f77.h"
9+
double cblas_dcabs1(const void *c)
10+
{
11+
double cabs1 = 0.0;
12+
F77_dcabs1_sub(c, &cabs1);
13+
return cabs1;
14+
}
15+

CBLAS/src/cblas_scabs1.c

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
/*
2+
* cblas_scabs1.c
3+
*
4+
* The program is a C interface to scabs1.
5+
*
6+
*/
7+
#include "cblas.h"
8+
#include "cblas_f77.h"
9+
float cblas_scabs1(const void *c)
10+
{
11+
float cabs1 = 0.0;
12+
F77_scabs1_sub(c, &cabs1);
13+
return cabs1;
14+
}
15+

CBLAS/src/cblas_zdrot.c

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
/*
2+
* cblas_zdrot.c
3+
*
4+
* The program is a C interface to zdrot.
5+
*
6+
*/
7+
#include "cblas.h"
8+
#include "cblas_f77.h"
9+
void cblas_zdrot(const CBLAS_INT N, void *X, const CBLAS_INT incX,
10+
void *Y, const CBLAS_INT incY, const double c, const double s)
11+
{
12+
#ifdef F77_INT
13+
F77_INT F77_N=N, F77_incX=incX, F77_incY=incY;
14+
#else
15+
#define F77_N N
16+
#define F77_incX incX
17+
#define F77_incY incY
18+
#endif
19+
F77_zdrot(&F77_N, X, &F77_incX, Y, &F77_incY, &c, &s);
20+
return;
21+
}

CBLAS/src/cblas_zrotg.c

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
/*
2+
* cblas_zrotg.c
3+
*
4+
* The program is a C interface to zrotg.
5+
*
6+
*/
7+
#include "cblas.h"
8+
#include "cblas_f77.h"
9+
void cblas_zrotg(void *a, void *b, double *c, void *s)
10+
{
11+
F77_zrotg(a,b,c,s);
12+
}
13+

0 commit comments

Comments
 (0)