added lapack-3.6.0

This commit is contained in:
Werner Saar
2015-11-20 09:45:46 +01:00
parent 64db4576e6
commit 33e37d01b3
5831 changed files with 1607531 additions and 52 deletions

View File

@@ -0,0 +1,8 @@
add_executable(xexample1_CBLAS cblas_example1.c )
add_executable(xexample2_CBLAS cblas_example2.c )
target_link_libraries(xexample1_CBLAS cblas ${BLAS_LIBRARIES})
target_link_libraries(xexample2_CBLAS cblas ${BLAS_LIBRARIES})
add_test(example1_CBLAS ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/xexample1_CBLAS)
add_test(example2_CBLAS ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/xexample2_CBLAS)

View File

@@ -0,0 +1,14 @@
include ../../make.inc
all: example1 example2
example1:
$(CC) -c $(CFLAGS) -I../include cblas_example1.c
$(LOADER) -o cblas_ex1 cblas_example1.o $(CBLASLIB) $(BLASLIB)
example2:
$(CC) -c $(CFLAGS) -I../include cblas_example2.c
$(LOADER) -o cblas_ex2 cblas_example2.o $(CBLASLIB) $(BLASLIB)
cleanall:
rm -f *.o cblas_ex1 cblas_ex2

View File

@@ -0,0 +1,69 @@
/* cblas_example.c */
#include <stdio.h>
#include <stdlib.h>
#include "cblas.h"
int main ( )
{
CBLAS_LAYOUT Layout;
CBLAS_TRANSPOSE transa;
double *a, *x, *y;
double alpha, beta;
int m, n, lda, incx, incy, i;
Layout = CblasColMajor;
transa = CblasNoTrans;
m = 4; /* Size of Column ( the number of rows ) */
n = 4; /* Size of Row ( the number of columns ) */
lda = 4; /* Leading dimension of 5 * 4 matrix is 5 */
incx = 1;
incy = 1;
alpha = 1;
beta = 0;
a = (double *)malloc(sizeof(double)*m*n);
x = (double *)malloc(sizeof(double)*n);
y = (double *)malloc(sizeof(double)*n);
/* The elements of the first column */
a[0] = 1;
a[1] = 2;
a[2] = 3;
a[3] = 4;
/* The elements of the second column */
a[m] = 1;
a[m+1] = 1;
a[m+2] = 1;
a[m+3] = 1;
/* The elements of the third column */
a[m*2] = 3;
a[m*2+1] = 4;
a[m*2+2] = 5;
a[m*2+3] = 6;
/* The elements of the fourth column */
a[m*3] = 5;
a[m*3+1] = 6;
a[m*3+2] = 7;
a[m*3+3] = 8;
/* The elemetns of x and y */
x[0] = 1;
x[1] = 2;
x[2] = 1;
x[3] = 1;
y[0] = 0;
y[1] = 0;
y[2] = 0;
y[3] = 0;
cblas_dgemv( Layout, transa, m, n, alpha, a, lda, x, incx, beta,
y, incy );
/* Print y */
for( i = 0; i < n; i++ )
printf(" y%d = %f\n", i, y[i]);
free(a);
free(x);
free(y);
return 0;
}

View File

@@ -0,0 +1,72 @@
/* cblas_example2.c */
#include <stdio.h>
#include <stdlib.h>
#include "cblas.h"
#include "cblas_f77.h"
#define INVALID -1
int main (int argc, char **argv )
{
int rout=-1,info=0,m,n,k,lda,ldb,ldc;
double A[2] = {0.0,0.0},
B[2] = {0.0,0.0},
C[2] = {0.0,0.0},
ALPHA=0.0, BETA=0.0;
if (argc > 2){
rout = atoi(argv[1]);
info = atoi(argv[2]);
}
if (rout == 1) {
if (info==0) {
printf("Checking if cblas_dgemm fails on parameter 4\n");
cblas_dgemm( CblasRowMajor, CblasTrans, CblasNoTrans, INVALID, 0, 0,
ALPHA, A, 1, B, 1, BETA, C, 1 );
}
if (info==1) {
printf("Checking if cblas_dgemm fails on parameter 5\n");
cblas_dgemm( CblasRowMajor, CblasNoTrans, CblasTrans, 0, INVALID, 0,
ALPHA, A, 1, B, 1, BETA, C, 1 );
}
if (info==2) {
printf("Checking if cblas_dgemm fails on parameter 9\n");
cblas_dgemm( CblasRowMajor, CblasNoTrans, CblasNoTrans, 0, 0, 2,
ALPHA, A, 1, B, 1, BETA, C, 2 );
}
if (info==3) {
printf("Checking if cblas_dgemm fails on parameter 11\n");
cblas_dgemm( CblasRowMajor, CblasNoTrans, CblasNoTrans, 0, 2, 2,
ALPHA, A, 1, B, 1, BETA, C, 1 );
}
} else {
if (info==0) {
printf("Checking if F77_dgemm fails on parameter 3\n");
m=INVALID; n=0; k=0; lda=1; ldb=1; ldc=1;
F77_dgemm( "T", "N", &m, &n, &k,
&ALPHA, A, &lda, B, &ldb, &BETA, C, &ldc );
}
if (info==1) {
m=0; n=INVALID; k=0; lda=1; ldb=1; ldc=1;
printf("Checking if F77_dgemm fails on parameter 4\n");
F77_dgemm( "N", "T", &m, &n, &k,
&ALPHA, A, &lda, B, &ldb, &BETA, C, &ldc );
}
if (info==2) {
printf("Checking if F77_dgemm fails on parameter 8\n");
m=2; n=0; k=0; lda=1; ldb=1; ldc=2;
F77_dgemm( "N", "N" , &m, &n, &k,
&ALPHA, A, &lda, B, &ldb, &BETA, C, &ldc );
}
if (info==3) {
printf("Checking if F77_dgemm fails on parameter 10\n");
m=0; n=0; k=2; lda=1; ldb=1; ldc=1;
F77_dgemm( "N", "N" , &m, &n, &k,
&ALPHA, A, &lda, B, &ldb, &BETA, C, &ldc );
}
}
return 0;
}