Fix const qualifier for float complex routines

This commit is contained in:
Martin Köhler
2025-04-23 22:40:59 +02:00
parent 72df25ba80
commit dbc45f746f
12 changed files with 106 additions and 41 deletions
+11 -4
View File
@@ -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,
@@ -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
@@ -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)
{
@@ -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*));
}
+8 -3
View File
@@ -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,
@@ -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';
+9 -3
View File
@@ -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,
@@ -16,6 +18,7 @@ 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
@@ -23,8 +26,10 @@ void API_SUFFIX(cblas_cgerc)(const CBLAS_LAYOUT layout, const CBLAS_INT M, const
#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;
@@ -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);
+9 -4
View File
@@ -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,
@@ -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)
{
@@ -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';
+10 -4
View File
@@ -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,
@@ -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)
@@ -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';
+11 -3
View File
@@ -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,
@@ -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)
{
@@ -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
{
+12 -5
View File
@@ -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,
@@ -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)
{
@@ -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);
+1 -1
View File
@@ -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;
+11 -5
View File
@@ -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,
@@ -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)
{
@@ -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';
+10 -3
View File
@@ -7,6 +7,8 @@
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "cblas.h"
#include "cblas_f77.h"
void API_SUFFIX(cblas_chpr)(const CBLAS_LAYOUT layout, const CBLAS_UPLO Uplo,
@@ -23,16 +25,20 @@ void API_SUFFIX(cblas_chpr)(const CBLAS_LAYOUT layout, const CBLAS_UPLO Uplo,
#ifdef F77_INT
F77_INT F77_N=N, F77_incX=incX;
#else
CBLAS_INT incx = incX;
#define F77_N N
#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)
{
@@ -96,7 +102,8 @@ void API_SUFFIX(cblas_chpr)(const CBLAS_LAYOUT layout, const CBLAS_UPLO Uplo,
incx = 1;
#endif
}
else x = (float *) X;
else
memcpy(&x,&X,sizeof(float*));
F77_chpr(F77_UL, &F77_N, &alpha, x, &F77_incX, A);
+13 -5
View File
@@ -7,6 +7,7 @@
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "cblas.h"
#include "cblas_f77.h"
void API_SUFFIX(cblas_chpr2)(const CBLAS_LAYOUT layout, const CBLAS_UPLO Uplo,
@@ -24,18 +25,25 @@ void API_SUFFIX(cblas_chpr2)(const CBLAS_LAYOUT layout, const CBLAS_UPLO Uplo,
#ifdef F77_INT
F77_INT F77_N=N, F77_incX=incX, F77_incY=incY;
#else
CBLAS_INT incx = incX;
CBLAS_INT incy = incY;
#define F77_N N
#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)
{
@@ -128,8 +136,8 @@ void API_SUFFIX(cblas_chpr2)(const CBLAS_LAYOUT layout, const CBLAS_UPLO Uplo,
} else
{
x = (float *) X;
y = (void *) Y;
memcpy(&x,&X,sizeof(float*));
memcpy(&y,&Y,sizeof(float*));
}
F77_chpr2(F77_UL, &F77_N, alpha, y, &F77_incY, x, &F77_incX, Ap);
} else
+1 -1
View File
@@ -37,7 +37,7 @@ void API_SUFFIX(cblas_zher2k)(const CBLAS_LAYOUT layout, const CBLAS_UPLO Uplo,
extern int CBLAS_CallFromC;
extern int RowMajorStrg;
double ALPHA[2];
const double *alp=(double *)alpha;
const double *alp=(const double *)alpha;
CBLAS_CallFromC = 1;
RowMajorStrg = 0;