Skip to content

Fix const qualifier warnings in CBLAS #1124

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion CBLAS/examples/cblas_example1_64.c
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ int main ( )
y, incy );
/* Print y */
for( i = 0; i < n; i++ )
printf(" y%" CBLAS_IFMT " = %f\n", i, y[i]);
printf(" y%d = %f\n", (int) i, y[i]);
free(a);
free(x);
free(y);
Expand Down
15 changes: 11 additions & 4 deletions CBLAS/src/cblas_cgbmv.c
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

#include "cblas.h"
#include "cblas_f77.h"
void API_SUFFIX(cblas_cgbmv)(const CBLAS_LAYOUT layout,
Expand All @@ -26,6 +28,7 @@ void API_SUFFIX(cblas_cgbmv)(const CBLAS_LAYOUT layout,
F77_INT F77_M=M, F77_N=N, F77_lda=lda, F77_incX=incX, F77_incY=incY;
F77_INT F77_KL=KL,F77_KU=KU;
#else
CBLAS_INT incx=incX;
#define F77_M M
#define F77_N N
#define F77_lda lda
Expand All @@ -34,15 +37,19 @@ void API_SUFFIX(cblas_cgbmv)(const CBLAS_LAYOUT layout,
#define F77_incX incx
#define F77_incY incY
#endif
CBLAS_INT n=0, i=0, incx=incX;
const float *xx= (float *)X, *alp= (float *)alpha, *bet = (float *)beta;
CBLAS_INT n=0, i=0;
const float *xx= (const float *)X, *alp= (const float *)alpha, *bet = (const float *)beta;
float ALPHA[2],BETA[2];
CBLAS_INT tincY, tincx;
float *x=(float *)X, *y=(float *)Y, *st=0, *tx=0;
float *x, *y, *st=0, *tx=0;
extern int CBLAS_CallFromC;
extern int RowMajorStrg;
RowMajorStrg = 0;

memcpy(&x, &X, sizeof(float*));
memcpy(&y, &Y, sizeof(float*));


CBLAS_CallFromC = 1;
if (layout == CblasColMajor)
{
Expand Down Expand Up @@ -125,7 +132,7 @@ void API_SUFFIX(cblas_cgbmv)(const CBLAS_LAYOUT layout,
y -= n;
}
}
else x = (float *) X;
else memcpy(&x, &X, sizeof(float*));


}
Expand Down
11 changes: 8 additions & 3 deletions CBLAS/src/cblas_cgemv.c
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "cblas.h"
#include "cblas_f77.h"
void API_SUFFIX(cblas_cgemv)(const CBLAS_LAYOUT layout,
Expand All @@ -31,18 +32,22 @@ void API_SUFFIX(cblas_cgemv)(const CBLAS_LAYOUT layout,
#define F77_incY incY
#endif

CBLAS_INT n=0, i=0, incx=incX;
CBLAS_INT n=0, i=0;
const float *xx= (const float *)X;
float ALPHA[2],BETA[2];
CBLAS_INT tincY, tincx;
float *x=(float *)X, *y=(float *)Y, *st=0, *tx=0;
const float *stx = x;
float *x, *y, *st=0, *tx=0;
extern int CBLAS_CallFromC;
extern int RowMajorStrg;
RowMajorStrg = 0;

CBLAS_CallFromC = 1;

memcpy(&x, &X, sizeof(float *));
memcpy(&y, &Y, sizeof(float *));

const float *stx = x;

if (layout == CblasColMajor)
{
if (TransA == CblasNoTrans) TA = 'N';
Expand Down
12 changes: 9 additions & 3 deletions CBLAS/src/cblas_cgerc.c
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

#include "cblas.h"
#include "cblas_f77.h"
void API_SUFFIX(cblas_cgerc)(const CBLAS_LAYOUT layout, const CBLAS_INT M, const CBLAS_INT N,
Expand All @@ -16,15 +18,18 @@ void API_SUFFIX(cblas_cgerc)(const CBLAS_LAYOUT layout, const CBLAS_INT M, const
#ifdef F77_INT
F77_INT F77_M=M, F77_N=N, F77_lda=lda, F77_incX=incX, F77_incY=incY;
#else
CBLAS_INT incy = incY;
#define F77_M M
#define F77_N N
#define F77_incX incX
#define F77_incY incy
#define F77_lda lda
#endif

CBLAS_INT n, i, tincy, incy=incY;
float *y=(float *)Y, *yy=(float *)Y, *ty, *st;
CBLAS_INT n, i, tincy;
float *y, *yy, *ty, *st;
memcpy(&y,&Y,sizeof(float*));
memcpy(&yy,&Y,sizeof(float*));

extern int CBLAS_CallFromC;
extern int RowMajorStrg;
Expand Down Expand Up @@ -70,7 +75,8 @@ void API_SUFFIX(cblas_cgerc)(const CBLAS_LAYOUT layout, const CBLAS_INT M, const
incy = 1;
#endif
}
else y = (float *) Y;
else
memcpy(&y,&Y,sizeof(float*));

F77_cgeru( &F77_N, &F77_M, alpha, y, &F77_incY, X, &F77_incX, A,
&F77_lda);
Expand Down
13 changes: 9 additions & 4 deletions CBLAS/src/cblas_chbmv.c
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
#include "cblas_f77.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
void API_SUFFIX(cblas_chbmv)(const CBLAS_LAYOUT layout,
const CBLAS_UPLO Uplo,const CBLAS_INT N,const CBLAS_INT K,
const void *alpha, const void *A, const CBLAS_INT lda,
Expand All @@ -24,21 +25,25 @@ void API_SUFFIX(cblas_chbmv)(const CBLAS_LAYOUT layout,
#ifdef F77_INT
F77_INT F77_N=N, F77_K=K, F77_lda=lda, F77_incX=incX, F77_incY=incY;
#else
CBLAS_INT incx = incX;
#define F77_N N
#define F77_K K
#define F77_lda lda
#define F77_incX incx
#define F77_incY incY
#endif
CBLAS_INT n, i=0, incx=incX;
const float *xx= (float *)X, *alp= (float *)alpha, *bet = (float *)beta;
CBLAS_INT n, i=0;
const float *xx= (const float *)X, *alp= (const float *)alpha, *bet = (const float *)beta;
float ALPHA[2],BETA[2];
CBLAS_INT tincY, tincx;
float *x=(float *)X, *y=(float *)Y, *st=0, *tx;
float *x, *y, *st=0, *tx;
extern int CBLAS_CallFromC;
extern int RowMajorStrg;
RowMajorStrg = 0;

memcpy(&x, &X, sizeof(float*));
memcpy(&y, &Y, sizeof(float*));

CBLAS_CallFromC = 1;
if (layout == CblasColMajor)
{
Expand Down Expand Up @@ -114,7 +119,7 @@ void API_SUFFIX(cblas_chbmv)(const CBLAS_LAYOUT layout,
} while(y != st);
y -= n;
} else
x = (float *) X;
memcpy(&x, &X, sizeof(float*));

if (Uplo == CblasUpper) UL = 'L';
else if (Uplo == CblasLower) UL = 'U';
Expand Down
14 changes: 10 additions & 4 deletions CBLAS/src/cblas_chemv.c
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

#include "cblas.h"
#include "cblas_f77.h"
void API_SUFFIX(cblas_chemv)(const CBLAS_LAYOUT layout,
Expand All @@ -24,20 +26,24 @@ void API_SUFFIX(cblas_chemv)(const CBLAS_LAYOUT layout,
#ifdef F77_INT
F77_INT F77_N=N, F77_lda=lda, F77_incX=incX, F77_incY=incY;
#else
CBLAS_INT incx = incX;
#define F77_N N
#define F77_lda lda
#define F77_incX incx
#define F77_incY incY
#endif
CBLAS_INT n=0, i=0, incx=incX;
const float *xx= (float *)X, *alp= (float *)alpha, *bet = (float *)beta;
CBLAS_INT n=0, i=0;
const float *xx= (const float *)X, *alp= (const float *)alpha, *bet = (const float *)beta;
float ALPHA[2],BETA[2];
CBLAS_INT tincY, tincx;
float *x=(float *)X, *y=(float *)Y, *st=0, *tx;
float *x, *y, *st=0, *tx;
extern int CBLAS_CallFromC;
extern int RowMajorStrg;
RowMajorStrg = 0;

memcpy(&x, &X, sizeof(float*));
memcpy(&y, &Y, sizeof(float*));


CBLAS_CallFromC = 1;
if (layout == CblasColMajor)
Expand Down Expand Up @@ -114,7 +120,7 @@ void API_SUFFIX(cblas_chemv)(const CBLAS_LAYOUT layout,
} while(y != st);
y -= n;
} else
x = (float *) X;
memcpy(&x, &X, sizeof(float*));


if (Uplo == CblasUpper) UL = 'L';
Expand Down
14 changes: 11 additions & 3 deletions CBLAS/src/cblas_cher.c
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "cblas.h"
#include "cblas_f77.h"
void API_SUFFIX(cblas_cher)(const CBLAS_LAYOUT layout, const CBLAS_UPLO Uplo,
Expand All @@ -23,17 +24,22 @@ void API_SUFFIX(cblas_cher)(const CBLAS_LAYOUT layout, const CBLAS_UPLO Uplo,
#ifdef F77_INT
F77_INT F77_N=N, F77_lda=lda, F77_incX=incX;
#else
CBLAS_INT incx;
#define F77_N N
#define F77_lda lda
#define F77_incX incx
#endif
CBLAS_INT n, i, tincx, incx=incX;
float *x=(float *)X, *xx=(float *)X, *tx, *st;
CBLAS_INT n, i, tincx;
float *x, *xx, *tx, *st;

extern int CBLAS_CallFromC;
extern int RowMajorStrg;
RowMajorStrg = 0;

memcpy(&x,&X,sizeof(float*));
memcpy(&xx,&X,sizeof(float*));


CBLAS_CallFromC = 1;
if (layout == CblasColMajor)
{
Expand Down Expand Up @@ -98,7 +104,9 @@ void API_SUFFIX(cblas_cher)(const CBLAS_LAYOUT layout, const CBLAS_UPLO Uplo,
incx = 1;
#endif
}
else x = (float *) X;
else
memcpy(&x,&X,sizeof(float*));

F77_cher(F77_UL, &F77_N, &alpha, x, &F77_incX, A, &F77_lda);
} else
{
Expand Down
17 changes: 12 additions & 5 deletions CBLAS/src/cblas_cher2.c
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "cblas.h"
#include "cblas_f77.h"
void API_SUFFIX(cblas_cher2)(const CBLAS_LAYOUT layout, const CBLAS_UPLO Uplo,
Expand All @@ -23,19 +24,25 @@ void API_SUFFIX(cblas_cher2)(const CBLAS_LAYOUT layout, const CBLAS_UPLO Uplo,
#ifdef F77_INT
F77_INT F77_N=N, F77_lda=lda, F77_incX=incX, F77_incY=incY;
#else
CBLAS_INT incx = incX, incy = incY;
#define F77_N N
#define F77_lda lda
#define F77_incX incx
#define F77_incY incy
#endif
CBLAS_INT n, i, j, tincx, tincy, incx=incX, incy=incY;
float *x=(float *)X, *xx=(float *)X, *y=(float *)Y,
*yy=(float *)Y, *tx, *ty, *stx, *sty;
CBLAS_INT n, i, j, tincx, tincy;
float *x, *xx, *y,
*yy, *tx, *ty, *stx, *sty;

extern int CBLAS_CallFromC;
extern int RowMajorStrg;
RowMajorStrg = 0;

memcpy(&x,&X,sizeof(float*));
memcpy(&xx,&X,sizeof(float*));
memcpy(&y,&Y,sizeof(float*));
memcpy(&yy,&Y,sizeof(float*));

CBLAS_CallFromC = 1;
if (layout == CblasColMajor)
{
Expand Down Expand Up @@ -129,8 +136,8 @@ void API_SUFFIX(cblas_cher2)(const CBLAS_LAYOUT layout, const CBLAS_UPLO Uplo,
#endif
} else
{
x = (float *) X;
y = (float *) Y;
memcpy(&x,&X,sizeof(float*));
memcpy(&y,&Y,sizeof(float*));
}
F77_cher2(F77_UL, &F77_N, alpha, y, &F77_incY, x,
&F77_incX, A, &F77_lda);
Expand Down
2 changes: 1 addition & 1 deletion CBLAS/src/cblas_cher2k.c
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ void API_SUFFIX(cblas_cher2k)(const CBLAS_LAYOUT layout, const CBLAS_UPLO Uplo,
extern int CBLAS_CallFromC;
extern int RowMajorStrg;
float ALPHA[2];
const float *alp=(float *)alpha;
const float *alp=(const float *)alpha;

CBLAS_CallFromC = 1;
RowMajorStrg = 0;
Expand Down
16 changes: 11 additions & 5 deletions CBLAS/src/cblas_chpmv.c
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

#include "cblas.h"
#include "cblas_f77.h"
void API_SUFFIX(cblas_chpmv)(const CBLAS_LAYOUT layout,
Expand All @@ -24,19 +26,24 @@ void API_SUFFIX(cblas_chpmv)(const CBLAS_LAYOUT layout,
#ifdef F77_INT
F77_INT F77_N=N, F77_incX=incX, F77_incY=incY;
#else
CBLAS_INT incx = incX;
#define F77_N N
#define F77_incX incx
#define F77_incY incY
#endif
CBLAS_INT n, i=0, incx=incX;
const float *xx= (float *)X, *alp= (float *)alpha, *bet = (float *)beta;
CBLAS_INT n, i=0;
const float *xx= (const float *)X, *alp= (const float *)alpha, *bet = (const float *)beta;
float ALPHA[2],BETA[2];
CBLAS_INT tincY, tincx;
float *x=(float *)X, *y=(float *)Y, *st=0, *tx;
float *x, *y, *st=0, *tx;
extern int CBLAS_CallFromC;
extern int RowMajorStrg;
RowMajorStrg = 0;

memcpy(&x,&X,sizeof(float*));
memcpy(&y,&Y,sizeof(float*));


CBLAS_CallFromC = 1;
if (layout == CblasColMajor)
{
Expand Down Expand Up @@ -112,8 +119,7 @@ void API_SUFFIX(cblas_chpmv)(const CBLAS_LAYOUT layout,
} while(y != st);
y -= n;
} else
x = (float *) X;

memcpy(&x,&X,sizeof(float*));

if (Uplo == CblasUpper) UL = 'L';
else if (Uplo == CblasLower) UL = 'U';
Expand Down
Loading