added C files in interface

This commit is contained in:
wernsaar 2014-05-10 21:27:47 +02:00
parent 0732238213
commit e265c4ec86
70 changed files with 13582 additions and 0 deletions

93
interface/asum.c Normal file
View File

@ -0,0 +1,93 @@
/*********************************************************************/
/* Copyright 2009, 2010 The University of Texas at Austin. */
/* All rights reserved. */
/* */
/* Redistribution and use in source and binary forms, with or */
/* without modification, are permitted provided that the following */
/* conditions are met: */
/* */
/* 1. Redistributions of source code must retain the above */
/* copyright notice, this list of conditions and the following */
/* disclaimer. */
/* */
/* 2. Redistributions in binary form must reproduce the above */
/* copyright notice, this list of conditions and the following */
/* disclaimer in the documentation and/or other materials */
/* provided with the distribution. */
/* */
/* THIS SOFTWARE IS PROVIDED BY THE UNIVERSITY OF TEXAS AT */
/* AUSTIN ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, */
/* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF */
/* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE */
/* DISCLAIMED. IN NO EVENT SHALL THE UNIVERSITY OF TEXAS AT */
/* AUSTIN OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, */
/* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES */
/* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE */
/* GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR */
/* BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF */
/* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT */
/* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT */
/* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE */
/* POSSIBILITY OF SUCH DAMAGE. */
/* */
/* The views and conclusions contained in the software and */
/* documentation are those of the authors and should not be */
/* interpreted as representing official policies, either expressed */
/* or implied, of The University of Texas at Austin. */
/*********************************************************************/
#include <stdio.h>
#include "common.h"
#ifdef FUNCTION_PROFILE
#include "functable.h"
#endif
#ifndef CBLAS
FLOATRET NAME(blasint *N, FLOAT *x, blasint *INCX){
BLASLONG n = *N;
BLASLONG incx = *INCX;
FLOATRET ret;
PRINT_DEBUG_NAME;
if (n <= 0) return 0;
IDEBUG_START;
FUNCTION_PROFILE_START();
ret = (FLOATRET)ASUM_K(n, x, incx);
FUNCTION_PROFILE_END(COMPSIZE, n, n);
IDEBUG_END;
return ret;
}
#else
FLOAT CNAME(blasint n, FLOAT *x, blasint incx){
FLOAT ret;
PRINT_DEBUG_CNAME;
if (n <= 0) return 0;
IDEBUG_START;
FUNCTION_PROFILE_START();
ret = ASUM_K(n, x, incx);
FUNCTION_PROFILE_END(COMPSIZE, n, n);
IDEBUG_END;
return ret;
}
#endif

121
interface/axpy.c Normal file
View File

@ -0,0 +1,121 @@
/*********************************************************************/
/* Copyright 2009, 2010 The University of Texas at Austin. */
/* All rights reserved. */
/* */
/* Redistribution and use in source and binary forms, with or */
/* without modification, are permitted provided that the following */
/* conditions are met: */
/* */
/* 1. Redistributions of source code must retain the above */
/* copyright notice, this list of conditions and the following */
/* disclaimer. */
/* */
/* 2. Redistributions in binary form must reproduce the above */
/* copyright notice, this list of conditions and the following */
/* disclaimer in the documentation and/or other materials */
/* provided with the distribution. */
/* */
/* THIS SOFTWARE IS PROVIDED BY THE UNIVERSITY OF TEXAS AT */
/* AUSTIN ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, */
/* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF */
/* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE */
/* DISCLAIMED. IN NO EVENT SHALL THE UNIVERSITY OF TEXAS AT */
/* AUSTIN OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, */
/* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES */
/* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE */
/* GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR */
/* BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF */
/* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT */
/* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT */
/* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE */
/* POSSIBILITY OF SUCH DAMAGE. */
/* */
/* The views and conclusions contained in the software and */
/* documentation are those of the authors and should not be */
/* interpreted as representing official policies, either expressed */
/* or implied, of The University of Texas at Austin. */
/*********************************************************************/
#include <stdio.h>
#include "common.h"
#ifdef FUNCTION_PROFILE
#include "functable.h"
#endif
#ifndef CBLAS
void NAME(blasint *N, FLOAT *ALPHA, FLOAT *x, blasint *INCX, FLOAT *y, blasint *INCY){
BLASLONG n = *N;
BLASLONG incx = *INCX;
BLASLONG incy = *INCY;
FLOAT alpha = *ALPHA;
#else
void CNAME(blasint n, FLOAT alpha, FLOAT *x, blasint incx, FLOAT *y, blasint incy){
#endif
#ifdef SMPTEST
int mode, nthreads;
#endif
#ifndef CBLAS
PRINT_DEBUG_NAME;
#else
PRINT_DEBUG_CNAME;
#endif
if (n <= 0) return;
if (alpha == ZERO) return;
IDEBUG_START;
FUNCTION_PROFILE_START();
if (incx < 0) x -= (n - 1) * incx;
if (incy < 0) y -= (n - 1) * incy;
#ifdef SMPTEST
nthreads = num_cpu_avail(1);
//disable multi-thread when incx==0 or incy==0
//In that case, the threads would be dependent.
if (incx == 0 || incy == 0)
nthreads = 1;
//Temporarily walk around the low performance issue with small imput size & multithreads.
if (n <= 10000)
nthreads = 1;
if (nthreads == 1) {
#endif
AXPYU_K(n, 0, 0, alpha, x, incx, y, incy, NULL, 0);
#ifdef SMPTEST
} else {
#ifdef XDOUBLE
mode = BLAS_XDOUBLE | BLAS_REAL;
#elif defined(DOUBLE)
mode = BLAS_DOUBLE | BLAS_REAL;
#else
mode = BLAS_SINGLE | BLAS_REAL;
#endif
blas_level1_thread(mode, n, 0, 0, &alpha,
x, incx, y, incy, NULL, 0, (void *)AXPYU_K, nthreads);
}
#endif
FUNCTION_PROFILE_END(1, 2 * n, 2 * n);
IDEBUG_END;
return;
}

80
interface/copy.c Normal file
View File

@ -0,0 +1,80 @@
/*********************************************************************/
/* Copyright 2009, 2010 The University of Texas at Austin. */
/* All rights reserved. */
/* */
/* Redistribution and use in source and binary forms, with or */
/* without modification, are permitted provided that the following */
/* conditions are met: */
/* */
/* 1. Redistributions of source code must retain the above */
/* copyright notice, this list of conditions and the following */
/* disclaimer. */
/* */
/* 2. Redistributions in binary form must reproduce the above */
/* copyright notice, this list of conditions and the following */
/* disclaimer in the documentation and/or other materials */
/* provided with the distribution. */
/* */
/* THIS SOFTWARE IS PROVIDED BY THE UNIVERSITY OF TEXAS AT */
/* AUSTIN ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, */
/* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF */
/* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE */
/* DISCLAIMED. IN NO EVENT SHALL THE UNIVERSITY OF TEXAS AT */
/* AUSTIN OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, */
/* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES */
/* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE */
/* GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR */
/* BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF */
/* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT */
/* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT */
/* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE */
/* POSSIBILITY OF SUCH DAMAGE. */
/* */
/* The views and conclusions contained in the software and */
/* documentation are those of the authors and should not be */
/* interpreted as representing official policies, either expressed */
/* or implied, of The University of Texas at Austin. */
/*********************************************************************/
#include <stdio.h>
#include "common.h"
#ifdef FUNCTION_PROFILE
#include "functable.h"
#endif
#ifndef CBLAS
void NAME(blasint *N, FLOAT *x, blasint *INCX, FLOAT *y, blasint *INCY){
BLASLONG n = *N;
BLASLONG incx = *INCX;
BLASLONG incy = *INCY;
PRINT_DEBUG_NAME;
#else
void CNAME(blasint n, FLOAT *x, blasint incx, FLOAT *y, blasint incy){
PRINT_DEBUG_CNAME;
#endif
if (n <= 0) return;
IDEBUG_START;
FUNCTION_PROFILE_START();
if (incx < 0) x -= (n - 1) * incx * COMPSIZE;
if (incy < 0) y -= (n - 1) * incy * COMPSIZE;
COPY_K(n, x, incx, y, incy);
FUNCTION_PROFILE_END(COMPSIZE, COMPSIZE * n, 0);
IDEBUG_END;
return;
}

101
interface/dot.c Normal file
View File

@ -0,0 +1,101 @@
/*********************************************************************/
/* Copyright 2009, 2010 The University of Texas at Austin. */
/* All rights reserved. */
/* */
/* Redistribution and use in source and binary forms, with or */
/* without modification, are permitted provided that the following */
/* conditions are met: */
/* */
/* 1. Redistributions of source code must retain the above */
/* copyright notice, this list of conditions and the following */
/* disclaimer. */
/* */
/* 2. Redistributions in binary form must reproduce the above */
/* copyright notice, this list of conditions and the following */
/* disclaimer in the documentation and/or other materials */
/* provided with the distribution. */
/* */
/* THIS SOFTWARE IS PROVIDED BY THE UNIVERSITY OF TEXAS AT */
/* AUSTIN ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, */
/* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF */
/* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE */
/* DISCLAIMED. IN NO EVENT SHALL THE UNIVERSITY OF TEXAS AT */
/* AUSTIN OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, */
/* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES */
/* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE */
/* GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR */
/* BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF */
/* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT */
/* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT */
/* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE */
/* POSSIBILITY OF SUCH DAMAGE. */
/* */
/* The views and conclusions contained in the software and */
/* documentation are those of the authors and should not be */
/* interpreted as representing official policies, either expressed */
/* or implied, of The University of Texas at Austin. */
/*********************************************************************/
#include <stdio.h>
#include "common.h"
#ifdef FUNCTION_PROFILE
#include "functable.h"
#endif
#ifndef CBLAS
FLOATRET NAME(blasint *N, FLOAT *x, blasint *INCX, FLOAT *y, blasint *INCY){
BLASLONG n = *N;
BLASLONG incx = *INCX;
BLASLONG incy = *INCY;
FLOATRET ret;
PRINT_DEBUG_NAME;
if (n <= 0) return 0.;
IDEBUG_START;
FUNCTION_PROFILE_START();
if (incx < 0) x -= (n - 1) * incx;
if (incy < 0) y -= (n - 1) * incy;
ret = (FLOATRET)DOTU_K(n, x, incx, y, incy);
FUNCTION_PROFILE_END(1, 2 * n, 2 * n);
IDEBUG_END;
return ret;
}
#else
FLOAT CNAME(blasint n, FLOAT *x, blasint incx, FLOAT *y, blasint incy){
FLOAT ret;
PRINT_DEBUG_CNAME;
if (n <= 0) return 0.;
IDEBUG_START;
FUNCTION_PROFILE_START();
if (incx < 0) x -= (n - 1) * incx;
if (incy < 0) y -= (n - 1) * incy;
ret = DOTU_K(n, x, incx, y, incy);
FUNCTION_PROFILE_END(1, 2 * n, 2 * n);
IDEBUG_END;
return ret;
}
#endif

102
interface/dsdot.c Normal file
View File

@ -0,0 +1,102 @@
/*********************************************************************/
/* Copyright 2009, 2010 The University of Texas at Austin. */
/* All rights reserved. */
/* */
/* Redistribution and use in source and binary forms, with or */
/* without modification, are permitted provided that the following */
/* conditions are met: */
/* */
/* 1. Redistributions of source code must retain the above */
/* copyright notice, this list of conditions and the following */
/* disclaimer. */
/* */
/* 2. Redistributions in binary form must reproduce the above */
/* copyright notice, this list of conditions and the following */
/* disclaimer in the documentation and/or other materials */
/* provided with the distribution. */
/* */
/* THIS SOFTWARE IS PROVIDED BY THE UNIVERSITY OF TEXAS AT */
/* AUSTIN ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, */
/* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF */
/* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE */
/* DISCLAIMED. IN NO EVENT SHALL THE UNIVERSITY OF TEXAS AT */
/* AUSTIN OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, */
/* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES */
/* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE */
/* GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR */
/* BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF */
/* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT */
/* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT */
/* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE */
/* POSSIBILITY OF SUCH DAMAGE. */
/* */
/* The views and conclusions contained in the software and */
/* documentation are those of the authors and should not be */
/* interpreted as representing official policies, either expressed */
/* or implied, of The University of Texas at Austin. */
/*********************************************************************/
#include <stdio.h>
#include "common.h"
#ifdef FUNCTION_PROFILE
#include "functable.h"
#endif
#ifndef CBLAS
double NAME(blasint *N, float *x, blasint *INCX, float *y, blasint *INCY){
BLASLONG n = *N;
BLASLONG incx = *INCX;
BLASLONG incy = *INCY;
double ret = 0.0;
PRINT_DEBUG_NAME;
if (n <= 0) return 0;
IDEBUG_START;
FUNCTION_PROFILE_START();
if (incx < 0) x -= (n - 1) * incx;
if (incy < 0) y -= (n - 1) * incy;
ret=DSDOT_K(n, x, incx, y, incy);
FUNCTION_PROFILE_END(1, n, n);
IDEBUG_END;
return ret;
}
#else
double CNAME(blasint n, float *x, blasint incx, float *y, blasint incy){
double ret = 0.0;
PRINT_DEBUG_CNAME;
if (n <= 0) return 0;
IDEBUG_START;
FUNCTION_PROFILE_START();
if (incx < 0) x -= (n - 1) * incx;
if (incy < 0) y -= (n - 1) * incy;
ret=DSDOT_K(n, x, incx, y, incy);
FUNCTION_PROFILE_END(1, n, n);
IDEBUG_END;
return ret;
}
#endif

252
interface/gbmv.c Normal file
View File

@ -0,0 +1,252 @@
/*********************************************************************/
/* Copyright 2009, 2010 The University of Texas at Austin. */
/* All rights reserved. */
/* */
/* Redistribution and use in source and binary forms, with or */
/* without modification, are permitted provided that the following */
/* conditions are met: */
/* */
/* 1. Redistributions of source code must retain the above */
/* copyright notice, this list of conditions and the following */
/* disclaimer. */
/* */
/* 2. Redistributions in binary form must reproduce the above */
/* copyright notice, this list of conditions and the following */
/* disclaimer in the documentation and/or other materials */
/* provided with the distribution. */
/* */
/* THIS SOFTWARE IS PROVIDED BY THE UNIVERSITY OF TEXAS AT */
/* AUSTIN ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, */
/* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF */
/* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE */
/* DISCLAIMED. IN NO EVENT SHALL THE UNIVERSITY OF TEXAS AT */
/* AUSTIN OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, */
/* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES */
/* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE */
/* GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR */
/* BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF */
/* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT */
/* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT */
/* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE */
/* POSSIBILITY OF SUCH DAMAGE. */
/* */
/* The views and conclusions contained in the software and */
/* documentation are those of the authors and should not be */
/* interpreted as representing official policies, either expressed */
/* or implied, of The University of Texas at Austin. */
/*********************************************************************/
#include <stdio.h>
#include "common.h"
#ifdef FUNCTION_PROFILE
#include "functable.h"
#endif
#ifdef XDOUBLE
#define ERROR_NAME "QGBMV "
#elif defined(DOUBLE)
#define ERROR_NAME "DGBMV "
#else
#define ERROR_NAME "SGBMV "
#endif
static void (*gbmv[])(BLASLONG, BLASLONG, BLASLONG, BLASLONG, FLOAT,
FLOAT *, BLASLONG, FLOAT *, BLASLONG, FLOAT *, BLASLONG, void *) = {
#ifdef XDOUBLE
qgbmv_n, qgbmv_t,
#elif defined(DOUBLE)
dgbmv_n, dgbmv_t,
#else
sgbmv_n, sgbmv_t,
#endif
};
#ifdef SMPTEST
static int (*gbmv_thread[])(BLASLONG, BLASLONG, BLASLONG, BLASLONG, FLOAT,
FLOAT *, BLASLONG, FLOAT *, BLASLONG, FLOAT *, BLASLONG, FLOAT *, int) = {
#ifdef XDOUBLE
qgbmv_thread_n, qgbmv_thread_t,
#elif defined(DOUBLE)
dgbmv_thread_n, dgbmv_thread_t,
#else
sgbmv_thread_n, sgbmv_thread_t,
#endif
};
#endif
#ifndef CBLAS
void NAME(char *TRANS, blasint *M, blasint *N,
blasint *KU, blasint *KL,
FLOAT *ALPHA, FLOAT *a, blasint *LDA,
FLOAT *x, blasint *INCX,
FLOAT *BETA, FLOAT *y, blasint *INCY){
char trans = *TRANS;
blasint m = *M;
blasint n = *N;
blasint ku = *KU;
blasint kl = *KL;
blasint lda = *LDA;
blasint incx = *INCX;
blasint incy = *INCY;
FLOAT *buffer;
#ifdef SMPTEST
int nthreads;
#endif
FLOAT alpha = *ALPHA;
FLOAT beta = *BETA;
blasint info;
blasint lenx, leny;
blasint i;
PRINT_DEBUG_NAME;
TOUPPER(trans);
info = 0;
i = -1;
if (trans == 'N') i = 0;
if (trans == 'T') i = 1;
if (trans == 'R') i = 0;
if (trans == 'C') i = 1;
if (incy == 0) info = 13;
if (incx == 0) info = 10;
if (lda < kl + ku + 1) info = 8;
if (kl < 0) info = 5;
if (ku < 0) info = 4;
if (n < 0) info = 3;
if (m < 0) info = 2;
if (i < 0) info = 1;
trans = i;
if (info != 0){
BLASFUNC(xerbla)(ERROR_NAME, &info, sizeof(ERROR_NAME));
return;
}
#else
void CNAME(enum CBLAS_ORDER order,
enum CBLAS_TRANSPOSE TransA,
blasint m, blasint n,
blasint ku, blasint kl,
FLOAT alpha,
FLOAT *a, blasint lda,
FLOAT *x, blasint incx,
FLOAT beta,
FLOAT *y, blasint incy){
FLOAT *buffer;
blasint lenx, leny, info, t;
int trans;
#ifdef SMPTEST
int nthreads;
#endif
PRINT_DEBUG_CNAME;
trans = -1;
info = 0;
if (order == CblasColMajor) {
if (TransA == CblasNoTrans) trans = 0;
if (TransA == CblasTrans) trans = 1;
if (TransA == CblasConjNoTrans) trans = 0;
if (TransA == CblasConjTrans) trans = 1;
info = -1;
if (incy == 0) info = 13;
if (incx == 0) info = 10;
if (lda < kl + ku + 1) info = 8;
if (kl < 0) info = 5;
if (ku < 0) info = 4;
if (n < 0) info = 3;
if (m < 0) info = 2;
if (trans < 0) info = 1;
}
if (order == CblasRowMajor) {
if (TransA == CblasNoTrans) trans = 1;
if (TransA == CblasTrans) trans = 0;
if (TransA == CblasConjNoTrans) trans = 1;
if (TransA == CblasConjTrans) trans = 0;
info = -1;
t = n;
n = m;
m = t;
t = ku;
ku = kl;
kl = t;
if (incy == 0) info = 13;
if (incx == 0) info = 10;
if (lda < kl + ku + 1) info = 8;
if (kl < 0) info = 5;
if (ku < 0) info = 4;
if (n < 0) info = 3;
if (m < 0) info = 2;
if (trans < 0) info = 1;
}
if (info >= 0) {
BLASFUNC(xerbla)(ERROR_NAME, &info, sizeof(ERROR_NAME));
return;
}
#endif
if ((m==0) || (n==0)) return;
lenx = n;
leny = m;
if (trans) lenx = m;
if (trans) leny = n;
if (beta != ONE) SCAL_K(leny, 0, 0, beta, y, abs(incy), NULL, 0, NULL, 0);
if (alpha == ZERO) return;
IDEBUG_START;
FUNCTION_PROFILE_START();
if (incx < 0) x -= (lenx-1)*incx;
if (incy < 0) y -= (leny-1)*incy;
buffer = (FLOAT *)blas_memory_alloc(1);
#ifdef SMPTEST
nthreads = num_cpu_avail(2);
if (nthreads == 1) {
#endif
(gbmv[(int)trans])(m, n, kl, ku, alpha, a, lda, x, incx, y, incy, buffer);
#ifdef SMPTEST
} else {
(gbmv_thread[(int)trans])(m, n, kl, ku, alpha, a, lda, x, incx, y, incy, buffer, nthreads);
}
#endif
blas_memory_free(buffer);
FUNCTION_PROFILE_END(1, m * n / 2 + n, m * n);
IDEBUG_END;
return;
}

461
interface/gemm.c Normal file
View File

@ -0,0 +1,461 @@
/*********************************************************************/
/* Copyright 2009, 2010 The University of Texas at Austin. */
/* All rights reserved. */
/* */
/* Redistribution and use in source and binary forms, with or */
/* without modification, are permitted provided that the following */
/* conditions are met: */
/* */
/* 1. Redistributions of source code must retain the above */
/* copyright notice, this list of conditions and the following */
/* disclaimer. */
/* */
/* 2. Redistributions in binary form must reproduce the above */
/* copyright notice, this list of conditions and the following */
/* disclaimer in the documentation and/or other materials */
/* provided with the distribution. */
/* */
/* THIS SOFTWARE IS PROVIDED BY THE UNIVERSITY OF TEXAS AT */
/* AUSTIN ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, */
/* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF */
/* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE */
/* DISCLAIMED. IN NO EVENT SHALL THE UNIVERSITY OF TEXAS AT */
/* AUSTIN OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, */
/* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES */
/* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE */
/* GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR */
/* BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF */
/* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT */
/* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT */
/* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE */
/* POSSIBILITY OF SUCH DAMAGE. */
/* */
/* The views and conclusions contained in the software and */
/* documentation are those of the authors and should not be */
/* interpreted as representing official policies, either expressed */
/* or implied, of The University of Texas at Austin. */
/*********************************************************************/
#include <stdio.h>
#include <stdlib.h>
#include "common.h"
#ifdef FUNCTION_PROFILE
#include "functable.h"
#endif
#ifndef COMPLEX
#ifdef XDOUBLE
#define ERROR_NAME "QGEMM "
#elif defined(DOUBLE)
#define ERROR_NAME "DGEMM "
#else
#define ERROR_NAME "SGEMM "
#endif
#else
#ifndef GEMM3M
#ifdef XDOUBLE
#define ERROR_NAME "XGEMM "
#elif defined(DOUBLE)
#define ERROR_NAME "ZGEMM "
#else
#define ERROR_NAME "CGEMM "
#endif
#else
#ifdef XDOUBLE
#define ERROR_NAME "XGEMM3M "
#elif defined(DOUBLE)
#define ERROR_NAME "ZGEMM3M "
#else
#define ERROR_NAME "CGEMM3M "
#endif
#endif
#endif
#ifndef GEMM_MULTITHREAD_THRESHOLD
# define GEMM_MULTITHREAD_THRESHOLD 4
#endif
static int (*gemm[])(blas_arg_t *, BLASLONG *, BLASLONG *, FLOAT *, FLOAT *, BLASLONG) = {
#ifndef GEMM3M
GEMM_NN, GEMM_TN, GEMM_RN, GEMM_CN,
GEMM_NT, GEMM_TT, GEMM_RT, GEMM_CT,
GEMM_NR, GEMM_TR, GEMM_RR, GEMM_CR,
GEMM_NC, GEMM_TC, GEMM_RC, GEMM_CC,
#if defined(SMPTEST) && !defined(USE_SIMPLE_THREADED_LEVEL3)
GEMM_THREAD_NN, GEMM_THREAD_TN, GEMM_THREAD_RN, GEMM_THREAD_CN,
GEMM_THREAD_NT, GEMM_THREAD_TT, GEMM_THREAD_RT, GEMM_THREAD_CT,
GEMM_THREAD_NR, GEMM_THREAD_TR, GEMM_THREAD_RR, GEMM_THREAD_CR,
GEMM_THREAD_NC, GEMM_THREAD_TC, GEMM_THREAD_RC, GEMM_THREAD_CC,
#endif
#else
GEMM3M_NN, GEMM3M_TN, GEMM3M_RN, GEMM3M_CN,
GEMM3M_NT, GEMM3M_TT, GEMM3M_RT, GEMM3M_CT,
GEMM3M_NR, GEMM3M_TR, GEMM3M_RR, GEMM3M_CR,
GEMM3M_NC, GEMM3M_TC, GEMM3M_RC, GEMM3M_CC,
#if defined(SMPTEST) && !defined(USE_SIMPLE_THREADED_LEVEL3)
GEMM3M_THREAD_NN, GEMM3M_THREAD_TN, GEMM3M_THREAD_RN, GEMM3M_THREAD_CN,
GEMM3M_THREAD_NT, GEMM3M_THREAD_TT, GEMM3M_THREAD_RT, GEMM3M_THREAD_CT,
GEMM3M_THREAD_NR, GEMM3M_THREAD_TR, GEMM3M_THREAD_RR, GEMM3M_THREAD_CR,
GEMM3M_THREAD_NC, GEMM3M_THREAD_TC, GEMM3M_THREAD_RC, GEMM3M_THREAD_CC,
#endif
#endif
};
#ifndef CBLAS
void NAME(char *TRANSA, char *TRANSB,
blasint *M, blasint *N, blasint *K,
FLOAT *alpha,
FLOAT *a, blasint *ldA,
FLOAT *b, blasint *ldB,
FLOAT *beta,
FLOAT *c, blasint *ldC){
blas_arg_t args;
int transa, transb, nrowa, nrowb;
blasint info;
char transA, transB;
FLOAT *buffer;
FLOAT *sa, *sb;
#ifdef SMPTEST
#ifndef COMPLEX
#ifdef XDOUBLE
int mode = BLAS_XDOUBLE | BLAS_REAL;
#elif defined(DOUBLE)
int mode = BLAS_DOUBLE | BLAS_REAL;
#else
int mode = BLAS_SINGLE | BLAS_REAL;
#endif
#else
#ifdef XDOUBLE
int mode = BLAS_XDOUBLE | BLAS_COMPLEX;
#elif defined(DOUBLE)
int mode = BLAS_DOUBLE | BLAS_COMPLEX;
#else
int mode = BLAS_SINGLE | BLAS_COMPLEX;
#endif
#endif
#endif
#if defined(SMPTEST) && !defined(NO_AFFINITY) && !defined(USE_SIMPLE_THREADED_LEVEL3)
int nodes;
#endif
PRINT_DEBUG_NAME;
args.m = *M;
args.n = *N;
args.k = *K;
args.a = (void *)a;
args.b = (void *)b;
args.c = (void *)c;
args.lda = *ldA;
args.ldb = *ldB;
args.ldc = *ldC;
args.alpha = (void *)alpha;
args.beta = (void *)beta;
transA = *TRANSA;
transB = *TRANSB;
TOUPPER(transA);
TOUPPER(transB);
transa = -1;
transb = -1;
if (transA == 'N') transa = 0;
if (transA == 'T') transa = 1;
#ifndef COMPLEX
if (transA == 'R') transa = 0;
if (transA == 'C') transa = 1;
#else
if (transA == 'R') transa = 2;
if (transA == 'C') transa = 3;
#endif
if (transB == 'N') transb = 0;
if (transB == 'T') transb = 1;
#ifndef COMPLEX
if (transB == 'R') transb = 0;
if (transB == 'C') transb = 1;
#else
if (transB == 'R') transb = 2;
if (transB == 'C') transb = 3;
#endif
nrowa = args.m;
if (transa & 1) nrowa = args.k;
nrowb = args.k;
if (transb & 1) nrowb = args.n;
info = 0;
if (args.ldc < args.m) info = 13;
if (args.ldb < nrowb) info = 10;
if (args.lda < nrowa) info = 8;
if (args.k < 0) info = 5;
if (args.n < 0) info = 4;
if (args.m < 0) info = 3;
if (transb < 0) info = 2;
if (transa < 0) info = 1;
if (info){
BLASFUNC(xerbla)(ERROR_NAME, &info, sizeof(ERROR_NAME));
return;
}
#else
void CNAME(enum CBLAS_ORDER order, enum CBLAS_TRANSPOSE TransA, enum CBLAS_TRANSPOSE TransB,
blasint m, blasint n, blasint k,
#ifndef COMPLEX
FLOAT alpha,
#else
FLOAT *alpha,
#endif
FLOAT *a, blasint lda,
FLOAT *b, blasint ldb,
#ifndef COMPLEX
FLOAT beta,
#else
FLOAT *beta,
#endif
FLOAT *c, blasint ldc) {
blas_arg_t args;
int transa, transb;
blasint nrowa, nrowb, info;
XFLOAT *buffer;
XFLOAT *sa, *sb;
#ifdef SMPTEST
#ifndef COMPLEX
#ifdef XDOUBLE
int mode = BLAS_XDOUBLE | BLAS_REAL;
#elif defined(DOUBLE)
int mode = BLAS_DOUBLE | BLAS_REAL;
#else
int mode = BLAS_SINGLE | BLAS_REAL;
#endif
#else
#ifdef XDOUBLE
int mode = BLAS_XDOUBLE | BLAS_COMPLEX;
#elif defined(DOUBLE)
int mode = BLAS_DOUBLE | BLAS_COMPLEX;
#else
int mode = BLAS_SINGLE | BLAS_COMPLEX;
#endif
#endif
#endif
#if defined(SMPTEST) && !defined(NO_AFFINITY) && !defined(USE_SIMPLE_THREADED_LEVEL3)
int nodes;
#endif
PRINT_DEBUG_CNAME;
#ifndef COMPLEX
args.alpha = (void *)&alpha;
args.beta = (void *)&beta;
#else
args.alpha = (void *)alpha;
args.beta = (void *)beta;
#endif
transa = -1;
transb = -1;
info = 0;
if (order == CblasColMajor) {
args.m = m;
args.n = n;
args.k = k;
args.a = (void *)a;
args.b = (void *)b;
args.c = (void *)c;
args.lda = lda;
args.ldb = ldb;
args.ldc = ldc;
if (TransA == CblasNoTrans) transa = 0;
if (TransA == CblasTrans) transa = 1;
#ifndef COMPLEX
if (TransA == CblasConjNoTrans) transa = 0;
if (TransA == CblasConjTrans) transa = 1;
#else
if (TransA == CblasConjNoTrans) transa = 2;
if (TransA == CblasConjTrans) transa = 3;
#endif
if (TransB == CblasNoTrans) transb = 0;
if (TransB == CblasTrans) transb = 1;
#ifndef COMPLEX
if (TransB == CblasConjNoTrans) transb = 0;
if (TransB == CblasConjTrans) transb = 1;
#else
if (TransB == CblasConjNoTrans) transb = 2;
if (TransB == CblasConjTrans) transb = 3;
#endif
nrowa = args.m;
if (transa & 1) nrowa = args.k;
nrowb = args.k;
if (transb & 1) nrowb = args.n;
info = -1;
if (args.ldc < args.m) info = 13;
if (args.ldb < nrowb) info = 10;
if (args.lda < nrowa) info = 8;
if (args.k < 0) info = 5;
if (args.n < 0) info = 4;
if (args.m < 0) info = 3;
if (transb < 0) info = 2;
if (transa < 0) info = 1;
}
if (order == CblasRowMajor) {
args.m = n;
args.n = m;
args.k = k;
args.a = (void *)b;
args.b = (void *)a;
args.c = (void *)c;
args.lda = ldb;
args.ldb = lda;
args.ldc = ldc;
if (TransB == CblasNoTrans) transa = 0;
if (TransB == CblasTrans) transa = 1;
#ifndef COMPLEX
if (TransB == CblasConjNoTrans) transa = 0;
if (TransB == CblasConjTrans) transa = 1;
#else
if (TransB == CblasConjNoTrans) transa = 2;
if (TransB == CblasConjTrans) transa = 3;
#endif
if (TransA == CblasNoTrans) transb = 0;
if (TransA == CblasTrans) transb = 1;
#ifndef COMPLEX
if (TransA == CblasConjNoTrans) transb = 0;
if (TransA == CblasConjTrans) transb = 1;
#else
if (TransA == CblasConjNoTrans) transb = 2;
if (TransA == CblasConjTrans) transb = 3;
#endif
nrowa = args.m;
if (transa & 1) nrowa = args.k;
nrowb = args.k;
if (transb & 1) nrowb = args.n;
info = -1;
if (args.ldc < args.m) info = 13;
if (args.ldb < nrowb) info = 10;
if (args.lda < nrowa) info = 8;
if (args.k < 0) info = 5;
if (args.n < 0) info = 4;
if (args.m < 0) info = 3;
if (transb < 0) info = 2;
if (transa < 0) info = 1;
}
if (info >= 0) {
BLASFUNC(xerbla)(ERROR_NAME, &info, sizeof(ERROR_NAME));
return;
}
#endif
if ((args.m == 0) || (args.n == 0)) return;
#if 0
fprintf(stderr, "m = %4d n = %d k = %d lda = %4d ldb = %4d ldc = %4d\n",
args.m, args.n, args.k, args.lda, args.ldb, args.ldc);
#endif
IDEBUG_START;
FUNCTION_PROFILE_START();
buffer = (XFLOAT *)blas_memory_alloc(0);
sa = (XFLOAT *)((BLASLONG)buffer +GEMM_OFFSET_A);
sb = (XFLOAT *)(((BLASLONG)sa + ((GEMM_P * GEMM_Q * COMPSIZE * SIZE + GEMM_ALIGN) & ~GEMM_ALIGN)) + GEMM_OFFSET_B);
#ifdef SMPTEST
mode |= (transa << BLAS_TRANSA_SHIFT);
mode |= (transb << BLAS_TRANSB_SHIFT);
args.common = NULL;
if(args.m <= GEMM_MULTITHREAD_THRESHOLD || args.n <= GEMM_MULTITHREAD_THRESHOLD
|| args.k <=GEMM_MULTITHREAD_THRESHOLD){
args.nthreads = 1;
}else{
args.nthreads = num_cpu_avail(3);
}
if (args.nthreads == 1) {
#endif
(gemm[(transb << 2) | transa])(&args, NULL, NULL, sa, sb, 0);
#ifdef SMPTEST
} else {
#ifndef USE_SIMPLE_THREADED_LEVEL3
#ifndef NO_AFFINITY
nodes = get_num_nodes();
if ((nodes > 1) && get_node_equal()) {
args.nthreads /= nodes;
gemm_thread_mn(mode, &args, NULL, NULL, gemm[16 | (transb << 2) | transa], sa, sb, nodes);
} else {
#endif
(gemm[16 | (transb << 2) | transa])(&args, NULL, NULL, sa, sb, 0);
#else
GEMM_THREAD(mode, &args, NULL, NULL, gemm[(transb << 2) | transa], sa, sb, args.nthreads);
#endif
#ifndef USE_SIMPLE_THREADED_LEVEL3
#ifndef NO_AFFINITY
}
#endif
#endif
#endif
#ifdef SMPTEST
}
#endif
blas_memory_free(buffer);
FUNCTION_PROFILE_END(COMPSIZE * COMPSIZE, args.m * args.k + args.k * args.n + args.m * args.n, 2 * args.m * args.n * args.k);
IDEBUG_END;
return;
}

237
interface/gemv.c Normal file
View File

@ -0,0 +1,237 @@
/*********************************************************************/
/* Copyright 2009, 2010 The University of Texas at Austin. */
/* All rights reserved. */
/* */
/* Redistribution and use in source and binary forms, with or */
/* without modification, are permitted provided that the following */
/* conditions are met: */
/* */
/* 1. Redistributions of source code must retain the above */
/* copyright notice, this list of conditions and the following */
/* disclaimer. */
/* */
/* 2. Redistributions in binary form must reproduce the above */
/* copyright notice, this list of conditions and the following */
/* disclaimer in the documentation and/or other materials */
/* provided with the distribution. */
/* */
/* THIS SOFTWARE IS PROVIDED BY THE UNIVERSITY OF TEXAS AT */
/* AUSTIN ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, */
/* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF */
/* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE */
/* DISCLAIMED. IN NO EVENT SHALL THE UNIVERSITY OF TEXAS AT */
/* AUSTIN OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, */
/* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES */
/* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE */
/* GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR */
/* BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF */
/* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT */
/* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT */
/* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE */
/* POSSIBILITY OF SUCH DAMAGE. */
/* */
/* The views and conclusions contained in the software and */
/* documentation are those of the authors and should not be */
/* interpreted as representing official policies, either expressed */
/* or implied, of The University of Texas at Austin. */
/*********************************************************************/
#include <stdio.h>
#include "common.h"
#ifdef FUNCTION_PROFILE
#include "functable.h"
#endif
#ifdef XDOUBLE
#define ERROR_NAME "QGEMV "
#elif defined(DOUBLE)
#define ERROR_NAME "DGEMV "
#else
#define ERROR_NAME "SGEMV "
#endif
#ifdef SMPTEST
static int (*gemv_thread[])(BLASLONG, BLASLONG, FLOAT, FLOAT *, BLASLONG, FLOAT * , BLASLONG, FLOAT *, BLASLONG, FLOAT *, int) = {
#ifdef XDOUBLE
qgemv_thread_n, qgemv_thread_t,
#elif defined DOUBLE
dgemv_thread_n, dgemv_thread_t,
#else
sgemv_thread_n, sgemv_thread_t,
#endif
};
#endif
#ifndef CBLAS
void NAME(char *TRANS, blasint *M, blasint *N,
FLOAT *ALPHA, FLOAT *a, blasint *LDA,
FLOAT *x, blasint *INCX,
FLOAT *BETA, FLOAT *y, blasint *INCY){
char trans = *TRANS;
blasint m = *M;
blasint n = *N;
blasint lda = *LDA;
blasint incx = *INCX;
blasint incy = *INCY;
FLOAT alpha = *ALPHA;
FLOAT beta = *BETA;
FLOAT *buffer;
#ifdef SMPTEST
int nthreads;
#endif
int (*gemv[])(BLASLONG, BLASLONG, BLASLONG, FLOAT, FLOAT *, BLASLONG, FLOAT * , BLASLONG, FLOAT *, BLASLONG, FLOAT *) = {
GEMV_N, GEMV_T,
};
blasint info;
blasint lenx, leny;
blasint i;
PRINT_DEBUG_NAME;
TOUPPER(trans);
info = 0;
i = -1;
if (trans == 'N') i = 0;
if (trans == 'T') i = 1;
if (trans == 'R') i = 0;
if (trans == 'C') i = 1;
if (incy == 0) info = 11;
if (incx == 0) info = 8;
if (lda < MAX(1, m)) info = 6;
if (n < 0) info = 3;
if (m < 0) info = 2;
if (i < 0) info = 1;
trans = i;
if (info != 0){
BLASFUNC(xerbla)(ERROR_NAME, &info, sizeof(ERROR_NAME));
return;
}
#else
void CNAME(enum CBLAS_ORDER order,
enum CBLAS_TRANSPOSE TransA,
blasint m, blasint n,
FLOAT alpha,
FLOAT *a, blasint lda,
FLOAT *x, blasint incx,
FLOAT beta,
FLOAT *y, blasint incy){
FLOAT *buffer;
blasint lenx, leny;
int trans;
blasint info, t;
#ifdef SMPTEST
int nthreads;
#endif
int (*gemv[])(BLASLONG, BLASLONG, BLASLONG, FLOAT, FLOAT *, BLASLONG, FLOAT * , BLASLONG, FLOAT *, BLASLONG, FLOAT *) = {
GEMV_N, GEMV_T,
};
PRINT_DEBUG_CNAME;
trans = -1;
info = 0;
if (order == CblasColMajor) {
if (TransA == CblasNoTrans) trans = 0;
if (TransA == CblasTrans) trans = 1;
if (TransA == CblasConjNoTrans) trans = 0;
if (TransA == CblasConjTrans) trans = 1;
info = -1;
if (incy == 0) info = 11;
if (incx == 0) info = 8;
if (lda < MAX(1, m)) info = 6;
if (n < 0) info = 3;
if (m < 0) info = 2;
if (trans < 0) info = 1;
}
if (order == CblasRowMajor) {
if (TransA == CblasNoTrans) trans = 1;
if (TransA == CblasTrans) trans = 0;
if (TransA == CblasConjNoTrans) trans = 1;
if (TransA == CblasConjTrans) trans = 0;
info = -1;
t = n;
n = m;
m = t;
if (incy == 0) info = 11;
if (incx == 0) info = 8;
if (lda < MAX(1, m)) info = 6;
if (n < 0) info = 3;
if (m < 0) info = 2;
if (trans < 0) info = 1;
}
if (info >= 0) {
BLASFUNC(xerbla)(ERROR_NAME, &info, sizeof(ERROR_NAME));
return;
}
#endif
if ((m==0) || (n==0)) return;
lenx = n;
leny = m;
if (trans) lenx = m;
if (trans) leny = n;
if (beta != ONE) SCAL_K(leny, 0, 0, beta, y, abs(incy), NULL, 0, NULL, 0);
if (alpha == ZERO) return;
IDEBUG_START;
FUNCTION_PROFILE_START();
if (incx < 0) x -= (lenx - 1) * incx;
if (incy < 0) y -= (leny - 1) * incy;
buffer = (FLOAT *)blas_memory_alloc(1);
#ifdef SMPTEST
nthreads = num_cpu_avail(2);
if (nthreads == 1) {
#endif
(gemv[(int)trans])(m, n, 0, alpha, a, lda, x, incx, y, incy, buffer);
#ifdef SMPTEST
} else {
(gemv_thread[(int)trans])(m, n, alpha, a, lda, x, incx, y, incy, buffer, nthreads);
}
#endif
blas_memory_free(buffer);
FUNCTION_PROFILE_END(1, m * n + m + n, 2 * m * n);
IDEBUG_END;
return;
}

193
interface/ger.c Normal file
View File

@ -0,0 +1,193 @@
/*********************************************************************/
/* Copyright 2009, 2010 The University of Texas at Austin. */
/* All rights reserved. */
/* */
/* Redistribution and use in source and binary forms, with or */
/* without modification, are permitted provided that the following */
/* conditions are met: */
/* */
/* 1. Redistributions of source code must retain the above */
/* copyright notice, this list of conditions and the following */
/* disclaimer. */
/* */
/* 2. Redistributions in binary form must reproduce the above */
/* copyright notice, this list of conditions and the following */
/* disclaimer in the documentation and/or other materials */
/* provided with the distribution. */
/* */
/* THIS SOFTWARE IS PROVIDED BY THE UNIVERSITY OF TEXAS AT */
/* AUSTIN ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, */
/* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF */
/* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE */
/* DISCLAIMED. IN NO EVENT SHALL THE UNIVERSITY OF TEXAS AT */
/* AUSTIN OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, */
/* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES */
/* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE */
/* GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR */
/* BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF */
/* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT */
/* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT */
/* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE */
/* POSSIBILITY OF SUCH DAMAGE. */
/* */
/* The views and conclusions contained in the software and */
/* documentation are those of the authors and should not be */
/* interpreted as representing official policies, either expressed */
/* or implied, of The University of Texas at Austin. */
/*********************************************************************/
#include <stdio.h>
#include "common.h"
#ifdef FUNCTION_PROFILE
#include "functable.h"
#endif
#ifdef XDOUBLE
#define ERROR_NAME "QGER "
#elif defined DOUBLE
#define ERROR_NAME "DGER "
#else
#define ERROR_NAME "SGER "
#endif
#define GER GERU_K
#if defined XDOUBLE
#define GER_THREAD qger_thread
#elif defined DOUBLE
#define GER_THREAD dger_thread
#else
#define GER_THREAD sger_thread
#endif
#ifndef CBLAS
void NAME(blasint *M, blasint *N, FLOAT *Alpha,
FLOAT *x, blasint *INCX,
FLOAT *y, blasint *INCY,
FLOAT *a, blasint *LDA){
blasint m = *M;
blasint n = *N;
FLOAT alpha = *Alpha;
blasint incx = *INCX;
blasint incy = *INCY;
blasint lda = *LDA;
FLOAT *buffer;
#ifdef SMPTEST
int nthreads;
#endif
blasint info;
PRINT_DEBUG_NAME;
info = 0;
if (lda < MAX(1,m)) info = 9;
if (incy == 0) info = 7;
if (incx == 0) info = 5;
if (n < 0) info = 2;
if (m < 0) info = 1;
if (info){
BLASFUNC(xerbla)(ERROR_NAME, &info, sizeof(ERROR_NAME));
return;
}
#else
void CNAME(enum CBLAS_ORDER order,
blasint m, blasint n,
FLOAT alpha,
FLOAT *x, blasint incx,
FLOAT *y, blasint incy,
FLOAT *a, blasint lda) {
FLOAT *buffer;
blasint info, t;
#ifdef SMPTEST
int nthreads;
#endif
PRINT_DEBUG_CNAME;
info = 0;
if (order == CblasColMajor) {
info = -1;
if (lda < MAX(1,m)) info = 9;
if (incy == 0) info = 7;
if (incx == 0) info = 5;
if (n < 0) info = 2;
if (m < 0) info = 1;
}
if (order == CblasRowMajor) {
info = -1;
t = n;
n = m;
m = t;
t = incx;
incx = incy;
incy = t;
buffer = x;
x = y;
y = buffer;
if (lda < MAX(1,m)) info = 9;
if (incy == 0) info = 7;
if (incx == 0) info = 5;
if (n < 0) info = 2;
if (m < 0) info = 1;
}
if (info >= 0) {
BLASFUNC(xerbla)(ERROR_NAME, &info, sizeof(ERROR_NAME));
return;
}
#endif
/* Quick return if possible. */
if (m == 0 || n == 0) return;
if (alpha == 0.) return;
IDEBUG_START;
FUNCTION_PROFILE_START();
if (incy < 0) y -= (n - 1) * incy;
if (incx < 0) x -= (m - 1) * incx;
buffer = (FLOAT *)blas_memory_alloc(1);
#ifdef SMPTEST
nthreads = num_cpu_avail(2);
if (nthreads == 1) {
#endif
GER(m, n, 0, alpha, x, incx, y, incy, a, lda, buffer);
#ifdef SMPTEST
} else {
GER_THREAD(m, n, alpha, x, incx, y, incy, a, lda, buffer, nthreads);
}
#endif
blas_memory_free(buffer);
FUNCTION_PROFILE_END(1, m * n + m + n, 2 * m * n);
IDEBUG_END;
return;
}

154
interface/gesv.c Normal file
View File

@ -0,0 +1,154 @@
/*********************************************************************/
/* Copyright 2009, 2010 The University of Texas at Austin. */
/* All rights reserved. */
/* */
/* Redistribution and use in source and binary forms, with or */
/* without modification, are permitted provided that the following */
/* conditions are met: */
/* */
/* 1. Redistributions of source code must retain the above */
/* copyright notice, this list of conditions and the following */
/* disclaimer. */
/* */
/* 2. Redistributions in binary form must reproduce the above */
/* copyright notice, this list of conditions and the following */
/* disclaimer in the documentation and/or other materials */
/* provided with the distribution. */
/* */
/* THIS SOFTWARE IS PROVIDED BY THE UNIVERSITY OF TEXAS AT */
/* AUSTIN ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, */
/* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF */
/* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE */
/* DISCLAIMED. IN NO EVENT SHALL THE UNIVERSITY OF TEXAS AT */
/* AUSTIN OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, */
/* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES */
/* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE */
/* GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR */
/* BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF */
/* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT */
/* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT */
/* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE */
/* POSSIBILITY OF SUCH DAMAGE. */
/* */
/* The views and conclusions contained in the software and */
/* documentation are those of the authors and should not be */
/* interpreted as representing official policies, either expressed */
/* or implied, of The University of Texas at Austin. */
/*********************************************************************/
#include <stdio.h>
#include "common.h"
#ifdef FUNCTION_PROFILE
#include "functable.h"
#endif
#ifndef COMPLEX
#ifdef XDOUBLE
#define ERROR_NAME "QGESV "
#elif defined(DOUBLE)
#define ERROR_NAME "DGESV "
#else
#define ERROR_NAME "SGESV "
#endif
#else
#ifdef XDOUBLE
#define ERROR_NAME "XGESV "
#elif defined(DOUBLE)
#define ERROR_NAME "ZGESV "
#else
#define ERROR_NAME "CGESV "
#endif
#endif
int NAME(blasint *N, blasint *NRHS, FLOAT *a, blasint *ldA, blasint *ipiv,
FLOAT *b, blasint *ldB, blasint *Info){
blas_arg_t args;
blasint info;
FLOAT *buffer;
#ifdef PPC440
extern
#endif
FLOAT *sa, *sb;
PRINT_DEBUG_NAME;
args.m = *N;
args.n = *NRHS;
args.a = (void *)a;
args.lda = *ldA;
args.b = (void *)b;
args.ldb = *ldB;
args.c = (void *)ipiv;
info = 0;
if (args.ldb < MAX(1,args.m)) info = 7;
if (args.lda < MAX(1,args.m)) info = 4;
if (args.n < 0) info = 2;
if (args.m < 0) info = 1;
if (info) {
BLASFUNC(xerbla)(ERROR_NAME, &info, sizeof(ERROR_NAME));
*Info = - info;
return 0;
}
args.alpha = NULL;
args.beta = NULL;
*Info = 0;
if (args.m == 0 || args.n == 0) return 0;
IDEBUG_START;
FUNCTION_PROFILE_START();
#ifndef PPC440
buffer = (FLOAT *)blas_memory_alloc(1);
sa = (FLOAT *)((BLASLONG)buffer + GEMM_OFFSET_A);
sb = (FLOAT *)(((BLASLONG)sa + ((GEMM_P * GEMM_Q * COMPSIZE * SIZE + GEMM_ALIGN) & ~GEMM_ALIGN)) + GEMM_OFFSET_B);
#endif
#ifdef SMPTEST
args.common = NULL;
args.nthreads = num_cpu_avail(4);
if (args.nthreads == 1) {
#endif
args.n = *N;
info = GETRF_SINGLE(&args, NULL, NULL, sa, sb, 0);
if (info == 0){
args.n = *NRHS;
GETRS_N_SINGLE(&args, NULL, NULL, sa, sb, 0);
}
#ifdef SMPTEST
} else {
args.n = *N;
info = GETRF_PARALLEL(&args, NULL, NULL, sa, sb, 0);
if (info == 0){
args.n = *NRHS;
GETRS_N_PARALLEL(&args, NULL, NULL, sa, sb, 0);
}
}
#endif
#ifndef PPC440
blas_memory_free(buffer);
#endif
*Info = info;
FUNCTION_PROFILE_END(COMPSIZE * COMPSIZE, *N * *N, 2. / 3. * *N * *N * *N + *N * *N);
IDEBUG_END;
return 0;
}

171
interface/imax.c Normal file
View File

@ -0,0 +1,171 @@
/*********************************************************************/
/* Copyright 2009, 2010 The University of Texas at Austin. */
/* All rights reserved. */
/* */
/* Redistribution and use in source and binary forms, with or */
/* without modification, are permitted provided that the following */
/* conditions are met: */
/* */
/* 1. Redistributions of source code must retain the above */
/* copyright notice, this list of conditions and the following */
/* disclaimer. */
/* */
/* 2. Redistributions in binary form must reproduce the above */
/* copyright notice, this list of conditions and the following */
/* disclaimer in the documentation and/or other materials */
/* provided with the distribution. */
/* */
/* THIS SOFTWARE IS PROVIDED BY THE UNIVERSITY OF TEXAS AT */
/* AUSTIN ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, */
/* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF */
/* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE */
/* DISCLAIMED. IN NO EVENT SHALL THE UNIVERSITY OF TEXAS AT */
/* AUSTIN OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, */
/* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES */
/* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE */
/* GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR */
/* BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF */
/* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT */
/* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT */
/* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE */
/* POSSIBILITY OF SUCH DAMAGE. */
/* */
/* The views and conclusions contained in the software and */
/* documentation are those of the authors and should not be */
/* interpreted as representing official policies, either expressed */
/* or implied, of The University of Texas at Austin. */
/*********************************************************************/
#include <stdio.h>
#include "common.h"
#ifdef FUNCTION_PROFILE
#include "functable.h"
#endif
#undef MAX_K
#ifdef USE_ABS
#ifndef USE_MIN
/* ABS & MAX */
#ifndef COMPLEX
#ifdef XDOUBLE
#define MAX_K IQAMAX_K
#elif defined(DOUBLE)
#define MAX_K IDAMAX_K
#else
#define MAX_K ISAMAX_K
#endif
#else
#ifdef XDOUBLE
#define MAX_K IXAMAX_K
#elif defined(DOUBLE)
#define MAX_K IZAMAX_K
#else
#define MAX_K ICAMAX_K
#endif
#endif
#else
/* ABS & MIN */
#ifndef COMPLEX
#ifdef XDOUBLE
#define MAX_K IQAMIN_K
#elif defined(DOUBLE)
#define MAX_K IDAMIN_K
#else
#define MAX_K ISAMIN_K
#endif
#else
#ifdef XDOUBLE
#define MAX_K IXAMIN_K
#elif defined(DOUBLE)
#define MAX_K IZAMIN_K
#else
#define MAX_K ICAMIN_K
#endif
#endif
#endif
#else
#ifndef USE_MIN
/* MAX */
#ifdef XDOUBLE
#define MAX_K IQMAX_K
#elif defined(DOUBLE)
#define MAX_K IDMAX_K
#else
#define MAX_K ISMAX_K
#endif
#else
/* MIN */
#ifdef XDOUBLE
#define MAX_K IQMIN_K
#elif defined(DOUBLE)
#define MAX_K IDMIN_K
#else
#define MAX_K ISMIN_K
#endif
#endif
#endif
#ifndef CBLAS
blasint NAME(blasint *N, FLOAT *x, blasint *INCX){
BLASLONG n = *N;
BLASLONG incx = *INCX;
blasint ret;
PRINT_DEBUG_NAME;
if (n <= 0) return 0;
IDEBUG_START;
FUNCTION_PROFILE_START();
ret = (blasint)MAX_K(n, x, incx);
FUNCTION_PROFILE_END(COMPSIZE, n, 0);
IDEBUG_END;
return ret;
}
#else
CBLAS_INDEX CNAME(blasint n, FLOAT *x, blasint incx){
CBLAS_INDEX ret;
PRINT_DEBUG_CNAME;
if (n <= 0) return 0;
IDEBUG_START;
FUNCTION_PROFILE_START();
ret = MAX_K(n, x, incx);
if (ret) ret --;
FUNCTION_PROFILE_END(COMPSIZE, n, 0);
IDEBUG_END;
return ret;
}
#endif

169
interface/max.c Normal file
View File

@ -0,0 +1,169 @@
/*********************************************************************/
/* Copyright 2009, 2010 The University of Texas at Austin. */
/* All rights reserved. */
/* */
/* Redistribution and use in source and binary forms, with or */
/* without modification, are permitted provided that the following */
/* conditions are met: */
/* */
/* 1. Redistributions of source code must retain the above */
/* copyright notice, this list of conditions and the following */
/* disclaimer. */
/* */
/* 2. Redistributions in binary form must reproduce the above */
/* copyright notice, this list of conditions and the following */
/* disclaimer in the documentation and/or other materials */
/* provided with the distribution. */
/* */
/* THIS SOFTWARE IS PROVIDED BY THE UNIVERSITY OF TEXAS AT */
/* AUSTIN ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, */
/* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF */
/* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE */
/* DISCLAIMED. IN NO EVENT SHALL THE UNIVERSITY OF TEXAS AT */
/* AUSTIN OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, */
/* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES */
/* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE */
/* GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR */
/* BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF */
/* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT */
/* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT */
/* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE */
/* POSSIBILITY OF SUCH DAMAGE. */
/* */
/* The views and conclusions contained in the software and */
/* documentation are those of the authors and should not be */
/* interpreted as representing official policies, either expressed */
/* or implied, of The University of Texas at Austin. */
/*********************************************************************/
#include <stdio.h>
#include "common.h"
#ifdef FUNCTION_PROFILE
#include "functable.h"
#endif
#undef MAX_K
#ifdef USE_ABS
#ifndef USE_MIN
/* ABS & MAX */
#ifndef COMPLEX
#ifdef XDOUBLE
#define MAX_K QAMAX_K
#elif defined(DOUBLE)
#define MAX_K DAMAX_K
#else
#define MAX_K SAMAX_K
#endif
#else
#ifdef XDOUBLE
#define MAX_K XAMAX_K
#elif defined(DOUBLE)
#define MAX_K ZAMAX_K
#else
#define MAX_K CAMAX_K
#endif
#endif
#else
/* ABS & MIN */
#ifndef COMPLEX
#ifdef XDOUBLE
#define MAX_K QAMIN_K
#elif defined(DOUBLE)
#define MAX_K DAMIN_K
#else
#define MAX_K SAMIN_K
#endif
#else
#ifdef XDOUBLE
#define MAX_K XAMIN_K
#elif defined(DOUBLE)
#define MAX_K ZAMIN_K
#else
#define MAX_K CAMIN_K
#endif
#endif
#endif
#else
#ifndef USE_MIN
/* MAX */
#ifdef XDOUBLE
#define MAX_K QMAX_K
#elif defined(DOUBLE)
#define MAX_K DMAX_K
#else
#define MAX_K SMAX_K
#endif
#else
/* MIN */
#ifdef XDOUBLE
#define MAX_K QMIN_K
#elif defined(DOUBLE)
#define MAX_K DMIN_K
#else
#define MAX_K SMIN_K
#endif
#endif
#endif
#ifndef CBLAS
FLOATRET NAME(blasint *N, FLOAT *x, blasint *INCX){
BLASLONG n = *N;
BLASLONG incx = *INCX;
FLOATRET ret;
PRINT_DEBUG_NAME;
if (n <= 0) return 0;
IDEBUG_START;
FUNCTION_PROFILE_START();
ret = (FLOATRET)MAX_K(n, x, incx);
FUNCTION_PROFILE_END(COMPSIZE, n, 0);
IDEBUG_END;
return ret;
}
#else
FLOAT CNAME(blasint n, FLOAT *x, blasint incx){
FLOAT ret;
PRINT_DEBUG_CNAME;
if (n <= 0) return 0;
IDEBUG_START;
FUNCTION_PROFILE_START();
ret = MAX_K(n, x, incx);
FUNCTION_PROFILE_END(COMPSIZE, n, 0);
IDEBUG_END;
return ret;
}
#endif

93
interface/nrm2.c Normal file
View File

@ -0,0 +1,93 @@
/*********************************************************************/
/* Copyright 2009, 2010 The University of Texas at Austin. */
/* All rights reserved. */
/* */
/* Redistribution and use in source and binary forms, with or */
/* without modification, are permitted provided that the following */
/* conditions are met: */
/* */
/* 1. Redistributions of source code must retain the above */
/* copyright notice, this list of conditions and the following */
/* disclaimer. */
/* */
/* 2. Redistributions in binary form must reproduce the above */
/* copyright notice, this list of conditions and the following */
/* disclaimer in the documentation and/or other materials */
/* provided with the distribution. */
/* */
/* THIS SOFTWARE IS PROVIDED BY THE UNIVERSITY OF TEXAS AT */
/* AUSTIN ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, */
/* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF */
/* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE */
/* DISCLAIMED. IN NO EVENT SHALL THE UNIVERSITY OF TEXAS AT */
/* AUSTIN OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, */
/* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES */
/* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE */
/* GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR */
/* BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF */
/* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT */
/* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT */
/* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE */
/* POSSIBILITY OF SUCH DAMAGE. */
/* */
/* The views and conclusions contained in the software and */
/* documentation are those of the authors and should not be */
/* interpreted as representing official policies, either expressed */
/* or implied, of The University of Texas at Austin. */
/*********************************************************************/
#include <stdio.h>
#include "common.h"
#ifdef FUNCTION_PROFILE
#include "functable.h"
#endif
#ifndef CBLAS
FLOATRET NAME(blasint *N, FLOAT *x, blasint *INCX){
BLASLONG n = *N;
BLASLONG incx = *INCX;
FLOATRET ret;
PRINT_DEBUG_NAME;
if (n <= 0) return 0.;
IDEBUG_START;
FUNCTION_PROFILE_START();
ret = (FLOATRET)NRM2_K(n, x, incx);
FUNCTION_PROFILE_END(COMPSIZE, n, 2 * n);
IDEBUG_END;
return ret;
}
#else
FLOAT CNAME(blasint n, FLOAT *x, blasint incx){
FLOAT ret;
PRINT_DEBUG_CNAME;
if (n <= 0) return 0.;
IDEBUG_START;
FUNCTION_PROFILE_START();
ret = NRM2_K(n, x, incx);
FUNCTION_PROFILE_END(COMPSIZE, n, 2 * n);
IDEBUG_END;
return ret;
}
#endif

82
interface/rot.c Normal file
View File

@ -0,0 +1,82 @@
/*********************************************************************/
/* Copyright 2009, 2010 The University of Texas at Austin. */
/* All rights reserved. */
/* */
/* Redistribution and use in source and binary forms, with or */
/* without modification, are permitted provided that the following */
/* conditions are met: */
/* */
/* 1. Redistributions of source code must retain the above */
/* copyright notice, this list of conditions and the following */
/* disclaimer. */
/* */
/* 2. Redistributions in binary form must reproduce the above */
/* copyright notice, this list of conditions and the following */
/* disclaimer in the documentation and/or other materials */
/* provided with the distribution. */
/* */
/* THIS SOFTWARE IS PROVIDED BY THE UNIVERSITY OF TEXAS AT */
/* AUSTIN ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, */
/* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF */
/* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE */
/* DISCLAIMED. IN NO EVENT SHALL THE UNIVERSITY OF TEXAS AT */
/* AUSTIN OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, */
/* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES */
/* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE */
/* GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR */
/* BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF */
/* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT */
/* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT */
/* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE */
/* POSSIBILITY OF SUCH DAMAGE. */
/* */
/* The views and conclusions contained in the software and */
/* documentation are those of the authors and should not be */
/* interpreted as representing official policies, either expressed */
/* or implied, of The University of Texas at Austin. */
/*********************************************************************/
#include <stdio.h>
#include "common.h"
#ifdef FUNCTION_PROFILE
#include "functable.h"
#endif
#ifndef CBLAS
void NAME(blasint *N, FLOAT *x, blasint *INCX, FLOAT *y, blasint *INCY, FLOAT *C, FLOAT *S){
BLASLONG n = *N;
BLASLONG incx = *INCX;
BLASLONG incy = *INCY;
FLOAT c = *C;
FLOAT s = *S;
PRINT_DEBUG_NAME;
#else
void CNAME(blasint n, FLOAT *x, blasint incx, FLOAT *y, blasint incy, FLOAT c, FLOAT s){
PRINT_DEBUG_CNAME;
#endif
if (n <= 0) return;
IDEBUG_START;
FUNCTION_PROFILE_START();
if (incx < 0) x -= (n - 1) * incx;
if (incy < 0) y -= (n - 1) * incy;
ROT_K(n, x, incx, y, incy, c, s);
FUNCTION_PROFILE_END(1, n, n);
IDEBUG_END;
return;
}

109
interface/rotg.c Normal file
View File

@ -0,0 +1,109 @@
#include <math.h>
#include "common.h"
#ifdef FUNCTION_PROFILE
#include "functable.h"
#endif
#ifndef CBLAS
void NAME(FLOAT *DA, FLOAT *DB, FLOAT *C, FLOAT *S){
#else
void CNAME(FLOAT *DA, FLOAT *DB, FLOAT *C, FLOAT *S){
#endif
#if defined(__i386__) || defined(__x86_64__) || defined(__ia64__)
long double da = *DA;
long double db = *DB;
long double c;
long double s;
long double r, roe, z;
long double ada = fabs(da);
long double adb = fabs(db);
long double scale = ada + adb;
#ifndef CBLAS
PRINT_DEBUG_NAME;
#else
PRINT_DEBUG_CNAME;
#endif
roe = db;
if (ada > adb) roe = da;
if (scale == ZERO) {
*C = ONE;
*S = ZERO;
*DA = ZERO;
*DB = ZERO;
} else {
r = sqrt(da * da + db * db);
if (roe < 0) r = -r;
c = da / r;
s = db / r;
z = ONE;
if (da != ZERO) {
if (ada > adb){
z = s;
} else {
z = ONE / c;
}
}
*C = c;
*S = s;
*DA = r;
*DB = z;
}
#else
FLOAT da = *DA;
FLOAT db = *DB;
FLOAT c = *C;
FLOAT s = *S;
FLOAT r, roe, z;
FLOAT ada = fabs(da);
FLOAT adb = fabs(db);
FLOAT scale = ada + adb;
#ifndef CBLAS
PRINT_DEBUG_NAME;
#else
PRINT_DEBUG_CNAME;
#endif
roe = db;
if (ada > adb) roe = da;
if (scale == ZERO) {
*C = ONE;
*S = ZERO;
*DA = ZERO;
*DB = ZERO;
} else {
FLOAT aa = da / scale;
FLOAT bb = db / scale;
r = scale * sqrt(aa * aa + bb * bb);
if (roe < 0) r = -r;
c = da / r;
s = db / r;
z = ONE;
if (ada > adb) z = s;
if ((ada < adb) && (c != ZERO)) z = ONE / c;
*C = c;
*S = s;
*DA = r;
*DB = z;
}
#endif
return;
}

155
interface/rotm.c Normal file
View File

@ -0,0 +1,155 @@
#include "common.h"
#ifdef FUNCTION_PROFILE
#include "functable.h"
#endif
#ifndef CBLAS
void NAME(blasint *N, FLOAT *dx, blasint *INCX, FLOAT *dy, blasint *INCY, FLOAT *dparam){
blasint n = *N;
blasint incx = *INCX;
blasint incy = *INCY;
#else
void CNAME(blasint n, FLOAT *dx, blasint incx, FLOAT *dy, blasint incy, FLOAT *dparam){
#endif
blasint i__1, i__2;
blasint i__;
FLOAT w, z__;
blasint kx, ky;
FLOAT dh11, dh12, dh22, dh21, dflag;
blasint nsteps;
#ifndef CBLAS
PRINT_DEBUG_CNAME;
#else
PRINT_DEBUG_CNAME;
#endif
--dparam;
--dy;
--dx;
dflag = dparam[1];
if (n <= 0 || dflag == - 2.0) goto L140;
if (! (incx == incy && incx > 0)) goto L70;
nsteps = n * incx;
if (dflag < 0.) {
goto L50;
} else if (dflag == 0) {
goto L10;
} else {
goto L30;
}
L10:
dh12 = dparam[4];
dh21 = dparam[3];
i__1 = nsteps;
i__2 = incx;
for (i__ = 1; i__2 < 0 ? i__ >= i__1 : i__ <= i__1; i__ += i__2) {
w = dx[i__];
z__ = dy[i__];
dx[i__] = w + z__ * dh12;
dy[i__] = w * dh21 + z__;
/* L20: */
}
goto L140;
L30:
dh11 = dparam[2];
dh22 = dparam[5];
i__2 = nsteps;
i__1 = incx;
for (i__ = 1; i__1 < 0 ? i__ >= i__2 : i__ <= i__2; i__ += i__1) {
w = dx[i__];
z__ = dy[i__];
dx[i__] = w * dh11 + z__;
dy[i__] = -w + dh22 * z__;
/* L40: */
}
goto L140;
L50:
dh11 = dparam[2];
dh12 = dparam[4];
dh21 = dparam[3];
dh22 = dparam[5];
i__1 = nsteps;
i__2 = incx;
for (i__ = 1; i__2 < 0 ? i__ >= i__1 : i__ <= i__1; i__ += i__2) {
w = dx[i__];
z__ = dy[i__];
dx[i__] = w * dh11 + z__ * dh12;
dy[i__] = w * dh21 + z__ * dh22;
/* L60: */
}
goto L140;
L70:
kx = 1;
ky = 1;
if (incx < 0) {
kx = (1 - n) * incx + 1;
}
if (incy < 0) {
ky = (1 - n) * incy + 1;
}
if (dflag < 0.) {
goto L120;
} else if (dflag == 0) {
goto L80;
} else {
goto L100;
}
L80:
dh12 = dparam[4];
dh21 = dparam[3];
i__2 = n;
for (i__ = 1; i__ <= i__2; ++i__) {
w = dx[kx];
z__ = dy[ky];
dx[kx] = w + z__ * dh12;
dy[ky] = w * dh21 + z__;
kx += incx;
ky += incy;
/* L90: */
}
goto L140;
L100:
dh11 = dparam[2];
dh22 = dparam[5];
i__2 = n;
for (i__ = 1; i__ <= i__2; ++i__) {
w = dx[kx];
z__ = dy[ky];
dx[kx] = w * dh11 + z__;
dy[ky] = -w + dh22 * z__;
kx += incx;
ky += incy;
/* L110: */
}
goto L140;
L120:
dh11 = dparam[2];
dh12 = dparam[4];
dh21 = dparam[3];
dh22 = dparam[5];
i__2 = n;
for (i__ = 1; i__ <= i__2; ++i__) {
w = dx[kx];
z__ = dy[ky];
dx[kx] = w * dh11 + z__ * dh12;
dy[ky] = w * dh21 + z__ * dh22;
kx += incx;
ky += incy;
/* L130: */
}
L140:
return;
}

235
interface/rotmg.c Normal file
View File

@ -0,0 +1,235 @@
/***************************************************************************
Copyright (c) 2013, The OpenBLAS Project
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in
the documentation and/or other materials provided with the
distribution.
3. Neither the name of the OpenBLAS project nor the names of
its contributors may be used to endorse or promote products
derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE OPENBLAS PROJECT OR CONTRIBUTORS BE
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*****************************************************************************/
/**************************************************************************************
* 2014/05/02 Saar
* fixed two bugs as reported by Brendan Tracey
* Test with lapack-3.5.0 : OK
*
**************************************************************************************/
#include "common.h"
#ifdef FUNCTION_PROFILE
#include "functable.h"
#endif
#define GAM 4096.e0
#define GAMSQ 16777216.e0
#define RGAMSQ 5.9604645e-8
#define TWO 2.e0
#ifdef DOUBLE
#define ABS(x) fabs(x)
#else
#define ABS(x) fabsf(x)
#endif
#ifndef CBLAS
void NAME(FLOAT *dd1, FLOAT *dd2, FLOAT *dx1, FLOAT *DY1, FLOAT *dparam){
FLOAT dy1 = *DY1;
#else
void CNAME(FLOAT *dd1, FLOAT *dd2, FLOAT *dx1, FLOAT dy1, FLOAT *dparam){
#endif
FLOAT du, dp1, dp2, dq2, dq1, dh11, dh21, dh12, dh22, dflag, dtemp;
if(*dd1 < ZERO)
{
dflag = -ONE;
dh11 = ZERO;
dh12 = ZERO;
dh21 = ZERO;
dh22 = ZERO;
*dd1 = ZERO;
*dd2 = ZERO;
*dx1 = ZERO;
}
else
{
dp2 = *dd2 * dy1;
if(dp2 == ZERO)
{
dflag = -TWO;
dparam[0] = dflag;
return;
}
dp1 = *dd1 * *dx1;
dq2 = dp2 * dy1;
dq1 = dp1 * *dx1;
if(ABS(dq1) > ABS(dq2))
{
dh21 = - dy1 / *dx1;
dh12 = dp2 / dp1;
du = ONE - dh12 * dh21;
if(du > ZERO)
{
dflag = ZERO;
*dd1 = *dd1 / du;
*dd2 = *dd2 / du;
*dx1 = *dx1 * du;
}
}
else
{
if(dq2 < ZERO)
{
dflag = -ONE;
dh11 = ZERO;
dh12 = ZERO;
dh21 = ZERO;
dh22 = ZERO;
*dd1 = ZERO;
*dd2 = ZERO;
*dx1 = ZERO;
}
else
{
dflag = ONE;
dh11 = dp1 / dp2;
dh22 = *dx1 / dy1;
du = ONE + dh11 * dh22;
dtemp = *dd2 / du;
*dd2 = *dd1 / du;
*dd1 = dtemp;
*dx1 = dy1 * du;
}
}
if(*dd1 != ZERO)
{
while( (*dd1 <= RGAMSQ) || (*dd1 >= GAMSQ) )
{
if(dflag == ZERO)
{
dh11 = ONE;
dh22 = ONE;
dflag = -ONE;
}
else
{
if(dflag == ONE)
{
dh21 = -ONE;
dh12 = ONE;
dflag = -ONE;
}
}
if( *dd1 <= RGAMSQ )
{
*dd1 = *dd1 * (GAM * GAM);
*dx1 = *dx1 / GAM;
dh11 = dh11 / GAM;
dh12 = dh12 / GAM;
}
else
{
*dd1 = *dd1 / (GAM * GAM);
*dx1 = *dx1 * GAM;
dh11 = dh11 * GAM;
dh12 = dh12 * GAM;
}
}
}
if(*dd2 != ZERO)
{
while( (ABS(*dd2) <= RGAMSQ) || (ABS(*dd2) >= GAMSQ) )
{
if(dflag == ZERO)
{
dh11 = ONE;
dh22 = ONE;
dflag = -ONE;
}
else
{
if(dflag == ONE)
{
dh21 = -ONE;
dh12 = ONE;
dflag = -ONE;
}
}
if( ABS(*dd2) <= RGAMSQ )
{
*dd2 = *dd2 * (GAM * GAM);
dh21 = dh21 / GAM;
dh22 = dh22 / GAM;
}
else
{
*dd2 = *dd2 / (GAM * GAM);
dh21 = dh21 * GAM;
dh22 = dh22 * GAM;
}
}
}
}
if(dflag < ZERO)
{
dparam[1] = dh11;
dparam[2] = dh21;
dparam[3] = dh12;
dparam[4] = dh22;
}
else
{
if(dflag == ZERO)
{
dparam[2] = dh21;
dparam[3] = dh12;
}
else
{
dparam[1] = dh11;
dparam[4] = dh22;
}
}
dparam[0] = dflag;
return;
}

215
interface/sbmv.c Normal file
View File

@ -0,0 +1,215 @@
/*********************************************************************/
/* Copyright 2009, 2010 The University of Texas at Austin. */
/* All rights reserved. */
/* */
/* Redistribution and use in source and binary forms, with or */
/* without modification, are permitted provided that the following */
/* conditions are met: */
/* */
/* 1. Redistributions of source code must retain the above */
/* copyright notice, this list of conditions and the following */
/* disclaimer. */
/* */
/* 2. Redistributions in binary form must reproduce the above */
/* copyright notice, this list of conditions and the following */
/* disclaimer in the documentation and/or other materials */
/* provided with the distribution. */
/* */
/* THIS SOFTWARE IS PROVIDED BY THE UNIVERSITY OF TEXAS AT */
/* AUSTIN ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, */
/* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF */
/* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE */
/* DISCLAIMED. IN NO EVENT SHALL THE UNIVERSITY OF TEXAS AT */
/* AUSTIN OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, */
/* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES */
/* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE */
/* GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR */
/* BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF */
/* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT */
/* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT */
/* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE */
/* POSSIBILITY OF SUCH DAMAGE. */
/* */
/* The views and conclusions contained in the software and */
/* documentation are those of the authors and should not be */
/* interpreted as representing official policies, either expressed */
/* or implied, of The University of Texas at Austin. */
/*********************************************************************/
#include <stdio.h>
#include <ctype.h>
#include "common.h"
#ifdef FUNCTION_PROFILE
#include "functable.h"
#endif
#ifdef XDOUBLE
#define ERROR_NAME "QSBMV "
#elif defined(DOUBLE)
#define ERROR_NAME "DSBMV "
#else
#define ERROR_NAME "SSBMV "
#endif
static int (*sbmv[])(BLASLONG, BLASLONG, FLOAT, FLOAT *, BLASLONG, FLOAT *, BLASLONG, FLOAT *, BLASLONG, void *) = {
#ifdef XDOUBLE
qsbmv_U, qsbmv_L,
#elif defined(DOUBLE)
dsbmv_U, dsbmv_L,
#else
ssbmv_U, ssbmv_L,
#endif
};
#ifdef SMPTEST
static int (*sbmv_thread[])(BLASLONG, BLASLONG, FLOAT, FLOAT *, BLASLONG, FLOAT *, BLASLONG, FLOAT *, BLASLONG, FLOAT *, int) = {
#ifdef XDOUBLE
qsbmv_thread_U, qsbmv_thread_L,
#elif defined(DOUBLE)
dsbmv_thread_U, dsbmv_thread_L,
#else
ssbmv_thread_U, ssbmv_thread_L,
#endif
};
#endif
#ifndef CBLAS
void NAME(char *UPLO, blasint *N, blasint *K, FLOAT *ALPHA, FLOAT *a, blasint *LDA,
FLOAT *x, blasint *INCX, FLOAT *BETA, FLOAT *y, blasint *INCY){
char uplo_arg = *UPLO;
blasint n = *N;
blasint k = *K;
FLOAT alpha = *ALPHA;
blasint lda = *LDA;
blasint incx = *INCX;
FLOAT beta = *BETA;
blasint incy = *INCY;
blasint info;
int uplo;
FLOAT *buffer;
#ifdef SMPTEST
int nthreads;
#endif
PRINT_DEBUG_NAME;
TOUPPER(uplo_arg);
uplo = -1;
if (uplo_arg == 'U') uplo = 0;
if (uplo_arg == 'L') uplo = 1;
info = 0;
if (incy == 0) info = 11;
if (incx == 0) info = 8;
if (lda < k + 1) info = 6;
if (k < 0) info = 3;
if (n < 0) info = 2;
if (uplo < 0) info = 1;
if (info != 0) {
BLASFUNC(xerbla)(ERROR_NAME, &info, sizeof(ERROR_NAME));
return;
}
#else
void CNAME(enum CBLAS_ORDER order,
enum CBLAS_UPLO Uplo,
blasint n, blasint k,
FLOAT alpha,
FLOAT *a, blasint lda,
FLOAT *x, blasint incx,
FLOAT beta,
FLOAT *y, blasint incy){
FLOAT *buffer;
int uplo;
blasint info;
#ifdef SMPTEST
int nthreads;
#endif
PRINT_DEBUG_CNAME;
uplo = -1;
info = 0;
if (order == CblasColMajor) {
if (Uplo == CblasUpper) uplo = 0;
if (Uplo == CblasLower) uplo = 1;
info = -1;
if (incy == 0) info = 11;
if (incx == 0) info = 8;
if (lda < k + 1) info = 6;
if (k < 0) info = 3;
if (n < 0) info = 2;
if (uplo < 0) info = 1;
}
if (order == CblasRowMajor) {
if (Uplo == CblasUpper) uplo = 1;
if (Uplo == CblasLower) uplo = 0;
info = -1;
if (incy == 0) info = 11;
if (incx == 0) info = 8;
if (lda < k + 1) info = 6;
if (k < 0) info = 3;
if (n < 0) info = 2;
if (uplo < 0) info = 1;
}
if (info >= 0) {
BLASFUNC(xerbla)(ERROR_NAME, &info, sizeof(ERROR_NAME));
return;
}
#endif
if (n == 0) return;
if (beta != ONE) SCAL_K(n, 0, 0, beta, y, abs(incy), NULL, 0, NULL, 0);
if (alpha == ZERO) return;
IDEBUG_START;
FUNCTION_PROFILE_START();
if (incx < 0 ) x -= (n - 1) * incx;
if (incy < 0 ) y -= (n - 1) * incy;
buffer = (FLOAT *)blas_memory_alloc(1);
#ifdef SMPTEST
nthreads = num_cpu_avail(2);
if (nthreads == 1) {
#endif
(sbmv[uplo])(n, k, alpha, a, lda, x, incx, y, incy, buffer);
#ifdef SMPTEST
} else {
(sbmv_thread[uplo])(n, k, alpha, a, lda, x, incx, y, incy, buffer, nthreads);
}
#endif
blas_memory_free(buffer);
FUNCTION_PROFILE_END(1, n * k / 2 + n, n * k);
IDEBUG_END;
return;
}

112
interface/scal.c Normal file
View File

@ -0,0 +1,112 @@
/*********************************************************************/
/* Copyright 2009, 2010 The University of Texas at Austin. */
/* All rights reserved. */
/* */
/* Redistribution and use in source and binary forms, with or */
/* without modification, are permitted provided that the following */
/* conditions are met: */
/* */
/* 1. Redistributions of source code must retain the above */
/* copyright notice, this list of conditions and the following */
/* disclaimer. */
/* */
/* 2. Redistributions in binary form must reproduce the above */
/* copyright notice, this list of conditions and the following */
/* disclaimer in the documentation and/or other materials */
/* provided with the distribution. */
/* */
/* THIS SOFTWARE IS PROVIDED BY THE UNIVERSITY OF TEXAS AT */
/* AUSTIN ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, */
/* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF */
/* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE */
/* DISCLAIMED. IN NO EVENT SHALL THE UNIVERSITY OF TEXAS AT */
/* AUSTIN OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, */
/* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES */
/* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE */
/* GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR */
/* BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF */
/* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT */
/* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT */
/* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE */
/* POSSIBILITY OF SUCH DAMAGE. */
/* */
/* The views and conclusions contained in the software and */
/* documentation are those of the authors and should not be */
/* interpreted as representing official policies, either expressed */
/* or implied, of The University of Texas at Austin. */
/*********************************************************************/
#include <stdio.h>
#include "common.h"
#ifdef FUNCTION_PROFILE
#include "functable.h"
#endif
#ifndef CBLAS
void NAME(blasint *N, FLOAT *ALPHA, FLOAT *x, blasint *INCX){
blasint n = *N;
blasint incx = *INCX;
FLOAT alpha = *ALPHA;
#else
void CNAME(blasint n, FLOAT alpha, FLOAT *x, blasint incx){
#endif
#ifdef SMP
int mode, nthreads;
#endif
#ifndef CBLAS
PRINT_DEBUG_NAME;
#else
PRINT_DEBUG_CNAME;
#endif
if (incx <= 0 || n <= 0) return;
if (alpha == ONE) return;
IDEBUG_START;
FUNCTION_PROFILE_START();
#ifdef SMP
nthreads = num_cpu_avail(1);
if (nthreads == 1) {
#endif
SCAL_K(n, 0, 0, alpha, x, incx, NULL, 0, NULL, 0);
#ifdef SMP
} else {
#ifdef DOUBLE
mode = BLAS_DOUBLE | BLAS_REAL;
#else
mode = BLAS_SINGLE | BLAS_REAL;
#endif
blas_level1_thread(mode, n, 0, 0,
#ifndef CBLAS
ALPHA,
#else
&alpha,
#endif
x, incx, NULL, 0, NULL, 0, (void *)SCAL_K, nthreads);
}
#endif
FUNCTION_PROFILE_END(1, n, n);
IDEBUG_END;
return;
}

101
interface/sdsdot.c Normal file
View File

@ -0,0 +1,101 @@
/*********************************************************************/
/* Copyright 2009, 2010 The University of Texas at Austin. */
/* All rights reserved. */
/* */
/* Redistribution and use in source and binary forms, with or */
/* without modification, are permitted provided that the following */
/* conditions are met: */
/* */
/* 1. Redistributions of source code must retain the above */
/* copyright notice, this list of conditions and the following */
/* disclaimer. */
/* */
/* 2. Redistributions in binary form must reproduce the above */
/* copyright notice, this list of conditions and the following */
/* disclaimer in the documentation and/or other materials */
/* provided with the distribution. */
/* */
/* THIS SOFTWARE IS PROVIDED BY THE UNIVERSITY OF TEXAS AT */
/* AUSTIN ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, */
/* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF */
/* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE */
/* DISCLAIMED. IN NO EVENT SHALL THE UNIVERSITY OF TEXAS AT */
/* AUSTIN OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, */
/* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES */
/* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE */
/* GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR */
/* BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF */
/* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT */
/* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT */
/* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE */
/* POSSIBILITY OF SUCH DAMAGE. */
/* */
/* The views and conclusions contained in the software and */
/* documentation are those of the authors and should not be */
/* interpreted as representing official policies, either expressed */
/* or implied, of The University of Texas at Austin. */
/*********************************************************************/
#include <stdio.h>
#include "common.h"
#ifdef FUNCTION_PROFILE
#include "functable.h"
#endif
#ifndef CBLAS
FLOATRET NAME(blasint *N, FLOAT *a, FLOAT *x, blasint *INCX, FLOAT *y, blasint *INCY){
BLASLONG n = *N;
BLASLONG incx = *INCX;
BLASLONG incy = *INCY;
FLOATRET ret;
PRINT_DEBUG_NAME;
if (n <= 0) return(*a) ;
IDEBUG_START;
FUNCTION_PROFILE_START();
if (incx < 0) x -= (n - 1) * incx;
if (incy < 0) y -= (n - 1) * incy;
ret = (FLOATRET)(SDSDOT_K(n, x, incx, y, incy) + *a);
FUNCTION_PROFILE_END(1, 2 * n, 2 * n);
IDEBUG_END;
return ret;
}
#else
FLOAT CNAME(blasint n, FLOAT alpha, FLOAT *x, blasint incx, FLOAT *y, blasint incy){
FLOAT ret;
PRINT_DEBUG_CNAME;
if (n <= 0) return (alpha);
IDEBUG_START;
FUNCTION_PROFILE_START();
if (incx < 0) x -= (n - 1) * incx;
if (incy < 0) y -= (n - 1) * incy;
ret = SDSDOT_K(n, x, incx, y, incy) + alpha;
FUNCTION_PROFILE_END(1, 2 * n, 2 * n);
IDEBUG_END;
return ret;
}
#endif

207
interface/spmv.c Normal file
View File

@ -0,0 +1,207 @@
/*********************************************************************/
/* Copyright 2009, 2010 The University of Texas at Austin. */
/* All rights reserved. */
/* */
/* Redistribution and use in source and binary forms, with or */
/* without modification, are permitted provided that the following */
/* conditions are met: */
/* */
/* 1. Redistributions of source code must retain the above */
/* copyright notice, this list of conditions and the following */
/* disclaimer. */
/* */
/* 2. Redistributions in binary form must reproduce the above */
/* copyright notice, this list of conditions and the following */
/* disclaimer in the documentation and/or other materials */
/* provided with the distribution. */
/* */
/* THIS SOFTWARE IS PROVIDED BY THE UNIVERSITY OF TEXAS AT */
/* AUSTIN ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, */
/* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF */
/* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE */
/* DISCLAIMED. IN NO EVENT SHALL THE UNIVERSITY OF TEXAS AT */
/* AUSTIN OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, */
/* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES */
/* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE */
/* GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR */
/* BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF */
/* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT */
/* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT */
/* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE */
/* POSSIBILITY OF SUCH DAMAGE. */
/* */
/* The views and conclusions contained in the software and */
/* documentation are those of the authors and should not be */
/* interpreted as representing official policies, either expressed */
/* or implied, of The University of Texas at Austin. */
/*********************************************************************/
#include <stdio.h>
#include <ctype.h>
#include "common.h"
#ifdef FUNCTION_PROFILE
#include "functable.h"
#endif
#ifdef XDOUBLE
#define ERROR_NAME "QSPMV "
#elif defined(DOUBLE)
#define ERROR_NAME "DSPMV "
#else
#define ERROR_NAME "SSPMV "
#endif
static int (*spmv[])(BLASLONG, FLOAT, FLOAT *, FLOAT *, BLASLONG, FLOAT *, BLASLONG, void *) = {
#ifdef XDOUBLE
qspmv_U, qspmv_L,
#elif defined(DOUBLE)
dspmv_U, dspmv_L,
#else
sspmv_U, sspmv_L,
#endif
};
#ifdef SMPTEST
static int (*spmv_thread[])(BLASLONG, FLOAT, FLOAT *, FLOAT *, BLASLONG, FLOAT *, BLASLONG, FLOAT *, int) = {
#ifdef XDOUBLE
qspmv_thread_U, qspmv_thread_L,
#elif defined(DOUBLE)
dspmv_thread_U, dspmv_thread_L,
#else
sspmv_thread_U, sspmv_thread_L,
#endif
};
#endif
#ifndef CBLAS
void NAME(char *UPLO, blasint *N, FLOAT *ALPHA, FLOAT *a,
FLOAT *x, blasint *INCX, FLOAT *BETA, FLOAT *y, blasint *INCY){
char uplo_arg = *UPLO;
blasint n = *N;
FLOAT alpha = *ALPHA;
blasint incx = *INCX;
FLOAT beta = *BETA;
blasint incy = *INCY;
blasint info;
int uplo;
FLOAT *buffer;
#ifdef SMPTEST
int nthreads;
#endif
PRINT_DEBUG_NAME;
TOUPPER(uplo_arg);
uplo = -1;
if (uplo_arg == 'U') uplo = 0;
if (uplo_arg == 'L') uplo = 1;
info = 0;
if (incy == 0) info = 9;
if (incx == 0) info = 6;
if (n < 0) info = 2;
if (uplo < 0) info = 1;
if (info != 0) {
BLASFUNC(xerbla)(ERROR_NAME, &info, sizeof(ERROR_NAME));
return;
}
#else
void CNAME(enum CBLAS_ORDER order,
enum CBLAS_UPLO Uplo,
blasint n,
FLOAT alpha,
FLOAT *a,
FLOAT *x, blasint incx,
FLOAT beta,
FLOAT *y, blasint incy){
FLOAT *buffer;
int uplo;
blasint info;
#ifdef SMPTEST
int nthreads;
#endif
PRINT_DEBUG_CNAME;
uplo = -1;
info = 0;
if (order == CblasColMajor) {
if (Uplo == CblasUpper) uplo = 0;
if (Uplo == CblasLower) uplo = 1;
info = -1;
if (incy == 0) info = 9;
if (incx == 0) info = 6;
if (n < 0) info = 2;
if (uplo < 0) info = 1;
}
if (order == CblasRowMajor) {
if (Uplo == CblasUpper) uplo = 1;
if (Uplo == CblasLower) uplo = 0;
info = -1;
if (incy == 0) info = 9;
if (incx == 0) info = 6;
if (n < 0) info = 2;
if (uplo < 0) info = 1;
}
if (info >= 0) {
BLASFUNC(xerbla)(ERROR_NAME, &info, sizeof(ERROR_NAME));
return;
}
#endif
if (n == 0) return;
if (beta != ONE) SCAL_K(n, 0, 0, beta, y, abs(incy), NULL, 0, NULL, 0);
if (alpha == ZERO) return;
IDEBUG_START;
FUNCTION_PROFILE_START();
if (incx < 0 ) x -= (n - 1) * incx;
if (incy < 0 ) y -= (n - 1) * incy;
buffer = (FLOAT *)blas_memory_alloc(1);
#ifdef SMPTEST
nthreads = num_cpu_avail(2);
if (nthreads == 1) {
#endif
(spmv[uplo])(n, alpha, a, x, incx, y, incy, buffer);
#ifdef SMPTEST
} else {
(spmv_thread[uplo])(n, alpha, a, x, incx, y, incy, buffer, nthreads);
}
#endif
blas_memory_free(buffer);
FUNCTION_PROFILE_END(1, n * n / 2 + n, n * n);
IDEBUG_END;
return;
}

197
interface/spr.c Normal file
View File

@ -0,0 +1,197 @@
/*********************************************************************/
/* Copyright 2009, 2010 The University of Texas at Austin. */
/* All rights reserved. */
/* */
/* Redistribution and use in source and binary forms, with or */
/* without modification, are permitted provided that the following */
/* conditions are met: */
/* */
/* 1. Redistributions of source code must retain the above */
/* copyright notice, this list of conditions and the following */
/* disclaimer. */
/* */
/* 2. Redistributions in binary form must reproduce the above */
/* copyright notice, this list of conditions and the following */
/* disclaimer in the documentation and/or other materials */
/* provided with the distribution. */
/* */
/* THIS SOFTWARE IS PROVIDED BY THE UNIVERSITY OF TEXAS AT */
/* AUSTIN ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, */
/* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF */
/* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE */
/* DISCLAIMED. IN NO EVENT SHALL THE UNIVERSITY OF TEXAS AT */
/* AUSTIN OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, */
/* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES */
/* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE */
/* GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR */
/* BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF */
/* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT */
/* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT */
/* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE */
/* POSSIBILITY OF SUCH DAMAGE. */
/* */
/* The views and conclusions contained in the software and */
/* documentation are those of the authors and should not be */
/* interpreted as representing official policies, either expressed */
/* or implied, of The University of Texas at Austin. */
/*********************************************************************/
#include <stdio.h>
#include <ctype.h>
#include "common.h"
#ifdef FUNCTION_PROFILE
#include "functable.h"
#endif
#ifdef XDOUBLE
#define ERROR_NAME "QSPR "
#elif defined(DOUBLE)
#define ERROR_NAME "DSPR "
#else
#define ERROR_NAME "SSPR "
#endif
static int (*spr[])(BLASLONG, FLOAT, FLOAT *, BLASLONG, FLOAT *, FLOAT *) = {
#ifdef XDOUBLE
qspr_U, qspr_L,
#elif defined(DOUBLE)
dspr_U, dspr_L,
#else
sspr_U, sspr_L,
#endif
};
#ifdef SMPTEST
static int (*spr_thread[])(BLASLONG, FLOAT, FLOAT *, BLASLONG, FLOAT *, FLOAT *, int) = {
#ifdef XDOUBLE
qspr_thread_U, qspr_thread_L,
#elif defined(DOUBLE)
dspr_thread_U, dspr_thread_L,
#else
sspr_thread_U, sspr_thread_L,
#endif
};
#endif
#ifndef CBLAS
void NAME(char *UPLO, blasint *N, FLOAT *ALPHA,
FLOAT *x, blasint *INCX, FLOAT *a){
char uplo_arg = *UPLO;
blasint n = *N;
FLOAT alpha = *ALPHA;
blasint incx = *INCX;
blasint info;
int uplo;
FLOAT *buffer;
#ifdef SMPTEST
int nthreads;
#endif
PRINT_DEBUG_NAME;
TOUPPER(uplo_arg);
uplo = -1;
if (uplo_arg == 'U') uplo = 0;
if (uplo_arg == 'L') uplo = 1;
info = 0;
if (incx == 0) info = 5;
if (n < 0) info = 2;
if (uplo < 0) info = 1;
if (info != 0) {
BLASFUNC(xerbla)(ERROR_NAME, &info, sizeof(ERROR_NAME));
return;
}
#else
void CNAME(enum CBLAS_ORDER order,
enum CBLAS_UPLO Uplo,
blasint n,
FLOAT alpha,
FLOAT *x, blasint incx,
FLOAT *a) {
FLOAT *buffer;
int uplo;
blasint info;
#ifdef SMPTEST
int nthreads;
#endif
PRINT_DEBUG_CNAME;
uplo = -1;
info = 0;
if (order == CblasColMajor) {
if (Uplo == CblasUpper) uplo = 0;
if (Uplo == CblasLower) uplo = 1;
info = -1;
if (incx == 0) info = 5;
if (n < 0) info = 2;
if (uplo < 0) info = 1;
}
if (order == CblasRowMajor) {
if (Uplo == CblasUpper) uplo = 1;
if (Uplo == CblasLower) uplo = 0;
info = -1;
if (incx == 0) info = 5;
if (n < 0) info = 2;
if (uplo < 0) info = 1;
}
if (info >= 0) {
BLASFUNC(xerbla)(ERROR_NAME, &info, sizeof(ERROR_NAME));
return;
}
#endif
if (n == 0) return;
if (alpha == ZERO) return;
IDEBUG_START;
FUNCTION_PROFILE_START();
if (incx < 0 ) x -= (n - 1) * incx;
buffer = (FLOAT *)blas_memory_alloc(1);
#ifdef SMPTEST
nthreads = num_cpu_avail(2);
if (nthreads == 1) {
#endif
(spr[uplo])(n, alpha, x, incx, a, buffer);
#ifdef SMPTEST
} else {
(spr_thread[uplo])(n, alpha, x, incx, a, buffer, nthreads);
}
#endif
blas_memory_free(buffer);
FUNCTION_PROFILE_END(1, n * n / 2 + n, n * n);
IDEBUG_END;
return;
}

203
interface/spr2.c Normal file
View File

@ -0,0 +1,203 @@
/*********************************************************************/
/* Copyright 2009, 2010 The University of Texas at Austin. */
/* All rights reserved. */
/* */
/* Redistribution and use in source and binary forms, with or */
/* without modification, are permitted provided that the following */
/* conditions are met: */
/* */
/* 1. Redistributions of source code must retain the above */
/* copyright notice, this list of conditions and the following */
/* disclaimer. */
/* */
/* 2. Redistributions in binary form must reproduce the above */
/* copyright notice, this list of conditions and the following */
/* disclaimer in the documentation and/or other materials */
/* provided with the distribution. */
/* */
/* THIS SOFTWARE IS PROVIDED BY THE UNIVERSITY OF TEXAS AT */
/* AUSTIN ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, */
/* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF */
/* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE */
/* DISCLAIMED. IN NO EVENT SHALL THE UNIVERSITY OF TEXAS AT */
/* AUSTIN OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, */
/* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES */
/* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE */
/* GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR */
/* BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF */
/* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT */
/* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT */
/* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE */
/* POSSIBILITY OF SUCH DAMAGE. */
/* */
/* The views and conclusions contained in the software and */
/* documentation are those of the authors and should not be */
/* interpreted as representing official policies, either expressed */
/* or implied, of The University of Texas at Austin. */
/*********************************************************************/
#include <stdio.h>
#include <ctype.h>
#include "common.h"
#ifdef FUNCTION_PROFILE
#include "functable.h"
#endif
#ifdef XDOUBLE
#define ERROR_NAME "QSPR2 "
#elif defined(DOUBLE)
#define ERROR_NAME "DSPR2 "
#else
#define ERROR_NAME "SSPR2 "
#endif
static int (*spr2[])(BLASLONG, FLOAT, FLOAT *, BLASLONG, FLOAT *, BLASLONG, FLOAT *, FLOAT *) = {
#ifdef XDOUBLE
qspr2_U, qspr2_L,
#elif defined(DOUBLE)
dspr2_U, dspr2_L,
#else
sspr2_U, sspr2_L,
#endif
};
#ifdef SMPTEST
static int (*spr2_thread[])(BLASLONG, FLOAT, FLOAT *, BLASLONG, FLOAT *, BLASLONG, FLOAT *, FLOAT *, int) = {
#ifdef XDOUBLE
qspr2_thread_U, qspr2_thread_L,
#elif defined(DOUBLE)
dspr2_thread_U, dspr2_thread_L,
#else
sspr2_thread_U, sspr2_thread_L,
#endif
};
#endif
#ifndef CBLAS
void NAME(char *UPLO, blasint *N, FLOAT *ALPHA,
FLOAT *x, blasint *INCX, FLOAT *y, blasint *INCY, FLOAT *a){
char uplo_arg = *UPLO;
blasint n = *N;
FLOAT alpha = *ALPHA;
blasint incx = *INCX;
blasint incy = *INCY;
blasint info;
int uplo;
FLOAT *buffer;
#ifdef SMPTEST
int nthreads;
#endif
PRINT_DEBUG_NAME;
TOUPPER(uplo_arg);
uplo = -1;
if (uplo_arg == 'U') uplo = 0;
if (uplo_arg == 'L') uplo = 1;
info = 0;
if (incy == 0) info = 7;
if (incx == 0) info = 5;
if (n < 0) info = 2;
if (uplo < 0) info = 1;
if (info != 0) {
BLASFUNC(xerbla)(ERROR_NAME, &info, sizeof(ERROR_NAME));
return;
}
#else
void CNAME(enum CBLAS_ORDER order,
enum CBLAS_UPLO Uplo,
blasint n,
FLOAT alpha,
FLOAT *x, blasint incx,
FLOAT *y, blasint incy,
FLOAT *a) {
FLOAT *buffer;
int uplo;
blasint info;
#ifdef SMPTEST
int nthreads;
#endif
PRINT_DEBUG_CNAME;
uplo = -1;
info = 0;
if (order == CblasColMajor) {
if (Uplo == CblasUpper) uplo = 0;
if (Uplo == CblasLower) uplo = 1;
info = -1;
if (incy == 0) info = 7;
if (incx == 0) info = 5;
if (n < 0) info = 2;
if (uplo < 0) info = 1;
}
if (order == CblasRowMajor) {
if (Uplo == CblasUpper) uplo = 1;
if (Uplo == CblasLower) uplo = 0;
info = -1;
if (incy == 0) info = 7;
if (incx == 0) info = 5;
if (n < 0) info = 2;
if (uplo < 0) info = 1;
}
if (info >= 0) {
BLASFUNC(xerbla)(ERROR_NAME, &info, sizeof(ERROR_NAME));
return;
}
#endif
if (n == 0) return;
if (alpha == ZERO) return;
IDEBUG_START;
FUNCTION_PROFILE_START();
if (incx < 0 ) x -= (n - 1) * incx;
if (incy < 0 ) y -= (n - 1) * incy;
buffer = (FLOAT *)blas_memory_alloc(1);
#ifdef SMPTEST
nthreads = num_cpu_avail(2);
if (nthreads == 1) {
#endif
(spr2[uplo])(n, alpha, x, incx, y, incy, a, buffer);
#ifdef SMPTEST
} else {
(spr2_thread[uplo])(n, alpha, x, incx, y, incy, a, buffer, nthreads);
}
#endif
blas_memory_free(buffer);
FUNCTION_PROFILE_END(1, n * n / 2 + 2 * n, 2 * n * n);
IDEBUG_END;
return;
}

115
interface/swap.c Normal file
View File

@ -0,0 +1,115 @@
/*********************************************************************/
/* Copyright 2009, 2010 The University of Texas at Austin. */
/* All rights reserved. */
/* */
/* Redistribution and use in source and binary forms, with or */
/* without modification, are permitted provided that the following */
/* conditions are met: */
/* */
/* 1. Redistributions of source code must retain the above */
/* copyright notice, this list of conditions and the following */
/* disclaimer. */
/* */
/* 2. Redistributions in binary form must reproduce the above */
/* copyright notice, this list of conditions and the following */
/* disclaimer in the documentation and/or other materials */
/* provided with the distribution. */
/* */
/* THIS SOFTWARE IS PROVIDED BY THE UNIVERSITY OF TEXAS AT */
/* AUSTIN ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, */
/* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF */
/* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE */
/* DISCLAIMED. IN NO EVENT SHALL THE UNIVERSITY OF TEXAS AT */
/* AUSTIN OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, */
/* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES */
/* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE */
/* GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR */
/* BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF */
/* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT */
/* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT */
/* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE */
/* POSSIBILITY OF SUCH DAMAGE. */
/* */
/* The views and conclusions contained in the software and */
/* documentation are those of the authors and should not be */
/* interpreted as representing official policies, either expressed */
/* or implied, of The University of Texas at Austin. */
/*********************************************************************/
#include <stdio.h>
#include "common.h"
#ifdef FUNCTION_PROFILE
#include "functable.h"
#endif
#ifndef CBLAS
void NAME(blasint *N, FLOAT *x, blasint *INCX, FLOAT *y, blasint *INCY){
blasint n = *N;
blasint incx = *INCX;
blasint incy = *INCY;
#else
void CNAME(blasint n, FLOAT *x, blasint incx, FLOAT *y, blasint incy){
#endif
#ifdef SMP
int mode, nthreads;
FLOAT dummyalpha[2] = {ZERO, ZERO};
#endif
#ifndef CBLAS
PRINT_DEBUG_NAME;
#else
PRINT_DEBUG_CNAME;
#endif
if (n <= 0) return;
IDEBUG_START;
FUNCTION_PROFILE_START();
if (incx < 0) x -= (n - 1) * incx;
if (incy < 0) y -= (n - 1) * incy;
#ifdef SMP
nthreads = num_cpu_avail(1);
//disable multi-thread when incx==0 or incy==0
//In that case, the threads would be dependent.
if (incx == 0 || incy == 0)
nthreads = 1;
if (nthreads == 1) {
#endif
SWAP_K(n, 0, 0, ZERO, x, incx, y, incy, NULL, 0);
#ifdef SMP
} else {
#ifdef XDOUBLE
mode = BLAS_XDOUBLE | BLAS_REAL;
#elif defined(DOUBLE)
mode = BLAS_DOUBLE | BLAS_REAL;
#else
mode = BLAS_SINGLE | BLAS_REAL;
#endif
blas_level1_thread(mode, n, 0, 0, dummyalpha,
x, incx, y, incy, NULL, 0, (void *)SWAP_K, nthreads);
}
#endif
FUNCTION_PROFILE_END(1, 2 * n, 0);
IDEBUG_END;
return;
}

442
interface/symm.c Normal file
View File

@ -0,0 +1,442 @@
/*********************************************************************/
/* Copyright 2009, 2010 The University of Texas at Austin. */
/* All rights reserved. */
/* */
/* Redistribution and use in source and binary forms, with or */
/* without modification, are permitted provided that the following */
/* conditions are met: */
/* */
/* 1. Redistributions of source code must retain the above */
/* copyright notice, this list of conditions and the following */
/* disclaimer. */
/* */
/* 2. Redistributions in binary form must reproduce the above */
/* copyright notice, this list of conditions and the following */
/* disclaimer in the documentation and/or other materials */
/* provided with the distribution. */
/* */
/* THIS SOFTWARE IS PROVIDED BY THE UNIVERSITY OF TEXAS AT */
/* AUSTIN ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, */
/* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF */
/* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE */
/* DISCLAIMED. IN NO EVENT SHALL THE UNIVERSITY OF TEXAS AT */
/* AUSTIN OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, */
/* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES */
/* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE */
/* GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR */
/* BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF */
/* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT */
/* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT */
/* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE */
/* POSSIBILITY OF SUCH DAMAGE. */
/* */
/* The views and conclusions contained in the software and */
/* documentation are those of the authors and should not be */
/* interpreted as representing official policies, either expressed */
/* or implied, of The University of Texas at Austin. */
/*********************************************************************/
#include <stdio.h>
#include <ctype.h>
#include "common.h"
#ifdef FUNCTION_PROFILE
#include "functable.h"
#endif
#ifndef COMPLEX
#ifdef XDOUBLE
#define ERROR_NAME "QSYMM "
#elif defined(DOUBLE)
#define ERROR_NAME "DSYMM "
#else
#define ERROR_NAME "SSYMM "
#endif
#else
#ifndef GEMM3M
#ifndef HEMM
#ifdef XDOUBLE
#define ERROR_NAME "XSYMM "
#elif defined(DOUBLE)
#define ERROR_NAME "ZSYMM "
#else
#define ERROR_NAME "CSYMM "
#endif
#else
#ifdef XDOUBLE
#define ERROR_NAME "XHEMM "
#elif defined(DOUBLE)
#define ERROR_NAME "ZHEMM "
#else
#define ERROR_NAME "CHEMM "
#endif
#endif
#else
#ifndef HEMM
#ifdef XDOUBLE
#define ERROR_NAME "XSYMM3M "
#elif defined(DOUBLE)
#define ERROR_NAME "ZSYMM3M "
#else
#define ERROR_NAME "CSYMM3M "
#endif
#else
#ifdef XDOUBLE
#define ERROR_NAME "XHEMM3M "
#elif defined(DOUBLE)
#define ERROR_NAME "ZHEMM3M "
#else
#define ERROR_NAME "CHEMM3M "
#endif
#endif
#endif
#endif
static int (*symm[])(blas_arg_t *, BLASLONG *, BLASLONG *, FLOAT *, FLOAT *, BLASLONG) = {
#ifndef GEMM3M
#ifndef HEMM
SYMM_LU, SYMM_LL, SYMM_RU, SYMM_RL,
#if defined(SMPTEST) && !defined(USE_SIMPLE_THREADED_LEVEL3)
SYMM_THREAD_LU, SYMM_THREAD_LL, SYMM_THREAD_RU, SYMM_THREAD_RL,
#endif
#else
HEMM_LU, HEMM_LL, HEMM_RU, HEMM_RL,
#if defined(SMPTEST) && !defined(USE_SIMPLE_THREADED_LEVEL3)
HEMM_THREAD_LU, HEMM_THREAD_LL, HEMM_THREAD_RU, HEMM_THREAD_RL,
#endif
#endif
#else
#ifndef HEMM
SYMM3M_LU, SYMM3M_LL, SYMM3M_RU, SYMM3M_RL,
#if defined(SMPTEST) && !defined(USE_SIMPLE_THREADED_LEVEL3)
SYMM3M_THREAD_LU, SYMM3M_THREAD_LL, SYMM3M_THREAD_RU, SYMM3M_THREAD_RL,
#endif
#else
HEMM3M_LU, HEMM3M_LL, HEMM3M_RU, HEMM3M_RL,
#if defined(SMPTEST) && !defined(USE_SIMPLE_THREADED_LEVEL3)
HEMM3M_THREAD_LU, HEMM3M_THREAD_LL, HEMM3M_THREAD_RU, HEMM3M_THREAD_RL,
#endif
#endif
#endif
};
#ifndef CBLAS
void NAME(char *SIDE, char *UPLO,
blasint *M, blasint *N,
FLOAT *alpha, FLOAT *a, blasint *ldA,
FLOAT *b, blasint *ldB,
FLOAT *beta, FLOAT *c, blasint *ldC){
char side_arg = *SIDE;
char uplo_arg = *UPLO;
blas_arg_t args;
FLOAT *buffer;
FLOAT *sa, *sb;
#ifdef SMPTEST
#ifndef COMPLEX
#ifdef XDOUBLE
int mode = BLAS_XDOUBLE | BLAS_REAL;
#elif defined(DOUBLE)
int mode = BLAS_DOUBLE | BLAS_REAL;
#else
int mode = BLAS_SINGLE | BLAS_REAL;
#endif
#else
#ifdef XDOUBLE
int mode = BLAS_XDOUBLE | BLAS_COMPLEX;
#elif defined(DOUBLE)
int mode = BLAS_DOUBLE | BLAS_COMPLEX;
#else
int mode = BLAS_SINGLE | BLAS_COMPLEX;
#endif
#endif
#endif
#if defined(SMPTEST) && !defined(NO_AFFINITY)
int nodes;
#endif
blasint info;
int side;
int uplo;
PRINT_DEBUG_NAME;
args.alpha = (void *)alpha;
args.beta = (void *)beta;
TOUPPER(side_arg);
TOUPPER(uplo_arg);
side = -1;
uplo = -1;
if (side_arg == 'L') side = 0;
if (side_arg == 'R') side = 1;
if (uplo_arg == 'U') uplo = 0;
if (uplo_arg == 'L') uplo = 1;
args.m = *M;
args.n = *N;
args.c = (void *)c;
args.ldc = *ldC;
info = 0;
if (args.ldc < MAX(1, args.m)) info = 12;
if (!side) {
args.a = (void *)a;
args.b = (void *)b;
args.lda = *ldA;
args.ldb = *ldB;
if (args.ldb < MAX(1, args.m)) info = 9;
if (args.lda < MAX(1, args.m)) info = 7;
} else {
args.a = (void *)b;
args.b = (void *)a;
args.lda = *ldB;
args.ldb = *ldA;
if (args.lda < MAX(1, args.m)) info = 9;
if (args.ldb < MAX(1, args.n)) info = 7;
}
if (args.n < 0) info = 4;
if (args.m < 0) info = 3;
if (uplo < 0) info = 2;
if (side < 0) info = 1;
if (info != 0) {
BLASFUNC(xerbla)(ERROR_NAME, &info, sizeof(ERROR_NAME));
return;
}
#else
void CNAME(enum CBLAS_ORDER order, enum CBLAS_SIDE Side, enum CBLAS_UPLO Uplo,
blasint m, blasint n,
#ifndef COMPLEX
FLOAT alpha,
#else
FLOAT *alpha,
#endif
FLOAT *a, blasint lda,
FLOAT *b, blasint ldb,
#ifndef COMPLEX
FLOAT beta,
#else
FLOAT *beta,
#endif
FLOAT *c, blasint ldc) {
blas_arg_t args;
int side, uplo;
blasint info;
FLOAT *buffer;
FLOAT *sa, *sb;
#ifdef SMPTEST
#ifndef COMPLEX
#ifdef XDOUBLE
int mode = BLAS_XDOUBLE | BLAS_REAL;
#elif defined(DOUBLE)
int mode = BLAS_DOUBLE | BLAS_REAL;
#else
int mode = BLAS_SINGLE | BLAS_REAL;
#endif
#else
#ifdef XDOUBLE
int mode = BLAS_XDOUBLE | BLAS_COMPLEX;
#elif defined(DOUBLE)
int mode = BLAS_DOUBLE | BLAS_COMPLEX;
#else
int mode = BLAS_SINGLE | BLAS_COMPLEX;
#endif
#endif
#endif
#if defined(SMPTEST) && !defined(NO_AFFINITY)
int nodes;
#endif
PRINT_DEBUG_CNAME;
#ifndef COMPLEX
args.alpha = (void *)&alpha;
args.beta = (void *)&beta;
#else
args.alpha = (void *)alpha;
args.beta = (void *)beta;
#endif
args.c = (void *)c;
args.ldc = ldc;
side = -1;
uplo = -1;
info = 0;
if (order == CblasColMajor) {
if (Side == CblasLeft) side = 0;
if (Side == CblasRight) side = 1;
if (Uplo == CblasUpper) uplo = 0;
if (Uplo == CblasLower) uplo = 1;
info = -1;
args.m = m;
args.n = n;
if (args.ldc < MAX(1, args.m)) info = 12;
if (!side) {
args.a = (void *)a;
args.b = (void *)b;
args.lda = lda;
args.ldb = ldb;
if (args.ldb < MAX(1, args.m)) info = 9;
if (args.lda < MAX(1, args.m)) info = 7;
} else {
args.a = (void *)b;
args.b = (void *)a;
args.lda = ldb;
args.ldb = lda;
if (args.lda < MAX(1, args.m)) info = 9;
if (args.ldb < MAX(1, args.n)) info = 7;
}
if (args.n < 0) info = 4;
if (args.m < 0) info = 3;
if (uplo < 0) info = 2;
if (side < 0) info = 1;
}
if (order == CblasRowMajor) {
if (Side == CblasLeft) side = 1;
if (Side == CblasRight) side = 0;
if (Uplo == CblasUpper) uplo = 1;
if (Uplo == CblasLower) uplo = 0;
info = -1;
args.m = n;
args.n = m;
if (args.ldc < MAX(1, args.m)) info = 12;
if (!side) {
args.a = (void *)a;
args.b = (void *)b;
args.lda = lda;
args.ldb = ldb;
if (args.ldb < MAX(1, args.m)) info = 9;
if (args.lda < MAX(1, args.m)) info = 7;
} else {
args.a = (void *)b;
args.b = (void *)a;
args.lda = ldb;
args.ldb = lda;
if (args.lda < MAX(1, args.m)) info = 9;
if (args.ldb < MAX(1, args.n)) info = 7;
}
if (args.n < 0) info = 4;
if (args.m < 0) info = 3;
if (uplo < 0) info = 2;
if (side < 0) info = 1;
}
if (info >= 0) {
BLASFUNC(xerbla)(ERROR_NAME, &info, sizeof(ERROR_NAME));
return;
}
#endif
if (args.m == 0 || args.n == 0) return;
IDEBUG_START;
FUNCTION_PROFILE_START();
buffer = (FLOAT *)blas_memory_alloc(0);
sa = (FLOAT *)((BLASLONG)buffer + GEMM_OFFSET_A);
sb = (FLOAT *)(((BLASLONG)sa + ((GEMM_P * GEMM_Q * COMPSIZE * SIZE + GEMM_ALIGN) & ~GEMM_ALIGN)) + GEMM_OFFSET_B);
#ifdef SMPTEST
args.common = NULL;
args.nthreads = num_cpu_avail(3);
if (args.nthreads == 1) {
#endif
(symm[(side << 1) | uplo ])(&args, NULL, NULL, sa, sb, 0);
#ifdef SMPTEST
} else {
#ifndef NO_AFFINITY
nodes = get_num_nodes();
if (nodes > 1) {
args.nthreads /= nodes;
gemm_thread_mn(mode, &args, NULL, NULL,
symm[4 | (side << 1) | uplo ], sa, sb, nodes);
} else {
#endif
#ifndef USE_SIMPLE_THREADED_LEVEL3
(symm[4 | (side << 1) | uplo ])(&args, NULL, NULL, sa, sb, 0);
#else
GEMM_THREAD(mode, &args, NULL, NULL, symm[(side << 1) | uplo ], sa, sb, args.nthreads);
#endif
#ifndef NO_AFFINITY
}
#endif
}
#endif
blas_memory_free(buffer);
FUNCTION_PROFILE_END(COMPSIZE * COMPSIZE,
(!side)? args.m * (args.m / 2 + args.n) : args.n * (args.m + args.n / 2),
(!side)? 2 * args.m * args.m * args.n : 2 * args.m * args.n * args.n);
IDEBUG_END;
return;
}

205
interface/symv.c Normal file
View File

@ -0,0 +1,205 @@
/*********************************************************************/
/* Copyright 2009, 2010 The University of Texas at Austin. */
/* All rights reserved. */
/* */
/* Redistribution and use in source and binary forms, with or */
/* without modification, are permitted provided that the following */
/* conditions are met: */
/* */
/* 1. Redistributions of source code must retain the above */
/* copyright notice, this list of conditions and the following */
/* disclaimer. */
/* */
/* 2. Redistributions in binary form must reproduce the above */
/* copyright notice, this list of conditions and the following */
/* disclaimer in the documentation and/or other materials */
/* provided with the distribution. */
/* */
/* THIS SOFTWARE IS PROVIDED BY THE UNIVERSITY OF TEXAS AT */
/* AUSTIN ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, */
/* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF */
/* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE */
/* DISCLAIMED. IN NO EVENT SHALL THE UNIVERSITY OF TEXAS AT */
/* AUSTIN OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, */
/* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES */
/* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE */
/* GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR */
/* BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF */
/* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT */
/* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT */
/* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE */
/* POSSIBILITY OF SUCH DAMAGE. */
/* */
/* The views and conclusions contained in the software and */
/* documentation are those of the authors and should not be */
/* interpreted as representing official policies, either expressed */
/* or implied, of The University of Texas at Austin. */
/*********************************************************************/
#include <stdio.h>
#include <ctype.h>
#include "common.h"
#ifdef FUNCTION_PROFILE
#include "functable.h"
#endif
#ifdef XDOUBLE
#define ERROR_NAME "QSYMV "
#elif defined(DOUBLE)
#define ERROR_NAME "DSYMV "
#else
#define ERROR_NAME "SSYMV "
#endif
#ifndef CBLAS
void NAME(char *UPLO, blasint *N, FLOAT *ALPHA, FLOAT *a, blasint *LDA,
FLOAT *x, blasint *INCX, FLOAT *BETA, FLOAT *y, blasint *INCY){
char uplo_arg = *UPLO;
blasint n = *N;
FLOAT alpha = *ALPHA;
blasint lda = *LDA;
blasint incx = *INCX;
FLOAT beta = *BETA;
blasint incy = *INCY;
int (*symv[])(BLASLONG, BLASLONG, FLOAT, FLOAT *, BLASLONG, FLOAT *, BLASLONG, FLOAT *, BLASLONG, FLOAT *) = {
SYMV_U, SYMV_L,
};
#ifdef SMPTEST
int (*symv_thread[])(BLASLONG, FLOAT, FLOAT *, BLASLONG, FLOAT *, BLASLONG, FLOAT *, BLASLONG, FLOAT *, int) = {
SYMV_THREAD_U, SYMV_THREAD_L,
};
#endif
blasint info;
int uplo;
FLOAT *buffer;
#ifdef SMPTEST
int nthreads;
#endif
PRINT_DEBUG_NAME;
TOUPPER(uplo_arg);
uplo = -1;
if (uplo_arg == 'U') uplo = 0;
if (uplo_arg == 'L') uplo = 1;
info = 0;
if (incy == 0) info = 10;
if (incx == 0) info = 7;
if (lda < MAX(1, n)) info = 5;
if (n < 0) info = 2;
if (uplo < 0) info = 1;
if (info != 0) {
BLASFUNC(xerbla)(ERROR_NAME, &info, sizeof(ERROR_NAME));
return;
}
#else
void CNAME(enum CBLAS_ORDER order, enum CBLAS_UPLO Uplo, blasint n, FLOAT alpha,
FLOAT *a, blasint lda, FLOAT *x, blasint incx, FLOAT beta, FLOAT *y, blasint incy) {
FLOAT *buffer;
int uplo;
blasint info;
#ifdef SMPTEST
int nthreads;
#endif
int (*symv[])(BLASLONG, BLASLONG, FLOAT, FLOAT *, BLASLONG, FLOAT *, BLASLONG, FLOAT *, BLASLONG, FLOAT *) = {
SYMV_U, SYMV_L,
};
#ifdef SMPTEST
int (*symv_thread[])(BLASLONG, FLOAT, FLOAT *, BLASLONG, FLOAT *, BLASLONG, FLOAT *, BLASLONG, FLOAT *, int) = {
SYMV_THREAD_U, SYMV_THREAD_L,
};
#endif
PRINT_DEBUG_CNAME;
uplo = -1;
info = 0;
if (order == CblasColMajor) {
if (Uplo == CblasUpper) uplo = 0;
if (Uplo == CblasLower) uplo = 1;
info = -1;
if (incy == 0) info = 10;
if (incx == 0) info = 7;
if (lda < MAX(1, n)) info = 5;
if (n < 0) info = 2;
if (uplo < 0) info = 1;
}
if (order == CblasRowMajor) {
if (Uplo == CblasUpper) uplo = 1;
if (Uplo == CblasLower) uplo = 0;
info = -1;
if (incy == 0) info = 10;
if (incx == 0) info = 7;
if (lda < MAX(1, n)) info = 5;
if (n < 0) info = 2;
if (uplo < 0) info = 1;
}
if (info >= 0) {
BLASFUNC(xerbla)(ERROR_NAME, &info, sizeof(ERROR_NAME));
return;
}
#endif
if (n == 0) return;
if (beta != ONE) SCAL_K(n, 0, 0, beta, y, abs(incy), NULL, 0, NULL, 0);
if (alpha == ZERO) return;
IDEBUG_START;
FUNCTION_PROFILE_START();
if (incx < 0 ) x -= (n - 1) * incx;
if (incy < 0 ) y -= (n - 1) * incy;
buffer = (FLOAT *)blas_memory_alloc(1);
#ifdef SMPTEST
nthreads = num_cpu_avail(2);
if (nthreads == 1) {
#endif
(symv[uplo])(n, n, alpha, a, lda, x, incx, y, incy, buffer);
#ifdef SMPTEST
} else {
(symv_thread[uplo])(n, alpha, a, lda, x, incx, y, incy, buffer, nthreads);
}
#endif
blas_memory_free(buffer);
FUNCTION_PROFILE_END(1, n * n / 2 + 2 * n, 2 * n * n);
IDEBUG_END;
return;
}

200
interface/syr.c Normal file
View File

@ -0,0 +1,200 @@
/*********************************************************************/
/* Copyright 2009, 2010 The University of Texas at Austin. */
/* All rights reserved. */
/* */
/* Redistribution and use in source and binary forms, with or */
/* without modification, are permitted provided that the following */
/* conditions are met: */
/* */
/* 1. Redistributions of source code must retain the above */
/* copyright notice, this list of conditions and the following */
/* disclaimer. */
/* */
/* 2. Redistributions in binary form must reproduce the above */
/* copyright notice, this list of conditions and the following */
/* disclaimer in the documentation and/or other materials */
/* provided with the distribution. */
/* */
/* THIS SOFTWARE IS PROVIDED BY THE UNIVERSITY OF TEXAS AT */
/* AUSTIN ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, */
/* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF */
/* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE */
/* DISCLAIMED. IN NO EVENT SHALL THE UNIVERSITY OF TEXAS AT */
/* AUSTIN OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, */
/* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES */
/* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE */
/* GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR */
/* BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF */
/* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT */
/* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT */
/* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE */
/* POSSIBILITY OF SUCH DAMAGE. */
/* */
/* The views and conclusions contained in the software and */
/* documentation are those of the authors and should not be */
/* interpreted as representing official policies, either expressed */
/* or implied, of The University of Texas at Austin. */
/*********************************************************************/
#include <stdio.h>
#include <ctype.h>
#include "common.h"
#ifdef FUNCTION_PROFILE
#include "functable.h"
#endif
#ifdef XDOUBLE
#define ERROR_NAME "QSYR "
#elif defined(DOUBLE)
#define ERROR_NAME "DSYR "
#else
#define ERROR_NAME "SSYR "
#endif
static int (*syr[])(BLASLONG, FLOAT, FLOAT *, BLASLONG, FLOAT *, BLASLONG, FLOAT *) = {
#ifdef XDOUBLE
qsyr_U, qsyr_L,
#elif defined(DOUBLE)
dsyr_U, dsyr_L,
#else
ssyr_U, ssyr_L,
#endif
};
#ifdef SMPTEST
static int (*syr_thread[])(BLASLONG, FLOAT, FLOAT *, BLASLONG, FLOAT *, BLASLONG, FLOAT *, int) = {
#ifdef XDOUBLE
qsyr_thread_U, qsyr_thread_L,
#elif defined(DOUBLE)
dsyr_thread_U, dsyr_thread_L,
#else
ssyr_thread_U, ssyr_thread_L,
#endif
};
#endif
#ifndef CBLAS
void NAME(char *UPLO, blasint *N, FLOAT *ALPHA,
FLOAT *x, blasint *INCX, FLOAT *a, blasint *LDA){
char uplo_arg = *UPLO;
blasint n = *N;
FLOAT alpha = *ALPHA;
blasint lda = *LDA;
blasint incx = *INCX;
blasint info;
int uplo;
FLOAT *buffer;
#ifdef SMPTEST
int nthreads;
#endif
PRINT_DEBUG_NAME;
TOUPPER(uplo_arg);
uplo = -1;
if (uplo_arg == 'U') uplo = 0;
if (uplo_arg == 'L') uplo = 1;
info = 0;
if (lda < MAX(1, n)) info = 7;
if (incx == 0) info = 5;
if (n < 0) info = 2;
if (uplo < 0) info = 1;
if (info != 0) {
BLASFUNC(xerbla)(ERROR_NAME, &info, sizeof(ERROR_NAME));
return;
}
#else
void CNAME(enum CBLAS_ORDER order, enum CBLAS_UPLO Uplo, blasint n, FLOAT alpha, FLOAT *x, blasint incx, FLOAT *a, blasint lda) {
FLOAT *buffer;
int trans, uplo;
blasint info;
#ifdef SMPTEST
int nthreads;
#endif
PRINT_DEBUG_CNAME;
trans = -1;
uplo = -1;
info = 0;
if (order == CblasColMajor) {
if (Uplo == CblasUpper) uplo = 0;
if (Uplo == CblasLower) uplo = 1;
info = -1;
if (lda < MAX(1, n)) info = 7;
if (incx == 0) info = 5;
if (n < 0) info = 2;
if (uplo < 0) info = 1;
}
if (order == CblasRowMajor) {
if (Uplo == CblasUpper) uplo = 1;
if (Uplo == CblasLower) uplo = 0;
info = -1;
if (lda < MAX(1, n)) info = 7;
if (incx == 0) info = 5;
if (n < 0) info = 2;
if (uplo < 0) info = 1;
}
if (info >= 0) {
BLASFUNC(xerbla)(ERROR_NAME, &info, sizeof(ERROR_NAME));
return;
}
#endif
if (n == 0) return;
if (alpha == ZERO) return;
IDEBUG_START;
FUNCTION_PROFILE_START();
if (incx < 0 ) x -= (n - 1) * incx;
buffer = (FLOAT *)blas_memory_alloc(1);
#ifdef SMPTEST
nthreads = num_cpu_avail(2);
if (nthreads == 1) {
#endif
(syr[uplo])(n, alpha, x, incx, a, lda, buffer);
#ifdef SMPTEST
} else {
(syr_thread[uplo])(n, alpha, x, incx, a, lda, buffer, nthreads);
}
#endif
blas_memory_free(buffer);
FUNCTION_PROFILE_END(1, n * n / 2 + n, n * n);
IDEBUG_END;
return;
}

204
interface/syr2.c Normal file
View File

@ -0,0 +1,204 @@
/*********************************************************************/
/* Copyright 2009, 2010 The University of Texas at Austin. */
/* All rights reserved. */
/* */
/* Redistribution and use in source and binary forms, with or */
/* without modification, are permitted provided that the following */
/* conditions are met: */
/* */
/* 1. Redistributions of source code must retain the above */
/* copyright notice, this list of conditions and the following */
/* disclaimer. */
/* */
/* 2. Redistributions in binary form must reproduce the above */
/* copyright notice, this list of conditions and the following */
/* disclaimer in the documentation and/or other materials */
/* provided with the distribution. */
/* */
/* THIS SOFTWARE IS PROVIDED BY THE UNIVERSITY OF TEXAS AT */
/* AUSTIN ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, */
/* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF */
/* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE */
/* DISCLAIMED. IN NO EVENT SHALL THE UNIVERSITY OF TEXAS AT */
/* AUSTIN OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, */
/* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES */
/* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE */
/* GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR */
/* BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF */
/* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT */
/* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT */
/* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE */
/* POSSIBILITY OF SUCH DAMAGE. */
/* */
/* The views and conclusions contained in the software and */
/* documentation are those of the authors and should not be */
/* interpreted as representing official policies, either expressed */
/* or implied, of The University of Texas at Austin. */
/*********************************************************************/
#include <stdio.h>
#include <ctype.h>
#include "common.h"
#ifdef FUNCTION_PROFILE
#include "functable.h"
#endif
#ifdef XDOUBLE
#define ERROR_NAME "QSYR2 "
#elif defined(DOUBLE)
#define ERROR_NAME "DSYR2 "
#else
#define ERROR_NAME "SSYR2 "
#endif
static int (*syr2[])(BLASLONG, FLOAT, FLOAT *, BLASLONG, FLOAT *, BLASLONG, FLOAT *, BLASLONG, FLOAT *) = {
#ifdef XDOUBLE
qsyr2_U, qsyr2_L,
#elif defined(DOUBLE)
dsyr2_U, dsyr2_L,
#else
ssyr2_U, ssyr2_L,
#endif
};
#ifdef SMPTEST
static int (*syr2_thread[])(BLASLONG, FLOAT, FLOAT *, BLASLONG, FLOAT *, BLASLONG, FLOAT *, BLASLONG, FLOAT *, int) = {
#ifdef XDOUBLE
qsyr2_thread_U, qsyr2_thread_L,
#elif defined(DOUBLE)
dsyr2_thread_U, dsyr2_thread_L,
#else
ssyr2_thread_U, ssyr2_thread_L,
#endif
};
#endif
#ifndef CBLAS
void NAME(char *UPLO, blasint *N, FLOAT *ALPHA,
FLOAT *x, blasint *INCX, FLOAT *y, blasint *INCY, FLOAT *a, blasint *LDA){
char uplo_arg = *UPLO;
blasint n = *N;
FLOAT alpha = *ALPHA;
blasint lda = *LDA;
blasint incx = *INCX;
blasint incy = *INCY;
blasint info;
int uplo;
FLOAT *buffer;
#ifdef SMPTEST
int nthreads;
#endif
PRINT_DEBUG_NAME;
TOUPPER(uplo_arg);
uplo = -1;
if (uplo_arg == 'U') uplo = 0;
if (uplo_arg == 'L') uplo = 1;
info = 0;
if (lda < MAX(1, n)) info = 9;
if (incy == 0) info = 7;
if (incx == 0) info = 5;
if (n < 0) info = 2;
if (uplo < 0) info = 1;
if (info != 0) {
BLASFUNC(xerbla)(ERROR_NAME, &info, sizeof(ERROR_NAME));
return;
}
#else
void CNAME(enum CBLAS_ORDER order, enum CBLAS_UPLO Uplo, blasint n, FLOAT alpha, FLOAT *x, blasint incx, FLOAT *y, blasint incy, FLOAT *a, blasint lda) {
FLOAT *buffer;
int trans, uplo;
blasint info;
#ifdef SMPTEST
int nthreads;
#endif
PRINT_DEBUG_CNAME;
trans = -1;
uplo = -1;
info = 0;
if (order == CblasColMajor) {
if (Uplo == CblasUpper) uplo = 0;
if (Uplo == CblasLower) uplo = 1;
info = -1;
if (lda < MAX(1, n)) info = 9;
if (incy == 0) info = 7;
if (incx == 0) info = 5;
if (n < 0) info = 2;
if (uplo < 0) info = 1;
}
if (order == CblasRowMajor) {
if (Uplo == CblasUpper) uplo = 1;
if (Uplo == CblasLower) uplo = 0;
info = -1;
if (lda < MAX(1, n)) info = 9;
if (incy == 0) info = 7;
if (incx == 0) info = 5;
if (n < 0) info = 2;
if (uplo < 0) info = 1;
}
if (info >= 0) {
BLASFUNC(xerbla)(ERROR_NAME, &info, sizeof(ERROR_NAME));
return;
}
#endif
if (n == 0) return;
if (alpha == ZERO) return;
IDEBUG_START;
FUNCTION_PROFILE_START();
if (incx < 0 ) x -= (n - 1) * incx;
if (incy < 0 ) y -= (n - 1) * incy;
buffer = (FLOAT *)blas_memory_alloc(1);
#ifdef SMPTEST
nthreads = num_cpu_avail(2);
if (nthreads == 1) {
#endif
(syr2[uplo])(n, alpha, x, incx, y, incy, a, lda, buffer);
#ifdef SMPTEST
} else {
(syr2_thread[uplo])(n, alpha, x, incx, y, incy, a, lda, buffer, nthreads);
}
#endif
blas_memory_free(buffer);
FUNCTION_PROFILE_END(1, n * n / 2 + 2 * n, 2 * n * n);
IDEBUG_END;
return;
}

377
interface/syr2k.c Normal file
View File

@ -0,0 +1,377 @@
/*********************************************************************/
/* Copyright 2009, 2010 The University of Texas at Austin. */
/* All rights reserved. */
/* */
/* Redistribution and use in source and binary forms, with or */
/* without modification, are permitted provided that the following */
/* conditions are met: */
/* */
/* 1. Redistributions of source code must retain the above */
/* copyright notice, this list of conditions and the following */
/* disclaimer. */
/* */
/* 2. Redistributions in binary form must reproduce the above */
/* copyright notice, this list of conditions and the following */
/* disclaimer in the documentation and/or other materials */
/* provided with the distribution. */
/* */
/* THIS SOFTWARE IS PROVIDED BY THE UNIVERSITY OF TEXAS AT */
/* AUSTIN ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, */
/* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF */
/* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE */
/* DISCLAIMED. IN NO EVENT SHALL THE UNIVERSITY OF TEXAS AT */
/* AUSTIN OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, */
/* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES */
/* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE */
/* GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR */
/* BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF */
/* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT */
/* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT */
/* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE */
/* POSSIBILITY OF SUCH DAMAGE. */
/* */
/* The views and conclusions contained in the software and */
/* documentation are those of the authors and should not be */
/* interpreted as representing official policies, either expressed */
/* or implied, of The University of Texas at Austin. */
/*********************************************************************/
#include <stdio.h>
#include <ctype.h>
#include "common.h"
#ifdef FUNCTION_PROFILE
#include "functable.h"
#endif
#ifndef COMPLEX
#ifdef XDOUBLE
#define ERROR_NAME "QSYR2K"
#elif defined(DOUBLE)
#define ERROR_NAME "DSYR2K"
#else
#define ERROR_NAME "SSYR2K"
#endif
#else
#ifndef HEMM
#ifdef XDOUBLE
#define ERROR_NAME "XSYR2K"
#elif defined(DOUBLE)
#define ERROR_NAME "ZSYR2K"
#else
#define ERROR_NAME "CSYR2K"
#endif
#else
#ifdef XDOUBLE
#define ERROR_NAME "XHER2K"
#elif defined(DOUBLE)
#define ERROR_NAME "ZHER2K"
#else
#define ERROR_NAME "CHER2K"
#endif
#endif
#endif
static int (*syr2k[])(blas_arg_t *, BLASLONG *, BLASLONG *, FLOAT *, FLOAT *, BLASLONG) = {
#ifndef HEMM
SYR2K_UN, SYR2K_UC, SYR2K_LN, SYR2K_LC,
#else
HER2K_UN, HER2K_UC, HER2K_LN, HER2K_LC,
#endif
};
#ifndef CBLAS
void NAME(char *UPLO, char *TRANS,
blasint *N, blasint *K,
FLOAT *alpha, FLOAT *a, blasint *ldA,
FLOAT *b, blasint *ldB,
FLOAT *beta, FLOAT *c, blasint *ldC){
char uplo_arg = *UPLO;
char trans_arg = *TRANS;
blas_arg_t args;
FLOAT *buffer;
FLOAT *sa, *sb;
#ifdef SMPTEST
#ifndef COMPLEX
#ifdef XDOUBLE
int mode = BLAS_XDOUBLE | BLAS_REAL;
#elif defined(DOUBLE)
int mode = BLAS_DOUBLE | BLAS_REAL;
#else
int mode = BLAS_SINGLE | BLAS_REAL;
#endif
#else
#ifdef XDOUBLE
int mode = BLAS_XDOUBLE | BLAS_COMPLEX;
#elif defined(DOUBLE)
int mode = BLAS_DOUBLE | BLAS_COMPLEX;
#else
int mode = BLAS_SINGLE | BLAS_COMPLEX;
#endif
#endif
#endif
blasint info;
int uplo;
int trans;
int nrowa;
PRINT_DEBUG_NAME;
args.n = *N;
args.k = *K;
args.a = (void *)a;
args.b = (void *)b;
args.c = (void *)c;
args.lda = *ldA;
args.ldb = *ldB;
args.ldc = *ldC;
args.alpha = (void *)alpha;
args.beta = (void *)beta;
TOUPPER(uplo_arg);
TOUPPER(trans_arg);
uplo = -1;
trans = -1;
if (uplo_arg == 'U') uplo = 0;
if (uplo_arg == 'L') uplo = 1;
#ifndef COMPLEX
if (trans_arg == 'N') trans = 0;
if (trans_arg == 'T') trans = 1;
if (trans_arg == 'C') trans = 1;
#else
#ifdef HEMM
if (trans_arg == 'N') trans = 0;
if (trans_arg == 'C') trans = 1;
#else
if (trans_arg == 'N') trans = 0;
if (trans_arg == 'T') trans = 1;
#endif
#endif
nrowa = args.n;
if (trans & 1) nrowa = args.k;
info = 0;
if (args.ldc < MAX(1,args.n)) info = 12;
if (args.ldb < MAX(1,nrowa)) info = 9;
if (args.lda < MAX(1,nrowa)) info = 7;
if (args.k < 0) info = 4;
if (args.n < 0) info = 3;
if (trans < 0) info = 2;
if (uplo < 0) info = 1;
if (info != 0) {
BLASFUNC(xerbla)(ERROR_NAME, &info, sizeof(ERROR_NAME));
return;
}
#else
void CNAME(enum CBLAS_ORDER order, enum CBLAS_UPLO Uplo, enum CBLAS_TRANSPOSE Trans,
blasint n, blasint k,
#ifndef COMPLEX
FLOAT alpha,
#else
FLOAT *alpha,
#endif
FLOAT *a, blasint lda,
FLOAT *b, blasint ldb,
#if !defined(COMPLEX) || defined(HEMM)
FLOAT beta,
#else
FLOAT *beta,
#endif
FLOAT *c, blasint ldc) {
blas_arg_t args;
int uplo, trans;
blasint info, nrowa;
FLOAT *buffer;
FLOAT *sa, *sb;
#ifdef HEMM
FLOAT CAlpha[2];
#endif
#ifdef SMPTEST
#ifndef COMPLEX
#ifdef XDOUBLE
int mode = BLAS_XDOUBLE | BLAS_REAL;
#elif defined(DOUBLE)
int mode = BLAS_DOUBLE | BLAS_REAL;
#else
int mode = BLAS_SINGLE | BLAS_REAL;
#endif
#else
#ifdef XDOUBLE
int mode = BLAS_XDOUBLE | BLAS_COMPLEX;
#elif defined(DOUBLE)
int mode = BLAS_DOUBLE | BLAS_COMPLEX;
#else
int mode = BLAS_SINGLE | BLAS_COMPLEX;
#endif
#endif
#endif
PRINT_DEBUG_CNAME;
args.n = n;
args.k = k;
args.a = (void *)a;
args.b = (void *)b;
args.c = (void *)c;
args.lda = lda;
args.ldb = ldb;
args.ldc = ldc;
#ifndef COMPLEX
args.alpha = (void *)&alpha;
#else
args.alpha = (void *)alpha;
#endif
#if !defined(COMPLEX) || defined(HEMM)
args.beta = (void *)&beta;
#else
args.beta = (void *)beta;
#endif
trans = -1;
uplo = -1;
info = 0;
if (order == CblasColMajor) {
if (Uplo == CblasUpper) uplo = 0;
if (Uplo == CblasLower) uplo = 1;
if (Trans == CblasNoTrans) trans = 0;
#ifndef COMPLEX
if (Trans == CblasTrans) trans = 1;
if (Trans == CblasConjNoTrans) trans = 0;
if (Trans == CblasConjTrans) trans = 1;
#elif !defined(HEMM)
if (Trans == CblasTrans) trans = 1;
#else
if (Trans == CblasConjTrans) trans = 1;
#endif
info = -1;
nrowa = args.n;
if (trans & 1) nrowa = args.k;
if (args.ldc < MAX(1,args.n)) info = 12;
if (args.ldb < MAX(1,nrowa)) info = 9;
if (args.lda < MAX(1,nrowa)) info = 7;
if (args.k < 0) info = 4;
if (args.n < 0) info = 3;
if (trans < 0) info = 2;
if (uplo < 0) info = 1;
}
if (order == CblasRowMajor) {
#ifdef HEMM
CAlpha[0] = alpha[0];
CAlpha[1] = -alpha[1];
args.alpha = (void *)CAlpha;
#endif
if (Uplo == CblasUpper) uplo = 1;
if (Uplo == CblasLower) uplo = 0;
if (Trans == CblasNoTrans) trans = 1;
#ifndef COMPLEX
if (Trans == CblasTrans) trans = 0;
if (Trans == CblasConjNoTrans) trans = 1;
if (Trans == CblasConjTrans) trans = 0;
#elif !defined(HEMM)
if (Trans == CblasTrans) trans = 0;
#else
if (Trans == CblasConjTrans) trans = 0;
#endif
info = -1;
nrowa = args.n;
if (trans & 1) nrowa = args.k;
if (args.ldc < MAX(1,args.n)) info = 12;
if (args.ldb < MAX(1,nrowa)) info = 9;
if (args.lda < MAX(1,nrowa)) info = 7;
if (args.k < 0) info = 4;
if (args.n < 0) info = 3;
if (trans < 0) info = 2;
if (uplo < 0) info = 1;
}
if (info >= 0) {
BLASFUNC(xerbla)(ERROR_NAME, &info, sizeof(ERROR_NAME));
return;
}
#endif
if (args.n == 0) return;
IDEBUG_START;
FUNCTION_PROFILE_START();
buffer = (FLOAT *)blas_memory_alloc(0);
sa = (FLOAT *)((BLASLONG)buffer + GEMM_OFFSET_A);
sb = (FLOAT *)(((BLASLONG)sa + ((GEMM_P * GEMM_Q * COMPSIZE * SIZE + GEMM_ALIGN) & ~GEMM_ALIGN)) + GEMM_OFFSET_B);
#ifdef SMPTEST
if (!trans){
mode |= (BLAS_TRANSA_N | BLAS_TRANSB_T);
} else {
mode |= (BLAS_TRANSA_T | BLAS_TRANSB_N);
}
mode |= (uplo << BLAS_UPLO_SHIFT);
args.common = NULL;
args.nthreads = num_cpu_avail(3);
if (args.nthreads == 1) {
#endif
(syr2k[(uplo << 1) | trans ])(&args, NULL, NULL, sa, sb, 0);
#ifdef SMPTEST
} else {
syrk_thread(mode, &args, NULL, NULL, syr2k[(uplo << 1) | trans ], sa, sb, args.nthreads);
}
#endif
blas_memory_free(buffer);
FUNCTION_PROFILE_END(COMPSIZE * COMPSIZE, 2 * args.n * args.k + args.n * args.n, 2 * args.n * args.n * args.k);
IDEBUG_END;
return;
}

366
interface/syrk.c Normal file
View File

@ -0,0 +1,366 @@
/*********************************************************************/
/* Copyright 2009, 2010 The University of Texas at Austin. */
/* All rights reserved. */
/* */
/* Redistribution and use in source and binary forms, with or */
/* without modification, are permitted provided that the following */
/* conditions are met: */
/* */
/* 1. Redistributions of source code must retain the above */
/* copyright notice, this list of conditions and the following */
/* disclaimer. */
/* */
/* 2. Redistributions in binary form must reproduce the above */
/* copyright notice, this list of conditions and the following */
/* disclaimer in the documentation and/or other materials */
/* provided with the distribution. */
/* */
/* THIS SOFTWARE IS PROVIDED BY THE UNIVERSITY OF TEXAS AT */
/* AUSTIN ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, */
/* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF */
/* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE */
/* DISCLAIMED. IN NO EVENT SHALL THE UNIVERSITY OF TEXAS AT */
/* AUSTIN OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, */
/* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES */
/* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE */
/* GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR */
/* BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF */
/* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT */
/* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT */
/* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE */
/* POSSIBILITY OF SUCH DAMAGE. */
/* */
/* The views and conclusions contained in the software and */
/* documentation are those of the authors and should not be */
/* interpreted as representing official policies, either expressed */
/* or implied, of The University of Texas at Austin. */
/*********************************************************************/
#include <stdio.h>
#include <ctype.h>
#include "common.h"
#ifdef FUNCTION_PROFILE
#include "functable.h"
#endif
#ifndef COMPLEX
#ifdef XDOUBLE
#define ERROR_NAME "QSYRK "
#elif defined(DOUBLE)
#define ERROR_NAME "DSYRK "
#else
#define ERROR_NAME "SSYRK "
#endif
#else
#ifndef HEMM
#ifdef XDOUBLE
#define ERROR_NAME "XSYRK "
#elif defined(DOUBLE)
#define ERROR_NAME "ZSYRK "
#else
#define ERROR_NAME "CSYRK "
#endif
#else
#ifdef XDOUBLE
#define ERROR_NAME "XHERK "
#elif defined(DOUBLE)
#define ERROR_NAME "ZHERK "
#else
#define ERROR_NAME "CHERK "
#endif
#endif
#endif
static int (*syrk[])(blas_arg_t *, BLASLONG *, BLASLONG *, FLOAT *, FLOAT *, BLASLONG) = {
#ifndef HEMM
SYRK_UN, SYRK_UC, SYRK_LN, SYRK_LC,
#if defined(SMPTEST) && !defined(USE_SIMPLE_THREADED_LEVEL3)
SYRK_THREAD_UN, SYRK_THREAD_UC, SYRK_THREAD_LN, SYRK_THREAD_LC,
#endif
#else
HERK_UN, HERK_UC, HERK_LN, HERK_LC,
#if defined(SMPTEST) && !defined(USE_SIMPLE_THREADED_LEVEL3)
HERK_THREAD_UN, HERK_THREAD_UC, HERK_THREAD_LN, HERK_THREAD_LC,
#endif
#endif
};
#ifndef CBLAS
void NAME(char *UPLO, char *TRANS,
blasint *N, blasint *K,
FLOAT *alpha, FLOAT *a, blasint *ldA,
FLOAT *beta, FLOAT *c, blasint *ldC){
char uplo_arg = *UPLO;
char trans_arg = *TRANS;
blas_arg_t args;
FLOAT *buffer;
FLOAT *sa, *sb;
#ifdef SMPTEST
#ifndef COMPLEX
#ifdef XDOUBLE
int mode = BLAS_XDOUBLE | BLAS_REAL;
#elif defined(DOUBLE)
int mode = BLAS_DOUBLE | BLAS_REAL;
#else
int mode = BLAS_SINGLE | BLAS_REAL;
#endif
#else
#ifdef XDOUBLE
int mode = BLAS_XDOUBLE | BLAS_COMPLEX;
#elif defined(DOUBLE)
int mode = BLAS_DOUBLE | BLAS_COMPLEX;
#else
int mode = BLAS_SINGLE | BLAS_COMPLEX;
#endif
#endif
#endif
blasint info;
int uplo;
int trans;
int nrowa;
PRINT_DEBUG_NAME;
args.n = *N;
args.k = *K;
args.a = (void *)a;
args.c = (void *)c;
args.lda = *ldA;
args.ldc = *ldC;
args.alpha = (void *)alpha;
args.beta = (void *)beta;
TOUPPER(uplo_arg);
TOUPPER(trans_arg);
uplo = -1;
trans = -1;
if (uplo_arg == 'U') uplo = 0;
if (uplo_arg == 'L') uplo = 1;
#ifndef COMPLEX
if (trans_arg == 'N') trans = 0;
if (trans_arg == 'T') trans = 1;
if (trans_arg == 'C') trans = 1;
#else
#ifdef HEMM
if (trans_arg == 'N') trans = 0;
if (trans_arg == 'C') trans = 1;
#else
if (trans_arg == 'N') trans = 0;
if (trans_arg == 'T') trans = 1;
#endif
#endif
nrowa = args.n;
if (trans & 1) nrowa = args.k;
info = 0;
if (args.ldc < MAX(1,args.n)) info = 10;
if (args.lda < MAX(1,nrowa)) info = 7;
if (args.k < 0) info = 4;
if (args.n < 0) info = 3;
if (trans < 0) info = 2;
if (uplo < 0) info = 1;
if (info != 0) {
BLASFUNC(xerbla)(ERROR_NAME, &info, sizeof(ERROR_NAME));
return;
}
#else
void CNAME(enum CBLAS_ORDER order, enum CBLAS_UPLO Uplo, enum CBLAS_TRANSPOSE Trans,
blasint n, blasint k,
#if !defined(COMPLEX) || defined(HEMM)
FLOAT alpha,
#else
FLOAT *alpha,
#endif
FLOAT *a, blasint lda,
#if !defined(COMPLEX) || defined(HEMM)
FLOAT beta,
#else
FLOAT *beta,
#endif
FLOAT *c, blasint ldc) {
blas_arg_t args;
int uplo, trans;
blasint info, nrowa;
FLOAT *buffer;
FLOAT *sa, *sb;
#ifdef SMPTEST
#ifndef COMPLEX
#ifdef XDOUBLE
int mode = BLAS_XDOUBLE | BLAS_REAL;
#elif defined(DOUBLE)
int mode = BLAS_DOUBLE | BLAS_REAL;
#else
int mode = BLAS_SINGLE | BLAS_REAL;
#endif
#else
#ifdef XDOUBLE
int mode = BLAS_XDOUBLE | BLAS_COMPLEX;
#elif defined(DOUBLE)
int mode = BLAS_DOUBLE | BLAS_COMPLEX;
#else
int mode = BLAS_SINGLE | BLAS_COMPLEX;
#endif
#endif
#endif
PRINT_DEBUG_CNAME;
args.n = n;
args.k = k;
args.a = (void *)a;
args.c = (void *)c;
args.lda = lda;
args.ldc = ldc;
#if !defined(COMPLEX) || defined(HEMM)
args.alpha = (void *)&alpha;
args.beta = (void *)&beta;
#else
args.alpha = (void *)alpha;
args.beta = (void *)beta;
#endif
trans = -1;
uplo = -1;
info = 0;
if (order == CblasColMajor) {
if (Uplo == CblasUpper) uplo = 0;
if (Uplo == CblasLower) uplo = 1;
if (Trans == CblasNoTrans) trans = 0;
#ifndef COMPLEX
if (Trans == CblasTrans) trans = 1;
if (Trans == CblasConjNoTrans) trans = 0;
if (Trans == CblasConjTrans) trans = 1;
#elif !defined(HEMM)
if (Trans == CblasTrans) trans = 1;
#else
if (Trans == CblasConjTrans) trans = 1;
#endif
info = -1;
nrowa = args.n;
if (trans & 1) nrowa = args.k;
if (args.ldc < MAX(1,args.n)) info = 10;
if (args.lda < MAX(1,nrowa)) info = 7;
if (args.k < 0) info = 4;
if (args.n < 0) info = 3;
if (trans < 0) info = 2;
if (uplo < 0) info = 1;
}
if (order == CblasRowMajor) {
if (Uplo == CblasUpper) uplo = 1;
if (Uplo == CblasLower) uplo = 0;
if (Trans == CblasNoTrans) trans = 1;
#ifndef COMPLEX
if (Trans == CblasTrans) trans = 0;
if (Trans == CblasConjNoTrans) trans = 1;
if (Trans == CblasConjTrans) trans = 0;
#elif !defined(HEMM)
if (Trans == CblasTrans) trans = 0;
#else
if (Trans == CblasConjTrans) trans = 0;
#endif
info = -1;
nrowa = args.n;
if (trans & 1) nrowa = args.k;
if (args.ldc < MAX(1,args.n)) info = 10;
if (args.lda < MAX(1,nrowa)) info = 7;
if (args.k < 0) info = 4;
if (args.n < 0) info = 3;
if (trans < 0) info = 2;
if (uplo < 0) info = 1;
}
if (info >= 0) {
BLASFUNC(xerbla)(ERROR_NAME, &info, sizeof(ERROR_NAME));
return;
}
#endif
if (args.n == 0) return;
IDEBUG_START;
FUNCTION_PROFILE_START();
buffer = (FLOAT *)blas_memory_alloc(0);
sa = (FLOAT *)((BLASLONG)buffer + GEMM_OFFSET_A);
sb = (FLOAT *)(((BLASLONG)sa + ((GEMM_P * GEMM_Q * COMPSIZE * SIZE + GEMM_ALIGN) & ~GEMM_ALIGN)) + GEMM_OFFSET_B);
#ifdef SMPTEST
if (!trans){
mode |= (BLAS_TRANSA_N | BLAS_TRANSB_T);
} else {
mode |= (BLAS_TRANSA_T | BLAS_TRANSB_N);
}
mode |= (uplo << BLAS_UPLO_SHIFT);
args.common = NULL;
args.nthreads = num_cpu_avail(3);
if (args.nthreads == 1) {
#endif
(syrk[(uplo << 1) | trans ])(&args, NULL, NULL, sa, sb, 0);
#ifdef SMPTEST
} else {
#ifndef USE_SIMPLE_THREADED_LEVEL3
(syrk[4 | (uplo << 1) | trans ])(&args, NULL, NULL, sa, sb, 0);
#else
syrk_thread(mode, &args, NULL, NULL, syrk[(uplo << 1) | trans ], sa, sb, args.nthreads);
#endif
}
#endif
blas_memory_free(buffer);
FUNCTION_PROFILE_END(COMPSIZE * COMPSIZE, args.n * args.k + args.n * args.n / 2, args.n * args.n * args.k);
IDEBUG_END;
return;
}

248
interface/tbmv.c Normal file
View File

@ -0,0 +1,248 @@
/*********************************************************************/
/* Copyright 2009, 2010 The University of Texas at Austin. */
/* All rights reserved. */
/* */
/* Redistribution and use in source and binary forms, with or */
/* without modification, are permitted provided that the following */
/* conditions are met: */
/* */
/* 1. Redistributions of source code must retain the above */
/* copyright notice, this list of conditions and the following */
/* disclaimer. */
/* */
/* 2. Redistributions in binary form must reproduce the above */
/* copyright notice, this list of conditions and the following */
/* disclaimer in the documentation and/or other materials */
/* provided with the distribution. */
/* */
/* THIS SOFTWARE IS PROVIDED BY THE UNIVERSITY OF TEXAS AT */
/* AUSTIN ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, */
/* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF */
/* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE */
/* DISCLAIMED. IN NO EVENT SHALL THE UNIVERSITY OF TEXAS AT */
/* AUSTIN OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, */
/* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES */
/* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE */
/* GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR */
/* BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF */
/* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT */
/* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT */
/* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE */
/* POSSIBILITY OF SUCH DAMAGE. */
/* */
/* The views and conclusions contained in the software and */
/* documentation are those of the authors and should not be */
/* interpreted as representing official policies, either expressed */
/* or implied, of The University of Texas at Austin. */
/*********************************************************************/
#include <stdio.h>
#include <ctype.h>
#include "common.h"
#ifdef FUNCTION_PROFILE
#include "functable.h"
#endif
#ifdef XDOUBLE
#define ERROR_NAME "QTBMV "
#elif defined(DOUBLE)
#define ERROR_NAME "DTBMV "
#else
#define ERROR_NAME "STBMV "
#endif
static int (*tbmv[])(BLASLONG, BLASLONG, FLOAT *, BLASLONG, FLOAT *, BLASLONG, void *) = {
#ifdef XDOUBLE
qtbmv_NUU, qtbmv_NUN, qtbmv_NLU, qtbmv_NLN,
qtbmv_TUU, qtbmv_TUN, qtbmv_TLU, qtbmv_TLN,
#elif defined(DOUBLE)
dtbmv_NUU, dtbmv_NUN, dtbmv_NLU, dtbmv_NLN,
dtbmv_TUU, dtbmv_TUN, dtbmv_TLU, dtbmv_TLN,
#else
stbmv_NUU, stbmv_NUN, stbmv_NLU, stbmv_NLN,
stbmv_TUU, stbmv_TUN, stbmv_TLU, stbmv_TLN,
#endif
};
#ifdef SMPTEST
static int (*tbmv_thread[])(BLASLONG, BLASLONG, FLOAT *, BLASLONG, FLOAT *, BLASLONG, FLOAT *, int) = {
#ifdef XDOUBLE
qtbmv_thread_NUU, qtbmv_thread_NUN, qtbmv_thread_NLU, qtbmv_thread_NLN,
qtbmv_thread_TUU, qtbmv_thread_TUN, qtbmv_thread_TLU, qtbmv_thread_TLN,
#elif defined(DOUBLE)
dtbmv_thread_NUU, dtbmv_thread_NUN, dtbmv_thread_NLU, dtbmv_thread_NLN,
dtbmv_thread_TUU, dtbmv_thread_TUN, dtbmv_thread_TLU, dtbmv_thread_TLN,
#else
stbmv_thread_NUU, stbmv_thread_NUN, stbmv_thread_NLU, stbmv_thread_NLN,
stbmv_thread_TUU, stbmv_thread_TUN, stbmv_thread_TLU, stbmv_thread_TLN,
#endif
};
#endif
#ifndef CBLAS
void NAME(char *UPLO, char *TRANS, char *DIAG,
blasint *N, blasint *K,
FLOAT *a, blasint *LDA, FLOAT *x, blasint *INCX){
char uplo_arg = *UPLO;
char trans_arg = *TRANS;
char diag_arg = *DIAG;
blasint n = *N;
blasint k = *K;
blasint lda = *LDA;
blasint incx = *INCX;
blasint info;
int uplo;
int unit;
int trans;
FLOAT *buffer;
#ifdef SMPTEST
int nthreads;
#endif
PRINT_DEBUG_NAME;
TOUPPER(uplo_arg);
TOUPPER(trans_arg);
TOUPPER(diag_arg);
trans = -1;
unit = -1;
uplo = -1;
if (trans_arg == 'N') trans = 0;
if (trans_arg == 'T') trans = 1;
if (trans_arg == 'R') trans = 0;
if (trans_arg == 'C') trans = 1;
if (diag_arg == 'U') unit = 0;
if (diag_arg == 'N') unit = 1;
if (uplo_arg == 'U') uplo = 0;
if (uplo_arg == 'L') uplo = 1;
info = 0;
if (incx == 0) info = 9;
if (lda < k + 1) info = 7;
if (k < 0) info = 5;
if (n < 0) info = 4;
if (unit < 0) info = 3;
if (trans < 0) info = 2;
if (uplo < 0) info = 1;
if (info != 0) {
BLASFUNC(xerbla)(ERROR_NAME, &info, sizeof(ERROR_NAME));
return;
}
#else
void CNAME(enum CBLAS_ORDER order, enum CBLAS_UPLO Uplo,
enum CBLAS_TRANSPOSE TransA, enum CBLAS_DIAG Diag,
blasint n, blasint k, FLOAT *a, blasint lda, FLOAT *x, blasint incx) {
int trans, uplo, unit;
blasint info;
FLOAT *buffer;
#ifdef SMPTEST
int nthreads;
#endif
PRINT_DEBUG_CNAME;
unit = -1;
uplo = -1;
trans = -1;
info = 0;
if (order == CblasColMajor) {
if (Uplo == CblasUpper) uplo = 0;
if (Uplo == CblasLower) uplo = 1;
if (TransA == CblasNoTrans) trans = 0;
if (TransA == CblasTrans) trans = 1;
if (TransA == CblasConjNoTrans) trans = 0;
if (TransA == CblasConjTrans) trans = 1;
if (Diag == CblasUnit) unit = 0;
if (Diag == CblasNonUnit) unit = 1;
info = -1;
if (incx == 0) info = 9;
if (lda < k + 1) info = 7;
if (k < 0) info = 5;
if (n < 0) info = 4;
if (unit < 0) info = 3;
if (trans < 0) info = 2;
if (uplo < 0) info = 1;
}
if (order == CblasRowMajor) {
if (Uplo == CblasUpper) uplo = 1;
if (Uplo == CblasLower) uplo = 0;
if (TransA == CblasNoTrans) trans = 1;
if (TransA == CblasTrans) trans = 0;
if (TransA == CblasConjNoTrans) trans = 1;
if (TransA == CblasConjTrans) trans = 0;
if (Diag == CblasUnit) unit = 0;
if (Diag == CblasNonUnit) unit = 1;
info = -1;
if (incx == 0) info = 9;
if (lda < k + 1) info = 7;
if (k < 0) info = 5;
if (n < 0) info = 4;
if (unit < 0) info = 3;
if (trans < 0) info = 2;
if (uplo < 0) info = 1;
}
if (info >= 0) {
BLASFUNC(xerbla)(ERROR_NAME, &info, sizeof(ERROR_NAME));
return;
}
#endif
if (n == 0) return;
IDEBUG_START;
FUNCTION_PROFILE_START();
if (incx < 0 ) x -= (n - 1) * incx;
buffer = (FLOAT *)blas_memory_alloc(1);
#ifdef SMPTEST
nthreads = num_cpu_avail(2);
if (nthreads == 1) {
#endif
(tbmv[(trans<<2) | (uplo<<1) | unit])(n, k, a, lda, x, incx, buffer);
#ifdef SMPTEST
} else {
(tbmv_thread[(trans<<2) | (uplo<<1) | unit])(n, k, a, lda, x, incx, buffer, nthreads);
}
#endif
blas_memory_free(buffer);
FUNCTION_PROFILE_END(1, n * k / 2 + n, n * k);
IDEBUG_END;
return;
}

213
interface/tbsv.c Normal file
View File

@ -0,0 +1,213 @@
/*********************************************************************/
/* Copyright 2009, 2010 The University of Texas at Austin. */
/* All rights reserved. */
/* */
/* Redistribution and use in source and binary forms, with or */
/* without modification, are permitted provided that the following */
/* conditions are met: */
/* */
/* 1. Redistributions of source code must retain the above */
/* copyright notice, this list of conditions and the following */
/* disclaimer. */
/* */
/* 2. Redistributions in binary form must reproduce the above */
/* copyright notice, this list of conditions and the following */
/* disclaimer in the documentation and/or other materials */
/* provided with the distribution. */
/* */
/* THIS SOFTWARE IS PROVIDED BY THE UNIVERSITY OF TEXAS AT */
/* AUSTIN ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, */
/* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF */
/* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE */
/* DISCLAIMED. IN NO EVENT SHALL THE UNIVERSITY OF TEXAS AT */
/* AUSTIN OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, */
/* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES */
/* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE */
/* GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR */
/* BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF */
/* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT */
/* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT */
/* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE */
/* POSSIBILITY OF SUCH DAMAGE. */
/* */
/* The views and conclusions contained in the software and */
/* documentation are those of the authors and should not be */
/* interpreted as representing official policies, either expressed */
/* or implied, of The University of Texas at Austin. */
/*********************************************************************/
#include <stdio.h>
#include <ctype.h>
#include "common.h"
#ifdef FUNCTION_PROFILE
#include "functable.h"
#endif
#ifdef XDOUBLE
#define ERROR_NAME "QTBSV "
#elif defined(DOUBLE)
#define ERROR_NAME "DTBSV "
#else
#define ERROR_NAME "STBSV "
#endif
static int (*tbsv[])(BLASLONG, BLASLONG, FLOAT *, BLASLONG, FLOAT *, BLASLONG, void *) = {
#ifdef XDOUBLE
qtbsv_NUU, qtbsv_NUN, qtbsv_NLU, qtbsv_NLN,
qtbsv_TUU, qtbsv_TUN, qtbsv_TLU, qtbsv_TLN,
#elif defined(DOUBLE)
dtbsv_NUU, dtbsv_NUN, dtbsv_NLU, dtbsv_NLN,
dtbsv_TUU, dtbsv_TUN, dtbsv_TLU, dtbsv_TLN,
#else
stbsv_NUU, stbsv_NUN, stbsv_NLU, stbsv_NLN,
stbsv_TUU, stbsv_TUN, stbsv_TLU, stbsv_TLN,
#endif
};
#ifndef CBLAS
void NAME(char *UPLO, char *TRANS, char *DIAG,
blasint *N, blasint *K,
FLOAT *a, blasint *LDA, FLOAT *x, blasint *INCX){
char uplo_arg = *UPLO;
char trans_arg = *TRANS;
char diag_arg = *DIAG;
blasint n = *N;
blasint k = *K;
blasint lda = *LDA;
blasint incx = *INCX;
blasint info;
int uplo;
int unit;
int trans;
FLOAT *buffer;
PRINT_DEBUG_NAME;
TOUPPER(uplo_arg);
TOUPPER(trans_arg);
TOUPPER(diag_arg);
trans = -1;
unit = -1;
uplo = -1;
if (trans_arg == 'N') trans = 0;
if (trans_arg == 'T') trans = 1;
if (trans_arg == 'R') trans = 0;
if (trans_arg == 'C') trans = 1;
if (diag_arg == 'U') unit = 0;
if (diag_arg == 'N') unit = 1;
if (uplo_arg == 'U') uplo = 0;
if (uplo_arg == 'L') uplo = 1;
info = 0;
if (incx == 0) info = 9;
if (lda < k + 1) info = 7;
if (k < 0) info = 5;
if (n < 0) info = 4;
if (unit < 0) info = 3;
if (trans < 0) info = 2;
if (uplo < 0) info = 1;
if (info != 0) {
BLASFUNC(xerbla)(ERROR_NAME, &info, sizeof(ERROR_NAME));
return;
}
#else
void CNAME(enum CBLAS_ORDER order, enum CBLAS_UPLO Uplo,
enum CBLAS_TRANSPOSE TransA, enum CBLAS_DIAG Diag,
blasint n, blasint k, FLOAT *a, blasint lda, FLOAT *x, blasint incx) {
int trans, uplo, unit;
blasint info;
FLOAT *buffer;
PRINT_DEBUG_CNAME;
unit = -1;
uplo = -1;
trans = -1;
info = 0;
if (order == CblasColMajor) {
if (Uplo == CblasUpper) uplo = 0;
if (Uplo == CblasLower) uplo = 1;
if (TransA == CblasNoTrans) trans = 0;
if (TransA == CblasTrans) trans = 1;
if (TransA == CblasConjNoTrans) trans = 0;
if (TransA == CblasConjTrans) trans = 1;
if (Diag == CblasUnit) unit = 0;
if (Diag == CblasNonUnit) unit = 1;
info = -1;
if (incx == 0) info = 9;
if (lda < k + 1) info = 7;
if (k < 0) info = 5;
if (n < 0) info = 4;
if (unit < 0) info = 3;
if (trans < 0) info = 2;
if (uplo < 0) info = 1;
}
if (order == CblasRowMajor) {
if (Uplo == CblasUpper) uplo = 1;
if (Uplo == CblasLower) uplo = 0;
if (TransA == CblasNoTrans) trans = 1;
if (TransA == CblasTrans) trans = 0;
if (TransA == CblasConjNoTrans) trans = 1;
if (TransA == CblasConjTrans) trans = 0;
if (Diag == CblasUnit) unit = 0;
if (Diag == CblasNonUnit) unit = 1;
info = -1;
if (incx == 0) info = 9;
if (lda < k + 1) info = 7;
if (k < 0) info = 5;
if (n < 0) info = 4;
if (unit < 0) info = 3;
if (trans < 0) info = 2;
if (uplo < 0) info = 1;
}
if (info >= 0) {
BLASFUNC(xerbla)(ERROR_NAME, &info, sizeof(ERROR_NAME));
return;
}
#endif
if (n == 0) return;
IDEBUG_START;
FUNCTION_PROFILE_START();
if (incx < 0 ) x -= (n - 1) * incx;
buffer = (FLOAT *)blas_memory_alloc(1);
(tbsv[(trans<<2) | (uplo<<1) | unit])(n, k, a, lda, x, incx, buffer);
blas_memory_free(buffer);
FUNCTION_PROFILE_END(1, n * k / 2 + n, n * k);
IDEBUG_END;
return;
}

239
interface/tpmv.c Normal file
View File

@ -0,0 +1,239 @@
/*********************************************************************/
/* Copyright 2009, 2010 The University of Texas at Austin. */
/* All rights reserved. */
/* */
/* Redistribution and use in source and binary forms, with or */
/* without modification, are permitted provided that the following */
/* conditions are met: */
/* */
/* 1. Redistributions of source code must retain the above */
/* copyright notice, this list of conditions and the following */
/* disclaimer. */
/* */
/* 2. Redistributions in binary form must reproduce the above */
/* copyright notice, this list of conditions and the following */
/* disclaimer in the documentation and/or other materials */
/* provided with the distribution. */
/* */
/* THIS SOFTWARE IS PROVIDED BY THE UNIVERSITY OF TEXAS AT */
/* AUSTIN ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, */
/* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF */
/* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE */
/* DISCLAIMED. IN NO EVENT SHALL THE UNIVERSITY OF TEXAS AT */
/* AUSTIN OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, */
/* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES */
/* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE */
/* GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR */
/* BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF */
/* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT */
/* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT */
/* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE */
/* POSSIBILITY OF SUCH DAMAGE. */
/* */
/* The views and conclusions contained in the software and */
/* documentation are those of the authors and should not be */
/* interpreted as representing official policies, either expressed */
/* or implied, of The University of Texas at Austin. */
/*********************************************************************/
#include <stdio.h>
#include <ctype.h>
#include "common.h"
#ifdef FUNCTION_PROFILE
#include "functable.h"
#endif
#ifdef XDOUBLE
#define ERROR_NAME "QTPMV "
#elif defined(DOUBLE)
#define ERROR_NAME "DTPMV "
#else
#define ERROR_NAME "STPMV "
#endif
static int (*tpmv[])(BLASLONG, FLOAT *, FLOAT *, BLASLONG, void *) = {
#ifdef XDOUBLE
qtpmv_NUU, qtpmv_NUN, qtpmv_NLU, qtpmv_NLN,
qtpmv_TUU, qtpmv_TUN, qtpmv_TLU, qtpmv_TLN,
#elif defined(DOUBLE)
dtpmv_NUU, dtpmv_NUN, dtpmv_NLU, dtpmv_NLN,
dtpmv_TUU, dtpmv_TUN, dtpmv_TLU, dtpmv_TLN,
#else
stpmv_NUU, stpmv_NUN, stpmv_NLU, stpmv_NLN,
stpmv_TUU, stpmv_TUN, stpmv_TLU, stpmv_TLN,
#endif
};
#ifdef SMPTEST
static int (*tpmv_thread[])(BLASLONG, FLOAT *, FLOAT *, BLASLONG, FLOAT *, int) = {
#ifdef XDOUBLE
qtpmv_thread_NUU, qtpmv_thread_NUN, qtpmv_thread_NLU, qtpmv_thread_NLN,
qtpmv_thread_TUU, qtpmv_thread_TUN, qtpmv_thread_TLU, qtpmv_thread_TLN,
#elif defined(DOUBLE)
dtpmv_thread_NUU, dtpmv_thread_NUN, dtpmv_thread_NLU, dtpmv_thread_NLN,
dtpmv_thread_TUU, dtpmv_thread_TUN, dtpmv_thread_TLU, dtpmv_thread_TLN,
#else
stpmv_thread_NUU, stpmv_thread_NUN, stpmv_thread_NLU, stpmv_thread_NLN,
stpmv_thread_TUU, stpmv_thread_TUN, stpmv_thread_TLU, stpmv_thread_TLN,
#endif
};
#endif
#ifndef CBLAS
void NAME(char *UPLO, char *TRANS, char *DIAG,
blasint *N, FLOAT *a, FLOAT *x, blasint *INCX){
char uplo_arg = *UPLO;
char trans_arg = *TRANS;
char diag_arg = *DIAG;
blasint n = *N;
blasint incx = *INCX;
blasint info;
int uplo;
int unit;
int trans;
FLOAT *buffer;
#ifdef SMPTEST
int nthreads;
#endif
PRINT_DEBUG_NAME;
TOUPPER(uplo_arg);
TOUPPER(trans_arg);
TOUPPER(diag_arg);
trans = -1;
unit = -1;
uplo = -1;
if (trans_arg == 'N') trans = 0;
if (trans_arg == 'T') trans = 1;
if (trans_arg == 'R') trans = 0;
if (trans_arg == 'C') trans = 1;
if (diag_arg == 'U') unit = 0;
if (diag_arg == 'N') unit = 1;
if (uplo_arg == 'U') uplo = 0;
if (uplo_arg == 'L') uplo = 1;
info = 0;
if (incx == 0) info = 7;
if (n < 0) info = 4;
if (unit < 0) info = 3;
if (trans < 0) info = 2;
if (uplo < 0) info = 1;
if (info != 0) {
BLASFUNC(xerbla)(ERROR_NAME, &info, sizeof(ERROR_NAME));
return;
}
#else
void CNAME(enum CBLAS_ORDER order, enum CBLAS_UPLO Uplo,
enum CBLAS_TRANSPOSE TransA, enum CBLAS_DIAG Diag,
blasint n, FLOAT *a, FLOAT *x, blasint incx) {
int trans, uplo, unit;
blasint info;
FLOAT *buffer;
#ifdef SMPTEST
int nthreads;
#endif
PRINT_DEBUG_CNAME;
unit = -1;
uplo = -1;
trans = -1;
info = 0;
if (order == CblasColMajor) {
if (Uplo == CblasUpper) uplo = 0;
if (Uplo == CblasLower) uplo = 1;
if (TransA == CblasNoTrans) trans = 0;
if (TransA == CblasTrans) trans = 1;
if (TransA == CblasConjNoTrans) trans = 0;
if (TransA == CblasConjTrans) trans = 1;
if (Diag == CblasUnit) unit = 0;
if (Diag == CblasNonUnit) unit = 1;
info = -1;
if (incx == 0) info = 7;
if (n < 0) info = 4;
if (unit < 0) info = 3;
if (trans < 0) info = 2;
if (uplo < 0) info = 1;
}
if (order == CblasRowMajor) {
if (Uplo == CblasUpper) uplo = 1;
if (Uplo == CblasLower) uplo = 0;
if (TransA == CblasNoTrans) trans = 1;
if (TransA == CblasTrans) trans = 0;
if (TransA == CblasConjNoTrans) trans = 1;
if (TransA == CblasConjTrans) trans = 0;
if (Diag == CblasUnit) unit = 0;
if (Diag == CblasNonUnit) unit = 1;
info = -1;
if (incx == 0) info = 7;
if (n < 0) info = 4;
if (unit < 0) info = 3;
if (trans < 0) info = 2;
if (uplo < 0) info = 1;
}
if (info >= 0) {
BLASFUNC(xerbla)(ERROR_NAME, &info, sizeof(ERROR_NAME));
return;
}
#endif
if (n == 0) return;
IDEBUG_START;
FUNCTION_PROFILE_START();
if (incx < 0 ) x -= (n - 1) * incx;
buffer = (FLOAT *)blas_memory_alloc(1);
#ifdef SMPTEST
nthreads = num_cpu_avail(2);
if (nthreads == 1) {
#endif
(tpmv[(trans<<2) | (uplo<<1) | unit])(n, a, x, incx, buffer);
#ifdef SMPTEST
} else {
(tpmv_thread[(trans<<2) | (uplo<<1) | unit])(n, a, x, incx, buffer, nthreads);
}
#endif
blas_memory_free(buffer);
FUNCTION_PROFILE_END(1, n * n / 2 + n, n * n);
IDEBUG_END;
return;
}

204
interface/tpsv.c Normal file
View File

@ -0,0 +1,204 @@
/*********************************************************************/
/* Copyright 2009, 2010 The University of Texas at Austin. */
/* All rights reserved. */
/* */
/* Redistribution and use in source and binary forms, with or */
/* without modification, are permitted provided that the following */
/* conditions are met: */
/* */
/* 1. Redistributions of source code must retain the above */
/* copyright notice, this list of conditions and the following */
/* disclaimer. */
/* */
/* 2. Redistributions in binary form must reproduce the above */
/* copyright notice, this list of conditions and the following */
/* disclaimer in the documentation and/or other materials */
/* provided with the distribution. */
/* */
/* THIS SOFTWARE IS PROVIDED BY THE UNIVERSITY OF TEXAS AT */
/* AUSTIN ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, */
/* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF */
/* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE */
/* DISCLAIMED. IN NO EVENT SHALL THE UNIVERSITY OF TEXAS AT */
/* AUSTIN OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, */
/* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES */
/* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE */
/* GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR */
/* BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF */
/* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT */
/* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT */
/* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE */
/* POSSIBILITY OF SUCH DAMAGE. */
/* */
/* The views and conclusions contained in the software and */
/* documentation are those of the authors and should not be */
/* interpreted as representing official policies, either expressed */
/* or implied, of The University of Texas at Austin. */
/*********************************************************************/
#include <stdio.h>
#include <ctype.h>
#include "common.h"
#ifdef FUNCTION_PROFILE
#include "functable.h"
#endif
#ifdef XDOUBLE
#define ERROR_NAME "QTPSV "
#elif defined(DOUBLE)
#define ERROR_NAME "DTPSV "
#else
#define ERROR_NAME "STPSV "
#endif
static int (*tpsv[])(BLASLONG, FLOAT *, FLOAT *, BLASLONG, void *) = {
#ifdef XDOUBLE
qtpsv_NUU, qtpsv_NUN, qtpsv_NLU, qtpsv_NLN,
qtpsv_TUU, qtpsv_TUN, qtpsv_TLU, qtpsv_TLN,
#elif defined(DOUBLE)
dtpsv_NUU, dtpsv_NUN, dtpsv_NLU, dtpsv_NLN,
dtpsv_TUU, dtpsv_TUN, dtpsv_TLU, dtpsv_TLN,
#else
stpsv_NUU, stpsv_NUN, stpsv_NLU, stpsv_NLN,
stpsv_TUU, stpsv_TUN, stpsv_TLU, stpsv_TLN,
#endif
};
#ifndef CBLAS
void NAME(char *UPLO, char *TRANS, char *DIAG,
blasint *N, FLOAT *a, FLOAT *x, blasint *INCX){
char uplo_arg = *UPLO;
char trans_arg = *TRANS;
char diag_arg = *DIAG;
blasint n = *N;
blasint incx = *INCX;
blasint info;
int uplo;
int unit;
int trans;
FLOAT *buffer;
PRINT_DEBUG_NAME;
TOUPPER(uplo_arg);
TOUPPER(trans_arg);
TOUPPER(diag_arg);
trans = -1;
unit = -1;
uplo = -1;
if (trans_arg == 'N') trans = 0;
if (trans_arg == 'T') trans = 1;
if (trans_arg == 'R') trans = 0;
if (trans_arg == 'C') trans = 1;
if (diag_arg == 'U') unit = 0;
if (diag_arg == 'N') unit = 1;
if (uplo_arg == 'U') uplo = 0;
if (uplo_arg == 'L') uplo = 1;
info = 0;
if (incx == 0) info = 7;
if (n < 0) info = 4;
if (unit < 0) info = 3;
if (trans < 0) info = 2;
if (uplo < 0) info = 1;
if (info != 0) {
BLASFUNC(xerbla)(ERROR_NAME, &info, sizeof(ERROR_NAME));
return;
}
#else
void CNAME(enum CBLAS_ORDER order, enum CBLAS_UPLO Uplo,
enum CBLAS_TRANSPOSE TransA, enum CBLAS_DIAG Diag,
blasint n, FLOAT *a, FLOAT *x, blasint incx) {
int trans, uplo, unit;
blasint info;
FLOAT *buffer;
PRINT_DEBUG_CNAME;
unit = -1;
uplo = -1;
trans = -1;
info = 0;
if (order == CblasColMajor) {
if (Uplo == CblasUpper) uplo = 0;
if (Uplo == CblasLower) uplo = 1;
if (TransA == CblasNoTrans) trans = 0;
if (TransA == CblasTrans) trans = 1;
if (TransA == CblasConjNoTrans) trans = 0;
if (TransA == CblasConjTrans) trans = 1;
if (Diag == CblasUnit) unit = 0;
if (Diag == CblasNonUnit) unit = 1;
info = -1;
if (incx == 0) info = 7;
if (n < 0) info = 4;
if (unit < 0) info = 3;
if (trans < 0) info = 2;
if (uplo < 0) info = 1;
}
if (order == CblasRowMajor) {
if (Uplo == CblasUpper) uplo = 1;
if (Uplo == CblasLower) uplo = 0;
if (TransA == CblasNoTrans) trans = 1;
if (TransA == CblasTrans) trans = 0;
if (TransA == CblasConjNoTrans) trans = 1;
if (TransA == CblasConjTrans) trans = 0;
if (Diag == CblasUnit) unit = 0;
if (Diag == CblasNonUnit) unit = 1;
info = -1;
if (incx == 0) info = 7;
if (n < 0) info = 4;
if (unit < 0) info = 3;
if (trans < 0) info = 2;
if (uplo < 0) info = 1;
}
if (info >= 0) {
BLASFUNC(xerbla)(ERROR_NAME, &info, sizeof(ERROR_NAME));
return;
}
#endif
if (n == 0) return;
IDEBUG_START;
FUNCTION_PROFILE_START();
if (incx < 0 ) x -= (n - 1) * incx;
buffer = (FLOAT *)blas_memory_alloc(1);
(tpsv[(trans<<2) | (uplo<<1) | unit])(n, a, x, incx, buffer);
blas_memory_free(buffer);
FUNCTION_PROFILE_END(1, n * n / 2 + n, n * n);
IDEBUG_END;
return;
}

243
interface/trmv.c Normal file
View File

@ -0,0 +1,243 @@
/*********************************************************************/
/* Copyright 2009, 2010 The University of Texas at Austin. */
/* All rights reserved. */
/* */
/* Redistribution and use in source and binary forms, with or */
/* without modification, are permitted provided that the following */
/* conditions are met: */
/* */
/* 1. Redistributions of source code must retain the above */
/* copyright notice, this list of conditions and the following */
/* disclaimer. */
/* */
/* 2. Redistributions in binary form must reproduce the above */
/* copyright notice, this list of conditions and the following */
/* disclaimer in the documentation and/or other materials */
/* provided with the distribution. */
/* */
/* THIS SOFTWARE IS PROVIDED BY THE UNIVERSITY OF TEXAS AT */
/* AUSTIN ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, */
/* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF */
/* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE */
/* DISCLAIMED. IN NO EVENT SHALL THE UNIVERSITY OF TEXAS AT */
/* AUSTIN OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, */
/* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES */
/* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE */
/* GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR */
/* BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF */
/* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT */
/* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT */
/* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE */
/* POSSIBILITY OF SUCH DAMAGE. */
/* */
/* The views and conclusions contained in the software and */
/* documentation are those of the authors and should not be */
/* interpreted as representing official policies, either expressed */
/* or implied, of The University of Texas at Austin. */
/*********************************************************************/
#include <stdio.h>
#include <ctype.h>
#include "common.h"
#ifdef FUNCTION_PROFILE
#include "functable.h"
#endif
#ifdef XDOUBLE
#define ERROR_NAME "QTRMV "
#elif defined(DOUBLE)
#define ERROR_NAME "DTRMV "
#else
#define ERROR_NAME "STRMV "
#endif
static int (*trmv[])(BLASLONG, FLOAT *, BLASLONG, FLOAT *, BLASLONG, FLOAT *) = {
#ifdef XDOUBLE
qtrmv_NUU, qtrmv_NUN, qtrmv_NLU, qtrmv_NLN,
qtrmv_TUU, qtrmv_TUN, qtrmv_TLU, qtrmv_TLN,
#elif defined(DOUBLE)
dtrmv_NUU, dtrmv_NUN, dtrmv_NLU, dtrmv_NLN,
dtrmv_TUU, dtrmv_TUN, dtrmv_TLU, dtrmv_TLN,
#else
strmv_NUU, strmv_NUN, strmv_NLU, strmv_NLN,
strmv_TUU, strmv_TUN, strmv_TLU, strmv_TLN,
#endif
};
#ifdef SMPTEST
static int (*trmv_thread[])(BLASLONG, FLOAT *, BLASLONG, FLOAT *, BLASLONG, FLOAT *, int) = {
#ifdef XDOUBLE
qtrmv_thread_NUU, qtrmv_thread_NUN, qtrmv_thread_NLU, qtrmv_thread_NLN,
qtrmv_thread_TUU, qtrmv_thread_TUN, qtrmv_thread_TLU, qtrmv_thread_TLN,
#elif defined(DOUBLE)
dtrmv_thread_NUU, dtrmv_thread_NUN, dtrmv_thread_NLU, dtrmv_thread_NLN,
dtrmv_thread_TUU, dtrmv_thread_TUN, dtrmv_thread_TLU, dtrmv_thread_TLN,
#else
strmv_thread_NUU, strmv_thread_NUN, strmv_thread_NLU, strmv_thread_NLN,
strmv_thread_TUU, strmv_thread_TUN, strmv_thread_TLU, strmv_thread_TLN,
#endif
};
#endif
#ifndef CBLAS
void NAME(char *UPLO, char *TRANS, char *DIAG,
blasint *N, FLOAT *a, blasint *LDA, FLOAT *x, blasint *INCX){
char uplo_arg = *UPLO;
char trans_arg = *TRANS;
char diag_arg = *DIAG;
blasint n = *N;
blasint lda = *LDA;
blasint incx = *INCX;
blasint info;
int uplo;
int unit;
int trans;
FLOAT *buffer;
#ifdef SMPTEST
int nthreads;
#endif
PRINT_DEBUG_NAME;
TOUPPER(uplo_arg);
TOUPPER(trans_arg);
TOUPPER(diag_arg);
trans = -1;
unit = -1;
uplo = -1;
if (trans_arg == 'N') trans = 0;
if (trans_arg == 'T') trans = 1;
if (trans_arg == 'R') trans = 0;
if (trans_arg == 'C') trans = 1;
if (diag_arg == 'U') unit = 0;
if (diag_arg == 'N') unit = 1;
if (uplo_arg == 'U') uplo = 0;
if (uplo_arg == 'L') uplo = 1;
info = 0;
if (incx == 0) info = 8;
if (lda < MAX(1, n)) info = 6;
if (n < 0) info = 4;
if (unit < 0) info = 3;
if (trans < 0) info = 2;
if (uplo < 0) info = 1;
if (info != 0) {
BLASFUNC(xerbla)(ERROR_NAME, &info, sizeof(ERROR_NAME));
return;
}
#else
void CNAME(enum CBLAS_ORDER order, enum CBLAS_UPLO Uplo,
enum CBLAS_TRANSPOSE TransA, enum CBLAS_DIAG Diag,
blasint n, FLOAT *a, blasint lda, FLOAT *x, blasint incx) {
int trans, uplo, unit;
blasint info;
FLOAT *buffer;
#ifdef SMPTEST
int nthreads;
#endif
PRINT_DEBUG_CNAME;
unit = -1;
uplo = -1;
trans = -1;
info = 0;
if (order == CblasColMajor) {
if (Uplo == CblasUpper) uplo = 0;
if (Uplo == CblasLower) uplo = 1;
if (TransA == CblasNoTrans) trans = 0;
if (TransA == CblasTrans) trans = 1;
if (TransA == CblasConjNoTrans) trans = 0;
if (TransA == CblasConjTrans) trans = 1;
if (Diag == CblasUnit) unit = 0;
if (Diag == CblasNonUnit) unit = 1;
info = -1;
if (incx == 0) info = 8;
if (lda < MAX(1, n)) info = 6;
if (n < 0) info = 4;
if (unit < 0) info = 3;
if (trans < 0) info = 2;
if (uplo < 0) info = 1;
}
if (order == CblasRowMajor) {
if (Uplo == CblasUpper) uplo = 1;
if (Uplo == CblasLower) uplo = 0;
if (TransA == CblasNoTrans) trans = 1;
if (TransA == CblasTrans) trans = 0;
if (TransA == CblasConjNoTrans) trans = 1;
if (TransA == CblasConjTrans) trans = 0;
if (Diag == CblasUnit) unit = 0;
if (Diag == CblasNonUnit) unit = 1;
info = -1;
if (incx == 0) info = 8;
if (lda < MAX(1, n)) info = 6;
if (n < 0) info = 4;
if (unit < 0) info = 3;
if (trans < 0) info = 2;
if (uplo < 0) info = 1;
}
if (info >= 0) {
BLASFUNC(xerbla)(ERROR_NAME, &info, sizeof(ERROR_NAME));
return;
}
#endif
if (n == 0) return;
IDEBUG_START;
FUNCTION_PROFILE_START();
if (incx < 0 ) x -= (n - 1) * incx;
buffer = (FLOAT *)blas_memory_alloc(1);
#ifdef SMPTEST
nthreads = num_cpu_avail(2);
if (nthreads == 1) {
#endif
(trmv[(trans<<2) | (uplo<<1) | unit])(n, a, lda, x, incx, buffer);
#ifdef SMPTEST
} else {
(trmv_thread[(trans<<2) | (uplo<<1) | unit])(n, a, lda, x, incx, buffer, nthreads);
}
#endif
blas_memory_free(buffer);
FUNCTION_PROFILE_END(1, n * n / 2 + n, n * n);
IDEBUG_END;
return;
}

391
interface/trsm.c Normal file
View File

@ -0,0 +1,391 @@
/*********************************************************************/
/* Copyright 2009, 2010 The University of Texas at Austin. */
/* All rights reserved. */
/* */
/* Redistribution and use in source and binary forms, with or */
/* without modification, are permitted provided that the following */
/* conditions are met: */
/* */
/* 1. Redistributions of source code must retain the above */
/* copyright notice, this list of conditions and the following */
/* disclaimer. */
/* */
/* 2. Redistributions in binary form must reproduce the above */
/* copyright notice, this list of conditions and the following */
/* disclaimer in the documentation and/or other materials */
/* provided with the distribution. */
/* */
/* THIS SOFTWARE IS PROVIDED BY THE UNIVERSITY OF TEXAS AT */
/* AUSTIN ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, */
/* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF */
/* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE */
/* DISCLAIMED. IN NO EVENT SHALL THE UNIVERSITY OF TEXAS AT */
/* AUSTIN OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, */
/* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES */
/* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE */
/* GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR */
/* BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF */
/* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT */
/* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT */
/* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE */
/* POSSIBILITY OF SUCH DAMAGE. */
/* */
/* The views and conclusions contained in the software and */
/* documentation are those of the authors and should not be */
/* interpreted as representing official policies, either expressed */
/* or implied, of The University of Texas at Austin. */
/*********************************************************************/
#include <stdio.h>
#include <ctype.h>
#include "common.h"
#ifdef FUNCTION_PROFILE
#include "functable.h"
#endif
#ifndef TRMM
#ifndef COMPLEX
#ifdef XDOUBLE
#define ERROR_NAME "QTRSM "
#elif defined(DOUBLE)
#define ERROR_NAME "DTRSM "
#else
#define ERROR_NAME "STRSM "
#endif
#else
#ifdef XDOUBLE
#define ERROR_NAME "XTRSM "
#elif defined(DOUBLE)
#define ERROR_NAME "ZTRSM "
#else
#define ERROR_NAME "CTRSM "
#endif
#endif
#else
#ifndef COMPLEX
#ifdef XDOUBLE
#define ERROR_NAME "QTRMM "
#elif defined(DOUBLE)
#define ERROR_NAME "DTRMM "
#else
#define ERROR_NAME "STRMM "
#endif
#else
#ifdef XDOUBLE
#define ERROR_NAME "XTRMM "
#elif defined(DOUBLE)
#define ERROR_NAME "ZTRMM "
#else
#define ERROR_NAME "CTRMM "
#endif
#endif
#endif
static int (*trsm[])(blas_arg_t *, BLASLONG *, BLASLONG *, FLOAT *, FLOAT *, BLASLONG) = {
#ifndef TRMM
TRSM_LNUU, TRSM_LNUN, TRSM_LNLU, TRSM_LNLN,
TRSM_LTUU, TRSM_LTUN, TRSM_LTLU, TRSM_LTLN,
TRSM_LRUU, TRSM_LRUN, TRSM_LRLU, TRSM_LRLN,
TRSM_LCUU, TRSM_LCUN, TRSM_LCLU, TRSM_LCLN,
TRSM_RNUU, TRSM_RNUN, TRSM_RNLU, TRSM_RNLN,
TRSM_RTUU, TRSM_RTUN, TRSM_RTLU, TRSM_RTLN,
TRSM_RRUU, TRSM_RRUN, TRSM_RRLU, TRSM_RRLN,
TRSM_RCUU, TRSM_RCUN, TRSM_RCLU, TRSM_RCLN,
#else
TRMM_LNUU, TRMM_LNUN, TRMM_LNLU, TRMM_LNLN,
TRMM_LTUU, TRMM_LTUN, TRMM_LTLU, TRMM_LTLN,
TRMM_LRUU, TRMM_LRUN, TRMM_LRLU, TRMM_LRLN,
TRMM_LCUU, TRMM_LCUN, TRMM_LCLU, TRMM_LCLN,
TRMM_RNUU, TRMM_RNUN, TRMM_RNLU, TRMM_RNLN,
TRMM_RTUU, TRMM_RTUN, TRMM_RTLU, TRMM_RTLN,
TRMM_RRUU, TRMM_RRUN, TRMM_RRLU, TRMM_RRLN,
TRMM_RCUU, TRMM_RCUN, TRMM_RCLU, TRMM_RCLN,
#endif
};
#ifndef CBLAS
void NAME(char *SIDE, char *UPLO, char *TRANS, char *DIAG,
blasint *M, blasint *N, FLOAT *alpha,
FLOAT *a, blasint *ldA, FLOAT *b, blasint *ldB){
char side_arg = *SIDE;
char uplo_arg = *UPLO;
char trans_arg = *TRANS;
char diag_arg = *DIAG;
blas_arg_t args;
FLOAT *buffer;
FLOAT *sa, *sb;
#ifdef SMPTEST
#ifndef COMPLEX
#ifdef XDOUBLE
int mode = BLAS_XDOUBLE | BLAS_REAL;
#elif defined(DOUBLE)
int mode = BLAS_DOUBLE | BLAS_REAL;
#else
int mode = BLAS_SINGLE | BLAS_REAL;
#endif
#else
#ifdef XDOUBLE
int mode = BLAS_XDOUBLE | BLAS_COMPLEX;
#elif defined(DOUBLE)
int mode = BLAS_DOUBLE | BLAS_COMPLEX;
#else
int mode = BLAS_SINGLE | BLAS_COMPLEX;
#endif
#endif
#endif
blasint info;
int side;
int uplo;
int unit;
int trans;
int nrowa;
PRINT_DEBUG_NAME;
args.m = *M;
args.n = *N;
args.a = (void *)a;
args.b = (void *)b;
args.lda = *ldA;
args.ldb = *ldB;
args.beta = (void *)alpha;
TOUPPER(side_arg);
TOUPPER(uplo_arg);
TOUPPER(trans_arg);
TOUPPER(diag_arg);
side = -1;
trans = -1;
unit = -1;
uplo = -1;
if (side_arg == 'L') side = 0;
if (side_arg == 'R') side = 1;
if (trans_arg == 'N') trans = 0;
if (trans_arg == 'T') trans = 1;
if (trans_arg == 'R') trans = 2;
if (trans_arg == 'C') trans = 3;
if (diag_arg == 'U') unit = 0;
if (diag_arg == 'N') unit = 1;
if (uplo_arg == 'U') uplo = 0;
if (uplo_arg == 'L') uplo = 1;
nrowa = args.m;
if (side & 1) nrowa = args.n;
info = 0;
if (args.ldb < MAX(1,args.m)) info = 11;
if (args.lda < MAX(1,nrowa)) info = 9;
if (args.n < 0) info = 6;
if (args.m < 0) info = 5;
if (unit < 0) info = 4;
if (trans < 0) info = 3;
if (uplo < 0) info = 2;
if (side < 0) info = 1;
if (info != 0) {
BLASFUNC(xerbla)(ERROR_NAME, &info, sizeof(ERROR_NAME));
return;
}
#else
void CNAME(enum CBLAS_ORDER order,
enum CBLAS_SIDE Side, enum CBLAS_UPLO Uplo,
enum CBLAS_TRANSPOSE Trans, enum CBLAS_DIAG Diag,
blasint m, blasint n,
#ifndef COMPLEX
FLOAT alpha,
#else
FLOAT *alpha,
#endif
FLOAT *a, blasint lda,
FLOAT *b, blasint ldb) {
blas_arg_t args;
int side, uplo, trans, unit;
blasint info, nrowa;
XFLOAT *buffer;
XFLOAT *sa, *sb;
#ifdef SMPTEST
#ifndef COMPLEX
#ifdef XDOUBLE
int mode = BLAS_XDOUBLE | BLAS_REAL;
#elif defined(DOUBLE)
int mode = BLAS_DOUBLE | BLAS_REAL;
#else
int mode = BLAS_SINGLE | BLAS_REAL;
#endif
#else
#ifdef XDOUBLE
int mode = BLAS_XDOUBLE | BLAS_COMPLEX;
#elif defined(DOUBLE)
int mode = BLAS_DOUBLE | BLAS_COMPLEX;
#else
int mode = BLAS_SINGLE | BLAS_COMPLEX;
#endif
#endif
#endif
PRINT_DEBUG_CNAME;
args.a = (void *)a;
args.b = (void *)b;
args.lda = lda;
args.ldb = ldb;
#ifndef COMPLEX
args.beta = (void *)&alpha;
#else
args.beta = (void *)alpha;
#endif
side = -1;
uplo = -1;
trans = -1;
unit = -1;
info = 0;
if (order == CblasColMajor) {
args.m = m;
args.n = n;
if (Side == CblasLeft) side = 0;
if (Side == CblasRight) side = 1;
if (Uplo == CblasUpper) uplo = 0;
if (Uplo == CblasLower) uplo = 1;
if (Trans == CblasNoTrans) trans = 0;
if (Trans == CblasTrans) trans = 1;
#ifndef COMPLEX
if (Trans == CblasConjNoTrans) trans = 0;
if (Trans == CblasConjTrans) trans = 1;
#else
if (Trans == CblasConjNoTrans) trans = 2;
if (Trans == CblasConjTrans) trans = 3;
#endif
if (Diag == CblasUnit) unit = 0;
if (Diag == CblasNonUnit) unit = 1;
info = -1;
nrowa = args.m;
if (side & 1) nrowa = args.n;
if (args.ldb < MAX(1,args.m)) info = 11;
if (args.lda < MAX(1,nrowa)) info = 9;
if (args.n < 0) info = 6;
if (args.m < 0) info = 5;
if (unit < 0) info = 4;
if (trans < 0) info = 3;
if (uplo < 0) info = 2;
if (side < 0) info = 1;
}
if (order == CblasRowMajor) {
args.m = n;
args.n = m;
if (Side == CblasLeft) side = 1;
if (Side == CblasRight) side = 0;
if (Uplo == CblasUpper) uplo = 1;
if (Uplo == CblasLower) uplo = 0;
if (Trans == CblasNoTrans) trans = 0;
if (Trans == CblasTrans) trans = 1;
#ifndef COMPLEX
if (Trans == CblasConjNoTrans) trans = 0;
if (Trans == CblasConjTrans) trans = 1;
#else
if (Trans == CblasConjNoTrans) trans = 2;
if (Trans == CblasConjTrans) trans = 3;
#endif
if (Diag == CblasUnit) unit = 0;
if (Diag == CblasNonUnit) unit = 1;
info = -1;
nrowa = args.m;
if (side & 1) nrowa = args.n;
if (args.ldb < MAX(1,args.m)) info = 11;
if (args.lda < MAX(1,nrowa)) info = 9;
if (args.n < 0) info = 6;
if (args.m < 0) info = 5;
if (unit < 0) info = 4;
if (trans < 0) info = 3;
if (uplo < 0) info = 2;
if (side < 0) info = 1;
}
if (info >= 0) {
BLASFUNC(xerbla)(ERROR_NAME, &info, sizeof(ERROR_NAME));
return;
}
#endif
if ((args.m == 0) || (args.n == 0)) return;
IDEBUG_START;
FUNCTION_PROFILE_START();
buffer = (FLOAT *)blas_memory_alloc(0);
sa = (FLOAT *)((BLASLONG)buffer + GEMM_OFFSET_A);
sb = (FLOAT *)(((BLASLONG)sa + ((GEMM_P * GEMM_Q * COMPSIZE * SIZE + GEMM_ALIGN) & ~GEMM_ALIGN)) + GEMM_OFFSET_B);
#ifdef SMPTEST
mode |= (trans << BLAS_TRANSA_SHIFT);
mode |= (side << BLAS_RSIDE_SHIFT);
args.nthreads = num_cpu_avail(3);
if (args.nthreads == 1) {
#endif
(trsm[(side<<4) | (trans<<2) | (uplo<<1) | unit])(&args, NULL, NULL, sa, sb, 0);
#ifdef SMPTEST
} else {
if (!side) {
gemm_thread_n(mode, &args, NULL, NULL, trsm[(side<<4) | (trans<<2) | (uplo<<1) | unit], sa, sb, args.nthreads);
} else {
gemm_thread_m(mode, &args, NULL, NULL, trsm[(side<<4) | (trans<<2) | (uplo<<1) | unit], sa, sb, args.nthreads);
}
}
#endif
blas_memory_free(buffer);
FUNCTION_PROFILE_END(COMPSIZE * COMPSIZE,
(!side) ? args.m * (args.m + args.n) : args.n * (args.m + args.n),
(!side) ? args.m * args.m * args.n : args.m * args.n * args.n);
IDEBUG_END;
return;
}

208
interface/trsv.c Normal file
View File

@ -0,0 +1,208 @@
/*********************************************************************/
/* Copyright 2009, 2010 The University of Texas at Austin. */
/* All rights reserved. */
/* */
/* Redistribution and use in source and binary forms, with or */
/* without modification, are permitted provided that the following */
/* conditions are met: */
/* */
/* 1. Redistributions of source code must retain the above */
/* copyright notice, this list of conditions and the following */
/* disclaimer. */
/* */
/* 2. Redistributions in binary form must reproduce the above */
/* copyright notice, this list of conditions and the following */
/* disclaimer in the documentation and/or other materials */
/* provided with the distribution. */
/* */
/* THIS SOFTWARE IS PROVIDED BY THE UNIVERSITY OF TEXAS AT */
/* AUSTIN ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, */
/* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF */
/* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE */
/* DISCLAIMED. IN NO EVENT SHALL THE UNIVERSITY OF TEXAS AT */
/* AUSTIN OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, */
/* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES */
/* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE */
/* GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR */
/* BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF */
/* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT */
/* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT */
/* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE */
/* POSSIBILITY OF SUCH DAMAGE. */
/* */
/* The views and conclusions contained in the software and */
/* documentation are those of the authors and should not be */
/* interpreted as representing official policies, either expressed */
/* or implied, of The University of Texas at Austin. */
/*********************************************************************/
#include <stdio.h>
#include <ctype.h>
#include "common.h"
#ifdef FUNCTION_PROFILE
#include "functable.h"
#endif
#ifdef XDOUBLE
#define ERROR_NAME "QTRSV "
#elif defined(DOUBLE)
#define ERROR_NAME "DTRSV "
#else
#define ERROR_NAME "STRSV "
#endif
static int (*trsv[])(BLASLONG, FLOAT *, BLASLONG, FLOAT *, BLASLONG, void *) = {
#ifdef XDOUBLE
qtrsv_NUU, qtrsv_NUN, qtrsv_NLU, qtrsv_NLN,
qtrsv_TUU, qtrsv_TUN, qtrsv_TLU, qtrsv_TLN,
#elif defined(DOUBLE)
dtrsv_NUU, dtrsv_NUN, dtrsv_NLU, dtrsv_NLN,
dtrsv_TUU, dtrsv_TUN, dtrsv_TLU, dtrsv_TLN,
#else
strsv_NUU, strsv_NUN, strsv_NLU, strsv_NLN,
strsv_TUU, strsv_TUN, strsv_TLU, strsv_TLN,
#endif
};
#ifndef CBLAS
void NAME(char *UPLO, char *TRANS, char *DIAG,
blasint *N, FLOAT *a, blasint *LDA, FLOAT *x, blasint *INCX){
char uplo_arg = *UPLO;
char trans_arg = *TRANS;
char diag_arg = *DIAG;
blasint n = *N;
blasint lda = *LDA;
blasint incx = *INCX;
blasint info;
int uplo;
int unit;
int trans;
FLOAT *buffer;
PRINT_DEBUG_NAME;
TOUPPER(uplo_arg);
TOUPPER(trans_arg);
TOUPPER(diag_arg);
trans = -1;
unit = -1;
uplo = -1;
if (trans_arg == 'N') trans = 0;
if (trans_arg == 'T') trans = 1;
if (trans_arg == 'R') trans = 0;
if (trans_arg == 'C') trans = 1;
if (diag_arg == 'U') unit = 0;
if (diag_arg == 'N') unit = 1;
if (uplo_arg == 'U') uplo = 0;
if (uplo_arg == 'L') uplo = 1;
info = 0;
if (incx == 0) info = 8;
if (lda < MAX(1, n)) info = 6;
if (n < 0) info = 4;
if (unit < 0) info = 3;
if (trans < 0) info = 2;
if (uplo < 0) info = 1;
if (info != 0) {
BLASFUNC(xerbla)(ERROR_NAME, &info, sizeof(ERROR_NAME));
return;
}
#else
void CNAME(enum CBLAS_ORDER order, enum CBLAS_UPLO Uplo,
enum CBLAS_TRANSPOSE TransA, enum CBLAS_DIAG Diag,
blasint n, FLOAT *a, blasint lda, FLOAT *x, blasint incx) {
int trans, uplo, unit;
blasint info;
FLOAT *buffer;
PRINT_DEBUG_CNAME;
unit = -1;
uplo = -1;
trans = -1;
info = 0;
if (order == CblasColMajor) {
if (Uplo == CblasUpper) uplo = 0;
if (Uplo == CblasLower) uplo = 1;
if (TransA == CblasNoTrans) trans = 0;
if (TransA == CblasTrans) trans = 1;
if (TransA == CblasConjNoTrans) trans = 0;
if (TransA == CblasConjTrans) trans = 1;
if (Diag == CblasUnit) unit = 0;
if (Diag == CblasNonUnit) unit = 1;
info = -1;
if (incx == 0) info = 8;
if (lda < MAX(1, n)) info = 6;
if (n < 0) info = 4;
if (unit < 0) info = 3;
if (trans < 0) info = 2;
if (uplo < 0) info = 1;
}
if (order == CblasRowMajor) {
if (Uplo == CblasUpper) uplo = 1;
if (Uplo == CblasLower) uplo = 0;
if (TransA == CblasNoTrans) trans = 1;
if (TransA == CblasTrans) trans = 0;
if (TransA == CblasConjNoTrans) trans = 1;
if (TransA == CblasConjTrans) trans = 0;
if (Diag == CblasUnit) unit = 0;
if (Diag == CblasNonUnit) unit = 1;
info = -1;
if (incx == 0) info = 8;
if (lda < MAX(1, n)) info = 6;
if (n < 0) info = 4;
if (unit < 0) info = 3;
if (trans < 0) info = 2;
if (uplo < 0) info = 1;
}
if (info >= 0) {
BLASFUNC(xerbla)(ERROR_NAME, &info, sizeof(ERROR_NAME));
return;
}
#endif
if (n == 0) return;
IDEBUG_START;
FUNCTION_PROFILE_START();
if (incx < 0 ) x -= (n - 1) * incx;
buffer = (FLOAT *)blas_memory_alloc(1);
(trsv[(trans<<2) | (uplo<<1) | unit])(n, a, lda, x, incx, buffer);
blas_memory_free(buffer);
FUNCTION_PROFILE_END(1, n * n / 2 + n, n * n);
IDEBUG_END;
return;
}

134
interface/trti2.c Normal file
View File

@ -0,0 +1,134 @@
/*********************************************************************/
/* Copyright 2009, 2010 The University of Texas at Austin. */
/* All rights reserved. */
/* */
/* Redistribution and use in source and binary forms, with or */
/* without modification, are permitted provided that the following */
/* conditions are met: */
/* */
/* 1. Redistributions of source code must retain the above */
/* copyright notice, this list of conditions and the following */
/* disclaimer. */
/* */
/* 2. Redistributions in binary form must reproduce the above */
/* copyright notice, this list of conditions and the following */
/* disclaimer in the documentation and/or other materials */
/* provided with the distribution. */
/* */
/* THIS SOFTWARE IS PROVIDED BY THE UNIVERSITY OF TEXAS AT */
/* AUSTIN ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, */
/* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF */
/* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE */
/* DISCLAIMED. IN NO EVENT SHALL THE UNIVERSITY OF TEXAS AT */
/* AUSTIN OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, */
/* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES */
/* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE */
/* GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR */
/* BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF */
/* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT */
/* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT */
/* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE */
/* POSSIBILITY OF SUCH DAMAGE. */
/* */
/* The views and conclusions contained in the software and */
/* documentation are those of the authors and should not be */
/* interpreted as representing official policies, either expressed */
/* or implied, of The University of Texas at Austin. */
/*********************************************************************/
#include <stdio.h>
#include "common.h"
#ifdef FUNCTION_PROFILE
#include "functable.h"
#endif
#ifdef XDOUBLE
#define ERROR_NAME "QTRTI2"
#elif defined(DOUBLE)
#define ERROR_NAME "DTRTI2"
#else
#define ERROR_NAME "STRTI2"
#endif
static blasint (*trti2[])(blas_arg_t *, BLASLONG *, BLASLONG *, FLOAT *, FLOAT *, BLASLONG) = {
#ifdef XDOUBLE
qtrti2_UU, qtrti2_UN, qtrti2_LU, qtrti2_LN,
#elif defined(DOUBLE)
dtrti2_UU, dtrti2_UN, dtrti2_LU, dtrti2_LN,
#else
strti2_UU, strti2_UN, strti2_LU, strti2_LN,
#endif
};
int NAME(char *UPLO, char *DIAG, blasint *N, FLOAT *a, blasint *ldA, blasint *Info){
blas_arg_t args;
blasint uplo_arg = *UPLO;
blasint diag_arg = *DIAG;
blasint uplo, diag;
blasint info;
FLOAT *buffer;
#ifdef PPC440
extern
#endif
FLOAT *sa, *sb;
PRINT_DEBUG_NAME;
args.n = *N;
args.a = (void *)a;
args.lda = *ldA;
TOUPPER(uplo_arg);
TOUPPER(diag_arg);
uplo = -1;
if (uplo_arg == 'U') uplo = 0;
if (uplo_arg == 'L') uplo = 1;
diag = -1;
if (diag_arg == 'U') diag = 0;
if (diag_arg == 'N') diag = 1;
info = 0;
if (args.lda < MAX(1,args.n)) info = 5;
if (args.n < 0) info = 3;
if (diag < 0) info = 2;
if (uplo < 0) info = 1;
if (info) {
BLASFUNC(xerbla)(ERROR_NAME, &info, sizeof(ERROR_NAME));
*Info = - info;
return 0;
}
*Info = 0;
if (args.n <= 0) return 0;
IDEBUG_START;
FUNCTION_PROFILE_START();
#ifndef PPC440
buffer = (FLOAT *)blas_memory_alloc(1);
sa = (FLOAT *)((BLASLONG)buffer + GEMM_OFFSET_A);
sb = (FLOAT *)(((BLASLONG)sa + ((GEMM_P * GEMM_Q * COMPSIZE * SIZE + GEMM_ALIGN) & ~GEMM_ALIGN)) + GEMM_OFFSET_B);
#endif
info = (trti2[(uplo << 1) | diag])(&args, NULL, NULL, sa, sb, 0);
*Info = info;
#ifndef PPC440
blas_memory_free(buffer);
#endif
FUNCTION_PROFILE_END(COMPSIZE * COMPSIZE, .5 * args.n * args.n,
args.n * (1./3. + args.n * ( 1./2. + args.n * 1./6.))
+ args.n * (1./3. + args.n * (-1./2. + args.n * 1./6.)));
IDEBUG_END;
return 0;
}

156
interface/trtri.c Normal file
View File

@ -0,0 +1,156 @@
/*********************************************************************/
/* Copyright 2009, 2010 The University of Texas at Austin. */
/* All rights reserved. */
/* */
/* Redistribution and use in source and binary forms, with or */
/* without modification, are permitted provided that the following */
/* conditions are met: */
/* */
/* 1. Redistributions of source code must retain the above */
/* copyright notice, this list of conditions and the following */
/* disclaimer. */
/* */
/* 2. Redistributions in binary form must reproduce the above */
/* copyright notice, this list of conditions and the following */
/* disclaimer in the documentation and/or other materials */
/* provided with the distribution. */
/* */
/* THIS SOFTWARE IS PROVIDED BY THE UNIVERSITY OF TEXAS AT */
/* AUSTIN ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, */
/* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF */
/* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE */
/* DISCLAIMED. IN NO EVENT SHALL THE UNIVERSITY OF TEXAS AT */
/* AUSTIN OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, */
/* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES */
/* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE */
/* GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR */
/* BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF */
/* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT */
/* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT */
/* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE */
/* POSSIBILITY OF SUCH DAMAGE. */
/* */
/* The views and conclusions contained in the software and */
/* documentation are those of the authors and should not be */
/* interpreted as representing official policies, either expressed */
/* or implied, of The University of Texas at Austin. */
/*********************************************************************/
#include <stdio.h>
#include "common.h"
#ifdef FUNCTION_PROFILE
#include "functable.h"
#endif
#ifdef XDOUBLE
#define ERROR_NAME "QTRTRI"
#elif defined(DOUBLE)
#define ERROR_NAME "DTRTRI"
#else
#define ERROR_NAME "STRTRI"
#endif
static blasint (*trtri_single[])(blas_arg_t *, BLASLONG *, BLASLONG *, FLOAT *, FLOAT *, BLASLONG) ={
TRTRI_UU_SINGLE, TRTRI_UN_SINGLE, TRTRI_LU_SINGLE, TRTRI_LN_SINGLE,
};
#ifdef SMPTEST
static blasint (*trtri_parallel[])(blas_arg_t *, BLASLONG *, BLASLONG *, FLOAT *, FLOAT *, BLASLONG) ={
TRTRI_UU_PARALLEL, TRTRI_UN_PARALLEL, TRTRI_LU_PARALLEL, TRTRI_LN_PARALLEL,
};
#endif
int NAME(char *UPLO, char *DIAG, blasint *N, FLOAT *a, blasint *ldA, blasint *Info){
blas_arg_t args;
blasint uplo_arg = *UPLO;
blasint diag_arg = *DIAG;
blasint uplo, diag;
blasint info;
FLOAT *buffer;
#ifdef PPC440
extern
#endif
FLOAT *sa, *sb;
PRINT_DEBUG_NAME;
args.n = *N;
args.a = (void *)a;
args.lda = *ldA;
TOUPPER(uplo_arg);
TOUPPER(diag_arg);
uplo = -1;
if (uplo_arg == 'U') uplo = 0;
if (uplo_arg == 'L') uplo = 1;
diag = -1;
if (diag_arg == 'U') diag = 0;
if (diag_arg == 'N') diag = 1;
info = 0;
if (args.lda < MAX(1,args.n)) info = 5;
if (args.n < 0) info = 3;
if (diag < 0) info = 2;
if (uplo < 0) info = 1;
if (info) {
BLASFUNC(xerbla)(ERROR_NAME, &info, sizeof(ERROR_NAME));
*Info = - info;
return 0;
}
*Info = 0;
if (args.n == 0) return 0;
if (diag) {
if (AMIN_K(args.n, args.a, args.lda + 1) == ZERO) {
*Info = IAMIN_K(args.n, args.a, args.lda + 1);
return 0;
}
}
IDEBUG_START;
FUNCTION_PROFILE_START();
#ifndef PPC440
buffer = (FLOAT *)blas_memory_alloc(1);
sa = (FLOAT *)((BLASLONG)buffer + GEMM_OFFSET_A);
sb = (FLOAT *)(((BLASLONG)sa + ((GEMM_P * GEMM_Q * COMPSIZE * SIZE + GEMM_ALIGN) & ~GEMM_ALIGN)) + GEMM_OFFSET_B);
#endif
#ifdef SMPTEST
args.nthreads = num_cpu_avail(4);
if (args.nthreads == 1) {
#endif
*Info = (trtri_single[(uplo << 1) | diag])(&args, NULL, NULL, sa, sb, 0);
#ifdef SMPTEST
} else {
*Info = (trtri_parallel[(uplo << 1) | diag])(&args, NULL, NULL, sa, sb, 0);
}
#endif
#ifndef PPC440
blas_memory_free(buffer);
#endif
FUNCTION_PROFILE_END(COMPSIZE * COMPSIZE, .5 * args.n * args.n,
args.n * (1./3. + args.n * ( 1./2. + args.n * 1./6.))
+ args.n * (1./3. + args.n * (-1./2. + args.n * 1./6.)));
IDEBUG_END;
return 0;
}

127
interface/zaxpy.c Normal file
View File

@ -0,0 +1,127 @@
/*********************************************************************/
/* Copyright 2009, 2010 The University of Texas at Austin. */
/* All rights reserved. */
/* */
/* Redistribution and use in source and binary forms, with or */
/* without modification, are permitted provided that the following */
/* conditions are met: */
/* */
/* 1. Redistributions of source code must retain the above */
/* copyright notice, this list of conditions and the following */
/* disclaimer. */
/* */
/* 2. Redistributions in binary form must reproduce the above */
/* copyright notice, this list of conditions and the following */
/* disclaimer in the documentation and/or other materials */
/* provided with the distribution. */
/* */
/* THIS SOFTWARE IS PROVIDED BY THE UNIVERSITY OF TEXAS AT */
/* AUSTIN ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, */
/* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF */
/* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE */
/* DISCLAIMED. IN NO EVENT SHALL THE UNIVERSITY OF TEXAS AT */
/* AUSTIN OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, */
/* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES */
/* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE */
/* GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR */
/* BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF */
/* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT */
/* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT */
/* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE */
/* POSSIBILITY OF SUCH DAMAGE. */
/* */
/* The views and conclusions contained in the software and */
/* documentation are those of the authors and should not be */
/* interpreted as representing official policies, either expressed */
/* or implied, of The University of Texas at Austin. */
/*********************************************************************/
#include <stdio.h>
#include "common.h"
#ifdef FUNCTION_PROFILE
#include "functable.h"
#endif
#ifndef CBLAS
void NAME(blasint *N, FLOAT *ALPHA, FLOAT *x, blasint *INCX, FLOAT *y, blasint *INCY){
blasint n = *N;
blasint incx = *INCX;
blasint incy = *INCY;
#else
void CNAME(blasint n, FLOAT *ALPHA, FLOAT *x, blasint incx, FLOAT *y, blasint incy){
#endif
FLOAT alpha_r = *(ALPHA + 0);
FLOAT alpha_i = *(ALPHA + 1);
#ifdef SMPTEST
int mode, nthreads;
#endif
#ifndef CBLAS
PRINT_DEBUG_CNAME;
#else
PRINT_DEBUG_CNAME;
#endif
if (n <= 0) return;
if ((alpha_r == ZERO) && (alpha_i == ZERO)) return;
IDEBUG_START;
FUNCTION_PROFILE_START();
if (incx < 0) x -= (n - 1) * incx * 2;
if (incy < 0) y -= (n - 1) * incy * 2;
#ifdef SMPTEST
nthreads = num_cpu_avail(1);
//disable multi-thread when incx==0 or incy==0
//In that case, the threads would be dependent.
if (incx == 0 || incy == 0)
nthreads = 1;
if (nthreads == 1) {
#endif
#ifndef CONJ
AXPYU_K (n, 0, 0, alpha_r, alpha_i, x, incx, y, incy, NULL, 0);
#else
AXPYC_K(n, 0, 0, alpha_r, alpha_i, x, incx, y, incy, NULL, 0);
#endif
#ifdef SMPTEST
} else {
#ifdef XDOUBLE
mode = BLAS_XDOUBLE | BLAS_COMPLEX;
#elif defined(DOUBLE)
mode = BLAS_DOUBLE | BLAS_COMPLEX;
#else
mode = BLAS_SINGLE | BLAS_COMPLEX;
#endif
blas_level1_thread(mode, n, 0, 0, ALPHA, x, incx, y, incy, NULL, 0,
#ifndef CONJ
(void *)AXPYU_K,
#else
(void *)AXPYC_K,
#endif
nthreads);
}
#endif
FUNCTION_PROFILE_END(4, 2 * n, 2 * n);
IDEBUG_END;
return;
}

202
interface/zdot.c Normal file
View File

@ -0,0 +1,202 @@
/*********************************************************************/
/* Copyright 2009, 2010 The University of Texas at Austin. */
/* All rights reserved. */
/* */
/* Redistribution and use in source and binary forms, with or */
/* without modification, are permitted provided that the following */
/* conditions are met: */
/* */
/* 1. Redistributions of source code must retain the above */
/* copyright notice, this list of conditions and the following */
/* disclaimer. */
/* */
/* 2. Redistributions in binary form must reproduce the above */
/* copyright notice, this list of conditions and the following */
/* disclaimer in the documentation and/or other materials */
/* provided with the distribution. */
/* */
/* THIS SOFTWARE IS PROVIDED BY THE UNIVERSITY OF TEXAS AT */
/* AUSTIN ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, */
/* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF */
/* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE */
/* DISCLAIMED. IN NO EVENT SHALL THE UNIVERSITY OF TEXAS AT */
/* AUSTIN OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, */
/* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES */
/* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE */
/* GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR */
/* BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF */
/* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT */
/* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT */
/* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE */
/* POSSIBILITY OF SUCH DAMAGE. */
/* */
/* The views and conclusions contained in the software and */
/* documentation are those of the authors and should not be */
/* interpreted as representing official policies, either expressed */
/* or implied, of The University of Texas at Austin. */
/*********************************************************************/
#include <stdio.h>
#include "common.h"
#ifdef FUNCTION_PROFILE
#include "functable.h"
#endif
#ifdef RETURN_BY_STRUCT
#ifdef XDOUBLE
#define MYTYPE myxcomplex_t
#elif defined DOUBLE
#define MYTYPE myzcomplex_t
#else
#define MYTYPE myccomplex_t
#endif
#endif
#ifndef CBLAS
#ifdef RETURN_BY_STRUCT
MYTYPE NAME( blasint *N, FLOAT *x, blasint *INCX, FLOAT *y, blasint *INCY) {
#elif defined RETURN_BY_STACK
void NAME(FLOAT _Complex *result, blasint *N, FLOAT *x, blasint *INCX, FLOAT *y, blasint *INCY) {
#else
FLOAT _Complex NAME( blasint *N, FLOAT *x, blasint *INCX, FLOAT *y, blasint *INCY) {
#endif
BLASLONG n = *N;
BLASLONG incx = *INCX;
BLASLONG incy = *INCY;
#ifndef RETURN_BY_STACK
FLOAT _Complex ret;
#endif
#ifdef RETURN_BY_STRUCT
MYTYPE myret;
#endif
PRINT_DEBUG_NAME;
if (n <= 0) {
#ifdef RETURN_BY_STRUCT
myret.r = 0.;
myret.i = 0.;
return myret;
#elif defined RETURN_BY_STACK
*result = ZERO;
return;
#else
return ZERO;
#endif
}
IDEBUG_START;
FUNCTION_PROFILE_START();
if (incx < 0) x -= (n - 1) * incx * 2;
if (incy < 0) y -= (n - 1) * incy * 2;
#ifdef RETURN_BY_STRUCT
#ifndef CONJ
ret = DOTU_K(n, x, incx, y, incy);
#else
ret = DOTC_K(n, x, incx, y, incy);
#endif
myret.r = CREAL ret;
myret.i = CIMAG ret;
FUNCTION_PROFILE_END(4, 2 * n, 2 * n);
IDEBUG_END;
return myret;
#elif defined RETURN_BY_STACK
#ifndef CONJ
*result = DOTU_K(n, x, incx, y, incy);
#else
*result = DOTC_K(n, x, incx, y, incy);
#endif
FUNCTION_PROFILE_END(4, 2 * n, 2 * n);
IDEBUG_END;
#else
#ifndef CONJ
ret = DOTU_K(n, x, incx, y, incy);
#else
ret = DOTC_K(n, x, incx, y, incy);
#endif
FUNCTION_PROFILE_END(4, 2 * n, 2 * n);
IDEBUG_END;
return ret;
#endif
}
#else
#ifdef FORCE_USE_STACK
void CNAME(blasint n, FLOAT *x, blasint incx, FLOAT *y, blasint incy, FLOAT _Complex *result){
#else
FLOAT _Complex CNAME(blasint n, FLOAT *x, blasint incx, FLOAT *y, blasint incy){
FLOAT _Complex ret;
#endif
PRINT_DEBUG_CNAME;
if (n <= 0) {
#ifdef FORCE_USE_STACK
*result = ZERO;
return;
#else
return ZERO;
#endif
}
if (incx < 0) x -= (n - 1) * incx * 2;
if (incy < 0) y -= (n - 1) * incy * 2;
IDEBUG_START;
FUNCTION_PROFILE_START();
#ifdef FORCE_USE_STACK
#ifndef CONJ
*result = DOTU_K(n, x, incx, y, incy);
#else
*result = DOTC_K(n, x, incx, y, incy);
#endif
FUNCTION_PROFILE_END(4, 2 * n, 2 * n);
IDEBUG_END;
#else
#ifndef CONJ
ret = DOTU_K(n, x, incx, y, incy);
#else
ret = DOTC_K(n, x, incx, y, incy);
#endif
FUNCTION_PROFILE_END(4, 2 * n, 2 * n);
IDEBUG_END;
return ret;
#endif
}
#endif

271
interface/zgbmv.c Normal file
View File

@ -0,0 +1,271 @@
/*********************************************************************/
/* Copyright 2009, 2010 The University of Texas at Austin. */
/* All rights reserved. */
/* */
/* Redistribution and use in source and binary forms, with or */
/* without modification, are permitted provided that the following */
/* conditions are met: */
/* */
/* 1. Redistributions of source code must retain the above */
/* copyright notice, this list of conditions and the following */
/* disclaimer. */
/* */
/* 2. Redistributions in binary form must reproduce the above */
/* copyright notice, this list of conditions and the following */
/* disclaimer in the documentation and/or other materials */
/* provided with the distribution. */
/* */
/* THIS SOFTWARE IS PROVIDED BY THE UNIVERSITY OF TEXAS AT */
/* AUSTIN ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, */
/* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF */
/* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE */
/* DISCLAIMED. IN NO EVENT SHALL THE UNIVERSITY OF TEXAS AT */
/* AUSTIN OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, */
/* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES */
/* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE */
/* GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR */
/* BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF */
/* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT */
/* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT */
/* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE */
/* POSSIBILITY OF SUCH DAMAGE. */
/* */
/* The views and conclusions contained in the software and */
/* documentation are those of the authors and should not be */
/* interpreted as representing official policies, either expressed */
/* or implied, of The University of Texas at Austin. */
/*********************************************************************/
#include <stdio.h>
#include "common.h"
#ifdef FUNCTION_PROFILE
#include "functable.h"
#endif
#ifdef XDOUBLE
#define ERROR_NAME "XGBMV "
#elif defined(DOUBLE)
#define ERROR_NAME "ZGBMV "
#else
#define ERROR_NAME "CGBMV "
#endif
static void (*gbmv[])(BLASLONG, BLASLONG, BLASLONG, BLASLONG, FLOAT, FLOAT,
FLOAT *, BLASLONG, FLOAT *, BLASLONG, FLOAT *, BLASLONG, void *) = {
#ifdef XDOUBLE
xgbmv_n, xgbmv_t, xgbmv_r, xgbmv_c,
xgbmv_o, xgbmv_u, xgbmv_s, xgbmv_d,
#elif defined(DOUBLE)
zgbmv_n, zgbmv_t, zgbmv_r, zgbmv_c,
zgbmv_o, zgbmv_u, zgbmv_s, zgbmv_d,
#else
cgbmv_n, cgbmv_t, cgbmv_r, cgbmv_c,
cgbmv_o, cgbmv_u, cgbmv_s, cgbmv_d,
#endif
};
#ifdef SMPTEST
static int (*gbmv_thread[])(BLASLONG, BLASLONG, BLASLONG, BLASLONG, FLOAT *,
FLOAT *, BLASLONG, FLOAT *, BLASLONG, FLOAT *, BLASLONG, FLOAT *, int) = {
#ifdef XDOUBLE
xgbmv_thread_n, xgbmv_thread_t, xgbmv_thread_r, xgbmv_thread_c,
xgbmv_thread_o, xgbmv_thread_u, xgbmv_thread_s, xgbmv_thread_d,
#elif defined(DOUBLE)
zgbmv_thread_n, zgbmv_thread_t, zgbmv_thread_r, zgbmv_thread_c,
zgbmv_thread_o, zgbmv_thread_u, zgbmv_thread_s, zgbmv_thread_d,
#else
cgbmv_thread_n, cgbmv_thread_t, cgbmv_thread_r, cgbmv_thread_c,
cgbmv_thread_o, cgbmv_thread_u, cgbmv_thread_s, cgbmv_thread_d,
#endif
};
#endif
#ifndef CBLAS
void NAME(char *TRANS, blasint *M, blasint *N,
blasint *KU, blasint *KL,
FLOAT *ALPHA, FLOAT *a, blasint *LDA,
FLOAT *x, blasint *INCX,
FLOAT *BETA, FLOAT *y, blasint *INCY){
char trans = *TRANS;
blasint m = *M;
blasint n = *N;
blasint ku = *KU;
blasint kl = *KL;
blasint lda = *LDA;
blasint incx = *INCX;
blasint incy = *INCY;
FLOAT *buffer;
#ifdef SMPTEST
int nthreads;
#endif
FLOAT alpha_r = ALPHA[0];
FLOAT alpha_i = ALPHA[1];
FLOAT beta_r = BETA[0];
FLOAT beta_i = BETA[1];
blasint info;
blasint lenx, leny;
blasint i;
PRINT_DEBUG_NAME;
TOUPPER(trans);
info = 0;
i = -1;
if (trans == 'N') i = 0;
if (trans == 'T') i = 1;
if (trans == 'R') i = 2;
if (trans == 'C') i = 3;
if (trans == 'O') i = 4;
if (trans == 'U') i = 5;
if (trans == 'S') i = 6;
if (trans == 'D') i = 7;
if (incy == 0) info = 13;
if (incx == 0) info = 10;
if (lda < kl + ku + 1) info = 8;
if (kl < 0) info = 5;
if (ku < 0) info = 4;
if (n < 0) info = 3;
if (m < 0) info = 2;
if (i < 0) info = 1;
trans = i;
if (info != 0){
BLASFUNC(xerbla)(ERROR_NAME, &info, sizeof(ERROR_NAME));
return;
}
#else
void CNAME(enum CBLAS_ORDER order,
enum CBLAS_TRANSPOSE TransA,
blasint m, blasint n,
blasint ku, blasint kl,
FLOAT *ALPHA,
FLOAT *a, blasint lda,
FLOAT *x, blasint incx,
FLOAT *BETA,
FLOAT *y, blasint incy){
FLOAT alpha_r = ALPHA[0];
FLOAT alpha_i = ALPHA[1];
FLOAT beta_r = BETA[0];
FLOAT beta_i = BETA[1];
FLOAT *buffer;
blasint lenx, leny;
int trans;
blasint info, t;
#ifdef SMPTEST
int nthreads;
#endif
PRINT_DEBUG_CNAME;
trans = -1;
info = 0;
if (order == CblasColMajor) {
if (TransA == CblasNoTrans) trans = 0;
if (TransA == CblasTrans) trans = 1;
if (TransA == CblasConjNoTrans) trans = 2;
if (TransA == CblasConjTrans) trans = 3;
info = -1;
if (incy == 0) info = 13;
if (incx == 0) info = 10;
if (lda < kl + ku + 1) info = 8;
if (kl < 0) info = 5;
if (ku < 0) info = 4;
if (n < 0) info = 3;
if (m < 0) info = 2;
if (trans < 0) info = 1;
}
if (order == CblasRowMajor) {
if (TransA == CblasNoTrans) trans = 1;
if (TransA == CblasTrans) trans = 0;
if (TransA == CblasConjNoTrans) trans = 3;
if (TransA == CblasConjTrans) trans = 2;
info = -1;
t = n;
n = m;
m = t;
t = ku;
ku = kl;
kl = t;
if (incy == 0) info = 13;
if (incx == 0) info = 10;
if (lda < kl + ku + 1) info = 8;
if (kl < 0) info = 5;
if (ku < 0) info = 4;
if (n < 0) info = 3;
if (m < 0) info = 2;
if (trans < 0) info = 1;
}
if (info >= 0) {
BLASFUNC(xerbla)(ERROR_NAME, &info, sizeof(ERROR_NAME));
return;
}
#endif
if ((m==0) || (n==0)) return;
lenx = n;
leny = m;
if (trans & 1) lenx = m;
if (trans & 1) leny = n;
if (beta_r != ONE || beta_i != ZERO) SCAL_K(leny, 0, 0, beta_r, beta_i, y, abs(incy), NULL, 0, NULL, 0);
if (alpha_r == ZERO && alpha_i == ZERO) return;
IDEBUG_START;
FUNCTION_PROFILE_START();
if (incx < 0) x -= (lenx - 1) * incx * 2;
if (incy < 0) y -= (leny - 1) * incy * 2;
buffer = (FLOAT *)blas_memory_alloc(1);
#ifdef SMPTEST
nthreads = num_cpu_avail(2);
if (nthreads == 1) {
#endif
(gbmv[(int)trans])(m, n, kl, ku, alpha_r, alpha_i, a, lda, x, incx, y, incy, buffer);
#ifdef SMPTEST
} else {
(gbmv_thread[(int)trans])(m, n, kl, ku, ALPHA, a, lda, x, incx, y, incy, buffer, nthreads);
}
#endif
blas_memory_free(buffer);
FUNCTION_PROFILE_END(4, m * n / 2 + n, m * n);
IDEBUG_END;
return;
}

259
interface/zgemv.c Normal file
View File

@ -0,0 +1,259 @@
/*********************************************************************/
/* Copyright 2009, 2010 The University of Texas at Austin. */
/* All rights reserved. */
/* */
/* Redistribution and use in source and binary forms, with or */
/* without modification, are permitted provided that the following */
/* conditions are met: */
/* */
/* 1. Redistributions of source code must retain the above */
/* copyright notice, this list of conditions and the following */
/* disclaimer. */
/* */
/* 2. Redistributions in binary form must reproduce the above */
/* copyright notice, this list of conditions and the following */
/* disclaimer in the documentation and/or other materials */
/* provided with the distribution. */
/* */
/* THIS SOFTWARE IS PROVIDED BY THE UNIVERSITY OF TEXAS AT */
/* AUSTIN ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, */
/* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF */
/* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE */
/* DISCLAIMED. IN NO EVENT SHALL THE UNIVERSITY OF TEXAS AT */
/* AUSTIN OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, */
/* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES */
/* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE */
/* GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR */
/* BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF */
/* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT */
/* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT */
/* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE */
/* POSSIBILITY OF SUCH DAMAGE. */
/* */
/* The views and conclusions contained in the software and */
/* documentation are those of the authors and should not be */
/* interpreted as representing official policies, either expressed */
/* or implied, of The University of Texas at Austin. */
/*********************************************************************/
#include <stdio.h>
#include "common.h"
#ifdef FUNCTION_PROFILE
#include "functable.h"
#endif
#ifdef XDOUBLE
#define ERROR_NAME "XGEMV "
#elif defined(DOUBLE)
#define ERROR_NAME "ZGEMV "
#else
#define ERROR_NAME "CGEMV "
#endif
#ifdef SMPTEST
static int (*gemv_thread[])(BLASLONG, BLASLONG, FLOAT *, FLOAT *, BLASLONG, FLOAT * , BLASLONG, FLOAT *, BLASLONG, FLOAT *, int) = {
#ifdef XDOUBLE
xgemv_thread_n, xgemv_thread_t, xgemv_thread_r, xgemv_thread_c, xgemv_thread_o, xgemv_thread_u, xgemv_thread_s, xgemv_thread_d,
#elif defined DOUBLE
zgemv_thread_n, zgemv_thread_t, zgemv_thread_r, zgemv_thread_c, zgemv_thread_o, zgemv_thread_u, zgemv_thread_s, zgemv_thread_d,
#else
cgemv_thread_n, cgemv_thread_t, cgemv_thread_r, cgemv_thread_c, cgemv_thread_o, cgemv_thread_u, cgemv_thread_s, cgemv_thread_d,
#endif
};
#endif
#ifndef CBLAS
void NAME(char *TRANS, blasint *M, blasint *N,
FLOAT *ALPHA, FLOAT *a, blasint *LDA,
FLOAT *x, blasint *INCX,
FLOAT *BETA, FLOAT *y, blasint *INCY){
char trans = *TRANS;
blasint m = *M;
blasint n = *N;
blasint lda = *LDA;
blasint incx = *INCX;
blasint incy = *INCY;
FLOAT *buffer;
#ifdef SMPTEST
int nthreads;
#endif
int (*gemv[])(BLASLONG, BLASLONG, BLASLONG, FLOAT, FLOAT, FLOAT *, BLASLONG,
FLOAT * , BLASLONG, FLOAT *, BLASLONG, FLOAT *) = {
GEMV_N, GEMV_T, GEMV_R, GEMV_C,
GEMV_O, GEMV_U, GEMV_S, GEMV_D,
};
blasint info;
blasint lenx, leny;
blasint i;
PRINT_DEBUG_NAME;
FLOAT alpha_r = *(ALPHA + 0);
FLOAT alpha_i = *(ALPHA + 1);
FLOAT beta_r = *(BETA + 0);
FLOAT beta_i = *(BETA + 1);
TOUPPER(trans);
info = 0;
i = -1;
if (trans == 'N') i = 0;
if (trans == 'T') i = 1;
if (trans == 'R') i = 2;
if (trans == 'C') i = 3;
if (trans == 'O') i = 4;
if (trans == 'U') i = 5;
if (trans == 'S') i = 6;
if (trans == 'D') i = 7;
if (incy == 0) info = 11;
if (incx == 0) info = 8;
if (lda < MAX(1,m)) info = 6;
if (n < 0) info = 3;
if (m < 0) info = 2;
if (i < 0) info = 1;
trans = i;
if (info != 0) {
BLASFUNC(xerbla)(ERROR_NAME, &info, sizeof(ERROR_NAME));
return;
}
#else
void CNAME(enum CBLAS_ORDER order,
enum CBLAS_TRANSPOSE TransA,
blasint m, blasint n,
FLOAT *ALPHA,
FLOAT *a, blasint lda,
FLOAT *x, blasint incx,
FLOAT *BETA,
FLOAT *y, blasint incy){
FLOAT *buffer;
blasint lenx, leny;
int trans;
blasint info, t;
#ifdef SMPTEST
int nthreads;
#endif
int (*gemv[])(BLASLONG, BLASLONG, BLASLONG, FLOAT, FLOAT, FLOAT *, BLASLONG,
FLOAT * , BLASLONG, FLOAT *, BLASLONG, FLOAT *) = {
GEMV_N, GEMV_T, GEMV_R, GEMV_C,
GEMV_O, GEMV_U, GEMV_S, GEMV_D,
};
PRINT_DEBUG_CNAME;
FLOAT alpha_r = *(ALPHA + 0);
FLOAT alpha_i = *(ALPHA + 1);
FLOAT beta_r = *(BETA + 0);
FLOAT beta_i = *(BETA + 1);
trans = -1;
info = 0;
if (order == CblasColMajor) {
if (TransA == CblasNoTrans) trans = 0;
if (TransA == CblasTrans) trans = 1;
if (TransA == CblasConjNoTrans) trans = 2;
if (TransA == CblasConjTrans) trans = 3;
info = -1;
if (incy == 0) info = 11;
if (incx == 0) info = 8;
if (lda < MAX(1, m)) info = 6;
if (n < 0) info = 3;
if (m < 0) info = 2;
if (trans < 0) info = 1;
}
if (order == CblasRowMajor) {
if (TransA == CblasNoTrans) trans = 1;
if (TransA == CblasTrans) trans = 0;
if (TransA == CblasConjNoTrans) trans = 3;
if (TransA == CblasConjTrans) trans = 2;
info = -1;
t = n;
n = m;
m = t;
if (incy == 0) info = 11;
if (incx == 0) info = 8;
if (lda < MAX(1, m)) info = 6;
if (n < 0) info = 3;
if (m < 0) info = 2;
if (trans < 0) info = 1;
}
if (info >= 0) {
BLASFUNC(xerbla)(ERROR_NAME, &info, sizeof(ERROR_NAME));
return;
}
#endif
/* Quick return if possible. */
if (m == 0 || n == 0) return;
lenx = n;
leny = m;
if (trans & 1) lenx = m;
if (trans & 1) leny = n;
if (beta_r != ONE || beta_i != ZERO) SCAL_K(leny, 0, 0, beta_r, beta_i, y, abs(incy), NULL, 0, NULL, 0);
if (alpha_r == ZERO && alpha_i == ZERO) return;
IDEBUG_START;
FUNCTION_PROFILE_START();
if (incx < 0) x -= (lenx - 1) * incx * 2;
if (incy < 0) y -= (leny - 1) * incy * 2;
buffer = (FLOAT *)blas_memory_alloc(1);
#ifdef SMPTEST
nthreads = num_cpu_avail(2);
if (nthreads == 1) {
#endif
(gemv[(int)trans])(m, n, 0, alpha_r, alpha_i, a, lda, x, incx, y, incy, buffer);
#ifdef SMPTEST
} else {
(gemv_thread[(int)trans])(m, n, ALPHA, a, lda, x, incx, y, incy, buffer, nthreads);
}
#endif
blas_memory_free(buffer);
FUNCTION_PROFILE_END(4, m * n + m + n, 2 * m * n);
IDEBUG_END;
return;
}

249
interface/zger.c Normal file
View File

@ -0,0 +1,249 @@
/*********************************************************************/
/* Copyright 2009, 2010 The University of Texas at Austin. */
/* All rights reserved. */
/* */
/* Redistribution and use in source and binary forms, with or */
/* without modification, are permitted provided that the following */
/* conditions are met: */
/* */
/* 1. Redistributions of source code must retain the above */
/* copyright notice, this list of conditions and the following */
/* disclaimer. */
/* */
/* 2. Redistributions in binary form must reproduce the above */
/* copyright notice, this list of conditions and the following */
/* disclaimer in the documentation and/or other materials */
/* provided with the distribution. */
/* */
/* THIS SOFTWARE IS PROVIDED BY THE UNIVERSITY OF TEXAS AT */
/* AUSTIN ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, */
/* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF */
/* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE */
/* DISCLAIMED. IN NO EVENT SHALL THE UNIVERSITY OF TEXAS AT */
/* AUSTIN OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, */
/* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES */
/* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE */
/* GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR */
/* BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF */
/* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT */
/* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT */
/* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE */
/* POSSIBILITY OF SUCH DAMAGE. */
/* */
/* The views and conclusions contained in the software and */
/* documentation are those of the authors and should not be */
/* interpreted as representing official policies, either expressed */
/* or implied, of The University of Texas at Austin. */
/*********************************************************************/
#include <stdio.h>
#include "common.h"
#ifdef FUNCTION_PROFILE
#include "functable.h"
#endif
#ifdef XDOUBLE
#ifndef CONJ
#define ERROR_NAME "XGERU "
#else
#define ERROR_NAME "XGERC "
#endif
#elif defined DOUBLE
#ifndef CONJ
#define ERROR_NAME "ZGERU "
#else
#define ERROR_NAME "ZGERC "
#endif
#else
#ifndef CONJ
#define ERROR_NAME "CGERU "
#else
#define ERROR_NAME "CGERC "
#endif
#endif
#if defined XDOUBLE
#ifndef CONJ
#define GER GERU_K
#define GER_THREAD xger_thread_U
#else
#define GER GERC_K
#define GER_THREAD xger_thread_C
#define GERV GERV_K
#define GERV_THREAD xger_thread_V
#endif
#elif defined DOUBLE
#ifndef CONJ
#define GER GERU_K
#define GER_THREAD zger_thread_U
#else
#define GER GERC_K
#define GER_THREAD zger_thread_C
#define GERV GERV_K
#define GERV_THREAD zger_thread_V
#endif
#else
#ifndef CONJ
#define GER GERU_K
#define GER_THREAD cger_thread_U
#else
#define GER GERC_K
#define GER_THREAD cger_thread_C
#define GERV GERV_K
#define GERV_THREAD cger_thread_V
#endif
#endif
#ifndef CBLAS
void NAME(blasint *M, blasint *N, FLOAT *Alpha,
FLOAT *x, blasint *INCX,
FLOAT *y, blasint *INCY,
FLOAT *a, blasint *LDA){
blasint m = *M;
blasint n = *N;
FLOAT alpha_r = Alpha[0];
FLOAT alpha_i = Alpha[1];
blasint incx = *INCX;
blasint incy = *INCY;
blasint lda = *LDA;
FLOAT *buffer;
#ifdef SMPTEST
int nthreads;
#endif
blasint info;
PRINT_DEBUG_NAME;
info = 0;
if (lda < MAX(1,m)) info = 9;
if (incy == 0) info = 7;
if (incx == 0) info = 5;
if (n < 0) info = 2;
if (m < 0) info = 1;
if (info){
BLASFUNC(xerbla)(ERROR_NAME, &info, sizeof(ERROR_NAME));
return;
}
#else
void CNAME(enum CBLAS_ORDER order,
blasint m, blasint n,
FLOAT *Alpha,
FLOAT *x, blasint incx,
FLOAT *y, blasint incy,
FLOAT *a, blasint lda) {
FLOAT alpha_r = Alpha[0];
FLOAT alpha_i = Alpha[1];
FLOAT *buffer;
blasint info, t;
#ifdef SMPTEST
int nthreads;
#endif
PRINT_DEBUG_CNAME;
info = 0;
if (order == CblasColMajor) {
info = -1;
if (lda < MAX(1,m)) info = 9;
if (incy == 0) info = 7;
if (incx == 0) info = 5;
if (n < 0) info = 2;
if (m < 0) info = 1;
}
if (order == CblasRowMajor) {
info = -1;
t = n;
n = m;
m = t;
t = incx;
incx = incy;
incy = t;
buffer = x;
x = y;
y = buffer;
if (lda < MAX(1,m)) info = 9;
if (incy == 0) info = 7;
if (incx == 0) info = 5;
if (n < 0) info = 2;
if (m < 0) info = 1;
}
if (info >= 0) {
BLASFUNC(xerbla)(ERROR_NAME, &info, sizeof(ERROR_NAME));
return;
}
#endif
/* Quick return if possible. */
if (m == 0 || n == 0) return;
if ((alpha_r == 0.) && (alpha_i == 0.)) return;
IDEBUG_START;
FUNCTION_PROFILE_START();
if (incy < 0) y -= (n - 1) * incy * 2;
if (incx < 0) x -= (m - 1) * incx * 2;
buffer = (FLOAT *)blas_memory_alloc(1);
#ifdef SMPTEST
nthreads = num_cpu_avail(2);
if (nthreads == 1) {
#endif
#if !defined(CBLAS) || !defined(CONJ)
GER(m, n, 0, alpha_r, alpha_i, x, incx, y, incy, a, lda, buffer);
#else
if (order == CblasColMajor) {
GER(m, n, 0, alpha_r, alpha_i, x, incx, y, incy, a, lda, buffer);
} else {
GERV(m, n, 0, alpha_r, alpha_i, x, incx, y, incy, a, lda, buffer);
}
#endif
#ifdef SMPTEST
} else {
#if !defined(CBLAS) || !defined(CONJ)
GER_THREAD(m, n, Alpha, x, incx, y, incy, a, lda, buffer, nthreads);
#else
if (order == CblasColMajor) {
GER_THREAD(m, n, Alpha, x, incx, y, incy, a, lda, buffer, nthreads);
} else {
GERV_THREAD(m, n, Alpha, x, incx, y, incy, a, lda, buffer, nthreads);
}
#endif
}
#endif
blas_memory_free(buffer);
FUNCTION_PROFILE_END(4, m * n + m + n, 2 * m * n);
IDEBUG_END;
return;
}

223
interface/zhbmv.c Normal file
View File

@ -0,0 +1,223 @@
/*********************************************************************/
/* Copyright 2009, 2010 The University of Texas at Austin. */
/* All rights reserved. */
/* */
/* Redistribution and use in source and binary forms, with or */
/* without modification, are permitted provided that the following */
/* conditions are met: */
/* */
/* 1. Redistributions of source code must retain the above */
/* copyright notice, this list of conditions and the following */
/* disclaimer. */
/* */
/* 2. Redistributions in binary form must reproduce the above */
/* copyright notice, this list of conditions and the following */
/* disclaimer in the documentation and/or other materials */
/* provided with the distribution. */
/* */
/* THIS SOFTWARE IS PROVIDED BY THE UNIVERSITY OF TEXAS AT */
/* AUSTIN ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, */
/* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF */
/* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE */
/* DISCLAIMED. IN NO EVENT SHALL THE UNIVERSITY OF TEXAS AT */
/* AUSTIN OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, */
/* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES */
/* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE */
/* GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR */
/* BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF */
/* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT */
/* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT */
/* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE */
/* POSSIBILITY OF SUCH DAMAGE. */
/* */
/* The views and conclusions contained in the software and */
/* documentation are those of the authors and should not be */
/* interpreted as representing official policies, either expressed */
/* or implied, of The University of Texas at Austin. */
/*********************************************************************/
#include <stdio.h>
#include <ctype.h>
#include "common.h"
#ifdef FUNCTION_PROFILE
#include "functable.h"
#endif
#ifdef XDOUBLE
#define ERROR_NAME "XHBMV "
#elif defined(DOUBLE)
#define ERROR_NAME "ZHBMV "
#else
#define ERROR_NAME "CHBMV "
#endif
static int (*hbmv[])(BLASLONG, BLASLONG, FLOAT, FLOAT, FLOAT *, BLASLONG, FLOAT *, BLASLONG, FLOAT *, BLASLONG, void *) = {
#ifdef XDOUBLE
xhbmv_U, xhbmv_L, xhbmv_V, xhbmv_M,
#elif defined(DOUBLE)
zhbmv_U, zhbmv_L, zhbmv_V, zhbmv_M,
#else
chbmv_U, chbmv_L, chbmv_V, chbmv_M,
#endif
};
#ifdef SMPTEST
static int (*hbmv_thread[])(BLASLONG, BLASLONG, FLOAT *, FLOAT *, BLASLONG, FLOAT *, BLASLONG, FLOAT *, BLASLONG, FLOAT *, int) = {
#ifdef XDOUBLE
xhbmv_thread_U, xhbmv_thread_L, xhbmv_thread_V, xhbmv_thread_M,
#elif defined(DOUBLE)
zhbmv_thread_U, zhbmv_thread_L, zhbmv_thread_V, zhbmv_thread_M,
#else
chbmv_thread_U, chbmv_thread_L, chbmv_thread_V, chbmv_thread_M,
#endif
};
#endif
#ifndef CBLAS
void NAME(char *UPLO, blasint *N, blasint *K, FLOAT *ALPHA, FLOAT *a, blasint *LDA,
FLOAT *x, blasint *INCX, FLOAT *BETA, FLOAT *y, blasint *INCY){
char uplo_arg = *UPLO;
blasint n = *N;
blasint k = *K;
FLOAT alpha_r = ALPHA[0];
FLOAT alpha_i = ALPHA[1];
blasint lda = *LDA;
blasint incx = *INCX;
FLOAT beta_r = BETA[0];
FLOAT beta_i = BETA[1];
blasint incy = *INCY;
blasint info;
int uplo;
FLOAT *buffer;
#ifdef SMPTEST
int nthreads;
#endif
PRINT_DEBUG_NAME;
TOUPPER(uplo_arg);
uplo = -1;
if (uplo_arg == 'U') uplo = 0;
if (uplo_arg == 'L') uplo = 1;
if (uplo_arg == 'V') uplo = 2;
if (uplo_arg == 'M') uplo = 3;
info = 0;
if (incy == 0) info = 11;
if (incx == 0) info = 8;
if (lda < k + 1) info = 6;
if (k < 0) info = 3;
if (n < 0) info = 2;
if (uplo < 0) info = 1;
if (info != 0) {
BLASFUNC(xerbla)(ERROR_NAME, &info, sizeof(ERROR_NAME));
return;
}
#else
void CNAME(enum CBLAS_ORDER order,
enum CBLAS_UPLO Uplo,
blasint n, blasint k,
FLOAT *ALPHA,
FLOAT *a, blasint lda,
FLOAT *x, blasint incx,
FLOAT *BETA,
FLOAT *y, blasint incy){
FLOAT alpha_r = ALPHA[0];
FLOAT alpha_i = ALPHA[1];
FLOAT beta_r = BETA[0];
FLOAT beta_i = BETA[1];
FLOAT *buffer;
int uplo;
blasint info;
#ifdef SMPTEST
int nthreads;
#endif
PRINT_DEBUG_CNAME;
uplo = -1;
info = 0;
if (order == CblasColMajor) {
if (Uplo == CblasUpper) uplo = 0;
if (Uplo == CblasLower) uplo = 1;
info = -1;
if (incy == 0) info = 11;
if (incx == 0) info = 8;
if (lda < k + 1) info = 6;
if (k < 0) info = 3;
if (n < 0) info = 2;
if (uplo < 0) info = 1;
}
if (order == CblasRowMajor) {
if (Uplo == CblasUpper) uplo = 3;
if (Uplo == CblasLower) uplo = 2;
info = -1;
if (incy == 0) info = 11;
if (incx == 0) info = 8;
if (lda < k + 1) info = 6;
if (k < 0) info = 3;
if (n < 0) info = 2;
if (uplo < 0) info = 1;
}
if (info >= 0) {
BLASFUNC(xerbla)(ERROR_NAME, &info, sizeof(ERROR_NAME));
return;
}
#endif
if (n == 0) return;
if ((beta_r != ONE) || (beta_i != ZERO)) SCAL_K(n, 0, 0, beta_r, beta_i, y, abs(incy), NULL, 0, NULL, 0);
if ((alpha_r == ZERO) && (alpha_i == ZERO)) return;
IDEBUG_START;
FUNCTION_PROFILE_START();
if (incx < 0 ) x -= (n - 1) * incx * COMPSIZE;
if (incy < 0 ) y -= (n - 1) * incy * COMPSIZE;
buffer = (FLOAT *)blas_memory_alloc(1);
#ifdef SMPTEST
nthreads = num_cpu_avail(2);
if (nthreads == 1) {
#endif
(hbmv[uplo])(n, k, alpha_r, alpha_i, a, lda, x, incx, y, incy, buffer);
#ifdef SMPTEST
} else {
(hbmv_thread[uplo])(n, k, ALPHA, a, lda, x, incx, y, incy, buffer, nthreads);
}
#endif
blas_memory_free(buffer);
FUNCTION_PROFILE_END(4, n * k / 2 + n, n * k);
IDEBUG_END;
return;
}

215
interface/zhemv.c Normal file
View File

@ -0,0 +1,215 @@
/*********************************************************************/
/* Copyright 2009, 2010 The University of Texas at Austin. */
/* All rights reserved. */
/* */
/* Redistribution and use in source and binary forms, with or */
/* without modification, are permitted provided that the following */
/* conditions are met: */
/* */
/* 1. Redistributions of source code must retain the above */
/* copyright notice, this list of conditions and the following */
/* disclaimer. */
/* */
/* 2. Redistributions in binary form must reproduce the above */
/* copyright notice, this list of conditions and the following */
/* disclaimer in the documentation and/or other materials */
/* provided with the distribution. */
/* */
/* THIS SOFTWARE IS PROVIDED BY THE UNIVERSITY OF TEXAS AT */
/* AUSTIN ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, */
/* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF */
/* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE */
/* DISCLAIMED. IN NO EVENT SHALL THE UNIVERSITY OF TEXAS AT */
/* AUSTIN OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, */
/* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES */
/* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE */
/* GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR */
/* BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF */
/* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT */
/* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT */
/* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE */
/* POSSIBILITY OF SUCH DAMAGE. */
/* */
/* The views and conclusions contained in the software and */
/* documentation are those of the authors and should not be */
/* interpreted as representing official policies, either expressed */
/* or implied, of The University of Texas at Austin. */
/*********************************************************************/
#include <stdio.h>
#include <ctype.h>
#include "common.h"
#ifdef FUNCTION_PROFILE
#include "functable.h"
#endif
#ifdef XDOUBLE
#define ERROR_NAME "XHEMV "
#elif defined(DOUBLE)
#define ERROR_NAME "ZHEMV "
#else
#define ERROR_NAME "CHEMV "
#endif
#ifndef CBLAS
void NAME(char *UPLO, blasint *N, FLOAT *ALPHA, FLOAT *a, blasint *LDA,
FLOAT *x, blasint *INCX, FLOAT *BETA, FLOAT *y, blasint *INCY){
char uplo_arg = *UPLO;
blasint n = *N;
FLOAT alpha_r = ALPHA[0];
FLOAT alpha_i = ALPHA[1];
blasint lda = *LDA;
blasint incx = *INCX;
FLOAT beta_r = BETA[0];
FLOAT beta_i = BETA[1];
blasint incy = *INCY;
#ifdef SMPTEST
int nthreads;
#endif
int (*hemv[])(BLASLONG, BLASLONG, FLOAT, FLOAT, FLOAT *, BLASLONG, FLOAT *, BLASLONG, FLOAT *, BLASLONG, FLOAT *) = {
HEMV_U, HEMV_L, HEMV_V, HEMV_M,
};
#ifdef SMPTEST
int (*hemv_thread[])(BLASLONG, FLOAT *, FLOAT *, BLASLONG, FLOAT *, BLASLONG, FLOAT *, BLASLONG, FLOAT *, int) = {
HEMV_THREAD_U, HEMV_THREAD_L, HEMV_THREAD_V, HEMV_THREAD_M,
};
#endif
blasint info;
int uplo;
FLOAT *buffer;
PRINT_DEBUG_NAME;
TOUPPER(uplo_arg);
uplo = -1;
if (uplo_arg == 'U') uplo = 0;
if (uplo_arg == 'L') uplo = 1;
if (uplo_arg == 'V') uplo = 2;
if (uplo_arg == 'M') uplo = 3;
info = 0;
if (incy == 0) info = 10;
if (incx == 0) info = 7;
if (lda < MAX(1, n)) info = 5;
if (n < 0) info = 2;
if (uplo < 0) info = 1;
if (info != 0) {
BLASFUNC(xerbla)(ERROR_NAME, &info, sizeof(ERROR_NAME));
return;
}
#else
void CNAME(enum CBLAS_ORDER order, enum CBLAS_UPLO Uplo, blasint n, FLOAT *ALPHA,
FLOAT *a, blasint lda, FLOAT *x, blasint incx, FLOAT *BETA, FLOAT *y, blasint incy) {
FLOAT alpha_r = ALPHA[0];
FLOAT alpha_i = ALPHA[1];
FLOAT beta_r = BETA[0];
FLOAT beta_i = BETA[1];
FLOAT *buffer;
int trans, uplo;
blasint info;
#ifdef SMPTEST
int nthreads;
#endif
int (*hemv[])(BLASLONG, BLASLONG, FLOAT, FLOAT, FLOAT *, BLASLONG, FLOAT *, BLASLONG, FLOAT *, BLASLONG, FLOAT *) = {
HEMV_U, HEMV_L, HEMV_V, HEMV_M,
};
#ifdef SMPTEST
int (*hemv_thread[])(BLASLONG, FLOAT *, FLOAT *, BLASLONG, FLOAT *, BLASLONG, FLOAT *, BLASLONG, FLOAT *, int) = {
HEMV_THREAD_U, HEMV_THREAD_L, HEMV_THREAD_V, HEMV_THREAD_M,
};
#endif
PRINT_DEBUG_CNAME;
trans = -1;
uplo = -1;
info = 0;
if (order == CblasColMajor) {
if (Uplo == CblasUpper) uplo = 0;
if (Uplo == CblasLower) uplo = 1;
info = -1;
if (incy == 0) info = 10;
if (incx == 0) info = 7;
if (lda < MAX(1, n)) info = 5;
if (n < 0) info = 2;
if (uplo < 0) info = 1;
}
if (order == CblasRowMajor) {
if (Uplo == CblasUpper) uplo = 3;
if (Uplo == CblasLower) uplo = 2;
info = -1;
if (incy == 0) info = 10;
if (incx == 0) info = 7;
if (lda < MAX(1, n)) info = 5;
if (n < 0) info = 2;
if (uplo < 0) info = 1;
}
if (info >= 0) {
BLASFUNC(xerbla)(ERROR_NAME, &info, sizeof(ERROR_NAME));
return;
}
#endif
if (n == 0) return;
if ((beta_r != ONE) || (beta_i != ZERO)) SCAL_K(n, 0, 0, beta_r, beta_i, y, abs(incy), NULL, 0, NULL, 0);
if ((alpha_r == ZERO) && (alpha_i == ZERO)) return;
IDEBUG_START;
FUNCTION_PROFILE_START();
if (incx < 0 ) x -= (n - 1) * incx * 2;
if (incy < 0 ) y -= (n - 1) * incy * 2;
buffer = (FLOAT *)blas_memory_alloc(1);
#ifdef SMPTEST
nthreads = num_cpu_avail(2);
if (nthreads == 1) {
#endif
(hemv[uplo])(n, n, alpha_r, alpha_i, a, lda, x, incx, y, incy, buffer);
#ifdef SMPTEST
} else {
(hemv_thread[uplo])(n, ALPHA, a, lda, x, incx, y, incy, buffer, nthreads);
}
#endif
blas_memory_free(buffer);
FUNCTION_PROFILE_END(4, n * n / 2 + n, 2 * n * n);
IDEBUG_END;
return;
}

200
interface/zher.c Normal file
View File

@ -0,0 +1,200 @@
/*********************************************************************/
/* Copyright 2009, 2010 The University of Texas at Austin. */
/* All rights reserved. */
/* */
/* Redistribution and use in source and binary forms, with or */
/* without modification, are permitted provided that the following */
/* conditions are met: */
/* */
/* 1. Redistributions of source code must retain the above */
/* copyright notice, this list of conditions and the following */
/* disclaimer. */
/* */
/* 2. Redistributions in binary form must reproduce the above */
/* copyright notice, this list of conditions and the following */
/* disclaimer in the documentation and/or other materials */
/* provided with the distribution. */
/* */
/* THIS SOFTWARE IS PROVIDED BY THE UNIVERSITY OF TEXAS AT */
/* AUSTIN ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, */
/* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF */
/* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE */
/* DISCLAIMED. IN NO EVENT SHALL THE UNIVERSITY OF TEXAS AT */
/* AUSTIN OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, */
/* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES */
/* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE */
/* GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR */
/* BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF */
/* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT */
/* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT */
/* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE */
/* POSSIBILITY OF SUCH DAMAGE. */
/* */
/* The views and conclusions contained in the software and */
/* documentation are those of the authors and should not be */
/* interpreted as representing official policies, either expressed */
/* or implied, of The University of Texas at Austin. */
/*********************************************************************/
#include <stdio.h>
#include <ctype.h>
#include "common.h"
#ifdef FUNCTION_PROFILE
#include "functable.h"
#endif
#ifdef XDOUBLE
#define ERROR_NAME "XHER "
#elif defined(DOUBLE)
#define ERROR_NAME "ZHER "
#else
#define ERROR_NAME "CHER "
#endif
static int (*her[])(BLASLONG, FLOAT, FLOAT *, BLASLONG, FLOAT *, BLASLONG, FLOAT *) = {
#ifdef XDOUBLE
xher_U, xher_L, xher_V, xher_M,
#elif defined(DOUBLE)
zher_U, zher_L, zher_V, zher_M,
#else
cher_U, cher_L, cher_V, cher_M,
#endif
};
#ifdef SMPTEST
static int (*her_thread[])(BLASLONG, FLOAT, FLOAT *, BLASLONG, FLOAT *, BLASLONG, FLOAT *, int) = {
#ifdef XDOUBLE
xher_thread_U, xher_thread_L, xher_thread_V, xher_thread_M,
#elif defined(DOUBLE)
zher_thread_U, zher_thread_L, zher_thread_V, zher_thread_M,
#else
cher_thread_U, cher_thread_L, cher_thread_V, cher_thread_M,
#endif
};
#endif
#ifndef CBLAS
void NAME(char *UPLO, blasint *N, FLOAT *ALPHA,
FLOAT *x, blasint *INCX, FLOAT *a, blasint *LDA){
char uplo_arg = *UPLO;
blasint n = *N;
FLOAT alpha = *ALPHA;
blasint lda = *LDA;
blasint incx = *INCX;
blasint info;
int uplo;
FLOAT *buffer;
#ifdef SMPTEST
int nthreads;
#endif
PRINT_DEBUG_NAME;
TOUPPER(uplo_arg);
uplo = -1;
if (uplo_arg == 'U') uplo = 0;
if (uplo_arg == 'L') uplo = 1;
info = 0;
if (lda < MAX(1, n)) info = 7;
if (incx == 0) info = 5;
if (n < 0) info = 2;
if (uplo < 0) info = 1;
if (info != 0) {
BLASFUNC(xerbla)(ERROR_NAME, &info, sizeof(ERROR_NAME));
return;
}
#else
void CNAME(enum CBLAS_ORDER order, enum CBLAS_UPLO Uplo, blasint n, FLOAT alpha, FLOAT *x, blasint incx, FLOAT *a, blasint lda) {
FLOAT *buffer;
int trans, uplo;
blasint info;
#ifdef SMPTEST
int nthreads;
#endif
PRINT_DEBUG_CNAME;
trans = -1;
uplo = -1;
info = 0;
if (order == CblasColMajor) {
if (Uplo == CblasUpper) uplo = 0;
if (Uplo == CblasLower) uplo = 1;
info = -1;
if (lda < MAX(1, n)) info = 7;
if (incx == 0) info = 5;
if (n < 0) info = 2;
if (uplo < 0) info = 1;
}
if (order == CblasRowMajor) {
if (Uplo == CblasUpper) uplo = 3;
if (Uplo == CblasLower) uplo = 2;
info = -1;
if (lda < MAX(1, n)) info = 7;
if (incx == 0) info = 5;
if (n < 0) info = 2;
if (uplo < 0) info = 1;
}
if (info >= 0) {
BLASFUNC(xerbla)(ERROR_NAME, &info, sizeof(ERROR_NAME));
return;
}
#endif
if (n == 0) return;
if (alpha == ZERO) return;
IDEBUG_START;
FUNCTION_PROFILE_START();
if (incx < 0 ) x -= (n - 1) * incx * 2;
buffer = (FLOAT *)blas_memory_alloc(1);
#ifdef SMPTEST
nthreads = num_cpu_avail(2);
if (nthreads == 1) {
#endif
(her[uplo])(n, alpha, x, incx, a, lda, buffer);
#ifdef SMPTEST
} else {
(her_thread[uplo])(n, alpha, x, incx, a, lda, buffer, nthreads);
}
#endif
blas_memory_free(buffer);
FUNCTION_PROFILE_END(4, n * n / 2 + n, n * n);
IDEBUG_END;
return;
}

207
interface/zher2.c Normal file
View File

@ -0,0 +1,207 @@
/*********************************************************************/
/* Copyright 2009, 2010 The University of Texas at Austin. */
/* All rights reserved. */
/* */
/* Redistribution and use in source and binary forms, with or */
/* without modification, are permitted provided that the following */
/* conditions are met: */
/* */
/* 1. Redistributions of source code must retain the above */
/* copyright notice, this list of conditions and the following */
/* disclaimer. */
/* */
/* 2. Redistributions in binary form must reproduce the above */
/* copyright notice, this list of conditions and the following */
/* disclaimer in the documentation and/or other materials */
/* provided with the distribution. */
/* */
/* THIS SOFTWARE IS PROVIDED BY THE UNIVERSITY OF TEXAS AT */
/* AUSTIN ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, */
/* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF */
/* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE */
/* DISCLAIMED. IN NO EVENT SHALL THE UNIVERSITY OF TEXAS AT */
/* AUSTIN OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, */
/* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES */
/* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE */
/* GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR */
/* BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF */
/* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT */
/* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT */
/* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE */
/* POSSIBILITY OF SUCH DAMAGE. */
/* */
/* The views and conclusions contained in the software and */
/* documentation are those of the authors and should not be */
/* interpreted as representing official policies, either expressed */
/* or implied, of The University of Texas at Austin. */
/*********************************************************************/
#include <stdio.h>
#include <ctype.h>
#include "common.h"
#ifdef FUNCTION_PROFILE
#include "functable.h"
#endif
#ifdef XDOUBLE
#define ERROR_NAME "XHER2 "
#elif defined(DOUBLE)
#define ERROR_NAME "ZHER2 "
#else
#define ERROR_NAME "CHER2 "
#endif
static int (*her2[])(BLASLONG, FLOAT, FLOAT, FLOAT *, BLASLONG, FLOAT *, BLASLONG, FLOAT *, BLASLONG, FLOAT *) = {
#ifdef XDOUBLE
xher2_U, xher2_L, xher2_V, xher2_M,
#elif defined(DOUBLE)
zher2_U, zher2_L, zher2_V, zher2_M,
#else
cher2_U, cher2_L, cher2_V, cher2_M,
#endif
};
#ifdef SMPTEST
static int (*her2_thread[])(BLASLONG, FLOAT *, FLOAT *, BLASLONG, FLOAT *, BLASLONG, FLOAT *, BLASLONG, FLOAT *, int) = {
#ifdef XDOUBLE
xher2_thread_U, xher2_thread_L, xher2_thread_V, xher2_thread_M,
#elif defined(DOUBLE)
zher2_thread_U, zher2_thread_L, zher2_thread_V, zher2_thread_M,
#else
cher2_thread_U, cher2_thread_L, cher2_thread_V, cher2_thread_M,
#endif
};
#endif
#ifndef CBLAS
void NAME(char *UPLO, blasint *N, FLOAT *ALPHA,
FLOAT *x, blasint *INCX, FLOAT *y, blasint *INCY, FLOAT *a, blasint *LDA){
char uplo_arg = *UPLO;
blasint n = *N;
FLOAT alpha_r = ALPHA[0];
FLOAT alpha_i = ALPHA[1];
blasint lda = *LDA;
blasint incx = *INCX;
blasint incy = *INCY;
blasint info;
int uplo;
FLOAT *buffer;
#ifdef SMPTEST
int nthreads;
#endif
PRINT_DEBUG_NAME;
TOUPPER(uplo_arg);
uplo = -1;
if (uplo_arg == 'U') uplo = 0;
if (uplo_arg == 'L') uplo = 1;
info = 0;
if (lda < MAX(1, n)) info = 9;
if (incy == 0) info = 7;
if (incx == 0) info = 5;
if (n < 0) info = 2;
if (uplo < 0) info = 1;
if (info != 0) {
BLASFUNC(xerbla)(ERROR_NAME, &info, sizeof(ERROR_NAME));
return;
}
#else
void CNAME(enum CBLAS_ORDER order, enum CBLAS_UPLO Uplo, blasint n, FLOAT *ALPHA, FLOAT *x, blasint incx, FLOAT *y, blasint incy, FLOAT *a, blasint lda) {
FLOAT alpha_r = ALPHA[0];
FLOAT alpha_i = ALPHA[1];
FLOAT *buffer;
int trans, uplo;
blasint info;
#ifdef SMPTEST
int nthreads;
#endif
PRINT_DEBUG_CNAME;
trans = -1;
uplo = -1;
info = 0;
if (order == CblasColMajor) {
if (Uplo == CblasUpper) uplo = 0;
if (Uplo == CblasLower) uplo = 1;
info = -1;
if (lda < MAX(1, n)) info = 9;
if (incy == 0) info = 7;
if (incx == 0) info = 5;
if (n < 0) info = 2;
if (uplo < 0) info = 1;
}
if (order == CblasRowMajor) {
if (Uplo == CblasUpper) uplo = 3;
if (Uplo == CblasLower) uplo = 2;
info = -1;
if (lda < MAX(1, n)) info = 9;
if (incx == 0) info = 7;
if (incy == 0) info = 5;
if (n < 0) info = 2;
if (uplo < 0) info = 1;
}
if (info >= 0) {
BLASFUNC(xerbla)(ERROR_NAME, &info, sizeof(ERROR_NAME));
return;
}
#endif
if (n == 0) return;
if ((alpha_r == ZERO) && (alpha_i == ZERO)) return;
IDEBUG_START;
FUNCTION_PROFILE_START();
if (incx < 0 ) x -= (n - 1) * incx * 2;
if (incy < 0 ) y -= (n - 1) * incy * 2;
buffer = (FLOAT *)blas_memory_alloc(1);
#ifdef SMPTEST
nthreads = num_cpu_avail(2);
if (nthreads == 1) {
#endif
(her2[uplo])(n, alpha_r, alpha_i, x, incx, y, incy, a, lda, buffer);
#ifdef SMPTEST
} else {
(her2_thread[uplo])(n, ALPHA, x, incx, y, incy, a, lda, buffer, nthreads);
}
#endif
blas_memory_free(buffer);
FUNCTION_PROFILE_END(4, n * n / 2 + 2 * n, 2 * n * n);
IDEBUG_END;
return;
}

213
interface/zhpmv.c Normal file
View File

@ -0,0 +1,213 @@
/*********************************************************************/
/* Copyright 2009, 2010 The University of Texas at Austin. */
/* All rights reserved. */
/* */
/* Redistribution and use in source and binary forms, with or */
/* without modification, are permitted provided that the following */
/* conditions are met: */
/* */
/* 1. Redistributions of source code must retain the above */
/* copyright notice, this list of conditions and the following */
/* disclaimer. */
/* */
/* 2. Redistributions in binary form must reproduce the above */
/* copyright notice, this list of conditions and the following */
/* disclaimer in the documentation and/or other materials */
/* provided with the distribution. */
/* */
/* THIS SOFTWARE IS PROVIDED BY THE UNIVERSITY OF TEXAS AT */
/* AUSTIN ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, */
/* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF */
/* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE */
/* DISCLAIMED. IN NO EVENT SHALL THE UNIVERSITY OF TEXAS AT */
/* AUSTIN OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, */
/* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES */
/* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE */
/* GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR */
/* BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF */
/* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT */
/* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT */
/* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE */
/* POSSIBILITY OF SUCH DAMAGE. */
/* */
/* The views and conclusions contained in the software and */
/* documentation are those of the authors and should not be */
/* interpreted as representing official policies, either expressed */
/* or implied, of The University of Texas at Austin. */
/*********************************************************************/
#include <stdio.h>
#include <ctype.h>
#include "common.h"
#ifdef FUNCTION_PROFILE
#include "functable.h"
#endif
#ifdef XDOUBLE
#define ERROR_NAME "XHPMV "
#elif defined(DOUBLE)
#define ERROR_NAME "ZHPMV "
#else
#define ERROR_NAME "CHPMV "
#endif
static int (*hpmv[])(BLASLONG, FLOAT, FLOAT, FLOAT *, FLOAT *, BLASLONG, FLOAT *, BLASLONG, void *) = {
#ifdef XDOUBLE
xhpmv_U, xhpmv_L, xhpmv_V, xhpmv_M,
#elif defined(DOUBLE)
zhpmv_U, zhpmv_L, zhpmv_V, zhpmv_M,
#else
chpmv_U, chpmv_L, chpmv_V, chpmv_M,
#endif
};
#ifdef SMPTEST
static int (*hpmv_thread[])(BLASLONG, FLOAT *, FLOAT *, FLOAT *, BLASLONG, FLOAT *, BLASLONG, FLOAT *, int) = {
#ifdef XDOUBLE
xhpmv_thread_U, xhpmv_thread_L, xhpmv_thread_V, xhpmv_thread_M,
#elif defined(DOUBLE)
zhpmv_thread_U, zhpmv_thread_L, zhpmv_thread_V, zhpmv_thread_M,
#else
chpmv_thread_U, chpmv_thread_L, chpmv_thread_V, chpmv_thread_M,
#endif
};
#endif
#ifndef CBLAS
void NAME(char *UPLO, blasint *N, FLOAT *ALPHA, FLOAT *a,
FLOAT *x, blasint *INCX, FLOAT *BETA, FLOAT *y, blasint *INCY){
char uplo_arg = *UPLO;
blasint n = *N;
FLOAT alpha_r = ALPHA[0];
FLOAT alpha_i = ALPHA[1];
blasint incx = *INCX;
FLOAT beta_r = BETA[0];
FLOAT beta_i = BETA[1];
blasint incy = *INCY;
blasint info;
int uplo;
FLOAT *buffer;
#ifdef SMPTEST
int nthreads;
#endif
PRINT_DEBUG_NAME;
TOUPPER(uplo_arg);
uplo = -1;
if (uplo_arg == 'U') uplo = 0;
if (uplo_arg == 'L') uplo = 1;
info = 0;
if (incy == 0) info = 9;
if (incx == 0) info = 6;
if (n < 0) info = 2;
if (uplo < 0) info = 1;
if (info != 0) {
BLASFUNC(xerbla)(ERROR_NAME, &info, sizeof(ERROR_NAME));
return;
}
#else
void CNAME(enum CBLAS_ORDER order,
enum CBLAS_UPLO Uplo,
blasint n,
FLOAT *ALPHA,
FLOAT *a,
FLOAT *x, blasint incx,
FLOAT *BETA,
FLOAT *y, blasint incy){
FLOAT alpha_r = ALPHA[0];
FLOAT alpha_i = ALPHA[1];
FLOAT beta_r = BETA[0];
FLOAT beta_i = BETA[1];
FLOAT *buffer;
int uplo;
blasint info;
#ifdef SMPTEST
int nthreads;
#endif
PRINT_DEBUG_CNAME;
uplo = -1;
info = 0;
if (order == CblasColMajor) {
if (Uplo == CblasUpper) uplo = 0;
if (Uplo == CblasLower) uplo = 1;
info = -1;
if (incy == 0) info = 9;
if (incx == 0) info = 6;
if (n < 0) info = 2;
if (uplo < 0) info = 1;
}
if (order == CblasRowMajor) {
if (Uplo == CblasUpper) uplo = 3;
if (Uplo == CblasLower) uplo = 2;
info = -1;
if (incy == 0) info = 9;
if (incx == 0) info = 6;
if (n < 0) info = 2;
if (uplo < 0) info = 1;
}
if (info >= 0) {
BLASFUNC(xerbla)(ERROR_NAME, &info, sizeof(ERROR_NAME));
return;
}
#endif
if (n == 0) return;
if ((beta_r != ONE) || (beta_i != ZERO)) SCAL_K(n, 0, 0, beta_r, beta_i, y, abs(incy), NULL, 0, NULL, 0);
if ((alpha_r == ZERO) && (alpha_i == ZERO)) return;
IDEBUG_START;
FUNCTION_PROFILE_START();
if (incx < 0 ) x -= (n - 1) * incx * 2;
if (incy < 0 ) y -= (n - 1) * incy * 2;
buffer = (FLOAT *)blas_memory_alloc(1);
#ifdef SMPTEST
nthreads = num_cpu_avail(2);
if (nthreads == 1) {
#endif
(hpmv[uplo])(n, alpha_r, alpha_i, a, x, incx, y, incy, buffer);
#ifdef SMPTEST
} else {
(hpmv_thread[uplo])(n, ALPHA, a, x, incx, y, incy, buffer, nthreads);
}
#endif
blas_memory_free(buffer);
FUNCTION_PROFILE_END(4, n * n / 2 + n, n * n);
IDEBUG_END;
return;
}

198
interface/zhpr.c Normal file
View File

@ -0,0 +1,198 @@
/*********************************************************************/
/* Copyright 2009, 2010 The University of Texas at Austin. */
/* All rights reserved. */
/* */
/* Redistribution and use in source and binary forms, with or */
/* without modification, are permitted provided that the following */
/* conditions are met: */
/* */
/* 1. Redistributions of source code must retain the above */
/* copyright notice, this list of conditions and the following */
/* disclaimer. */
/* */
/* 2. Redistributions in binary form must reproduce the above */
/* copyright notice, this list of conditions and the following */
/* disclaimer in the documentation and/or other materials */
/* provided with the distribution. */
/* */
/* THIS SOFTWARE IS PROVIDED BY THE UNIVERSITY OF TEXAS AT */
/* AUSTIN ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, */
/* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF */
/* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE */
/* DISCLAIMED. IN NO EVENT SHALL THE UNIVERSITY OF TEXAS AT */
/* AUSTIN OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, */
/* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES */
/* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE */
/* GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR */
/* BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF */
/* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT */
/* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT */
/* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE */
/* POSSIBILITY OF SUCH DAMAGE. */
/* */
/* The views and conclusions contained in the software and */
/* documentation are those of the authors and should not be */
/* interpreted as representing official policies, either expressed */
/* or implied, of The University of Texas at Austin. */
/*********************************************************************/
#include <stdio.h>
#include <ctype.h>
#include "common.h"
#ifdef FUNCTION_PROFILE
#include "functable.h"
#endif
#ifdef XDOUBLE
#define ERROR_NAME "XHPR "
#elif defined(DOUBLE)
#define ERROR_NAME "ZHPR "
#else
#define ERROR_NAME "CHPR "
#endif
static int (*hpr[])(BLASLONG, FLOAT, FLOAT *, BLASLONG, FLOAT *, FLOAT *) = {
#ifdef XDOUBLE
xhpr_U, xhpr_L, xhpr_V, xhpr_M,
#elif defined(DOUBLE)
zhpr_U, zhpr_L, zhpr_V, zhpr_M,
#else
chpr_U, chpr_L, chpr_V, chpr_M,
#endif
};
#ifdef SMPTEST
static int (*hpr_thread[])(BLASLONG, FLOAT, FLOAT *, BLASLONG, FLOAT *, FLOAT *, int) = {
#ifdef XDOUBLE
xhpr_thread_U, xhpr_thread_L, xhpr_thread_V, xhpr_thread_M,
#elif defined(DOUBLE)
zhpr_thread_U, zhpr_thread_L, zhpr_thread_V, zhpr_thread_M,
#else
chpr_thread_U, chpr_thread_L, chpr_thread_V, chpr_thread_M,
#endif
};
#endif
#ifndef CBLAS
void NAME(char *UPLO, blasint *N, FLOAT *ALPHA,
FLOAT *x, blasint *INCX, FLOAT *a){
char uplo_arg = *UPLO;
blasint n = *N;
FLOAT alpha = *ALPHA;
blasint incx = *INCX;
blasint info;
int uplo;
FLOAT *buffer;
#ifdef SMPTEST
int nthreads;
#endif
PRINT_DEBUG_NAME;
TOUPPER(uplo_arg);
uplo = -1;
if (uplo_arg == 'U') uplo = 0;
if (uplo_arg == 'L') uplo = 1;
info = 0;
if (incx == 0) info = 5;
if (n < 0) info = 2;
if (uplo < 0) info = 1;
if (info != 0) {
BLASFUNC(xerbla)(ERROR_NAME, &info, sizeof(ERROR_NAME));
return;
}
#else
void CNAME(enum CBLAS_ORDER order,
enum CBLAS_UPLO Uplo,
blasint n,
FLOAT alpha,
FLOAT *x, blasint incx,
FLOAT *a) {
FLOAT *buffer;
int uplo;
blasint info;
#ifdef SMPTEST
int nthreads;
#endif
PRINT_DEBUG_CNAME;
uplo = -1;
info = 0;
if (order == CblasColMajor) {
if (Uplo == CblasUpper) uplo = 0;
if (Uplo == CblasLower) uplo = 1;
info = -1;
if (incx == 0) info = 5;
if (n < 0) info = 2;
if (uplo < 0) info = 1;
}
if (order == CblasRowMajor) {
if (Uplo == CblasUpper) uplo = 3;
if (Uplo == CblasLower) uplo = 2;
info = -1;
if (incx == 0) info = 5;
if (n < 0) info = 2;
if (uplo < 0) info = 1;
}
if (info >= 0) {
BLASFUNC(xerbla)(ERROR_NAME, &info, sizeof(ERROR_NAME));
return;
}
#endif
if (n == 0) return;
if (alpha == ZERO) return;
IDEBUG_START;
FUNCTION_PROFILE_START();
if (incx < 0 ) x -= (n - 1) * incx * 2;
buffer = (FLOAT *)blas_memory_alloc(1);
#ifdef SMPTEST
nthreads = num_cpu_avail(2);
if (nthreads == 1) {
#endif
(hpr[uplo])(n, alpha, x, incx, a, buffer);
#ifdef SMPTEST
} else {
(hpr_thread[uplo])(n, alpha, x, incx, a, buffer, nthreads);
}
#endif
blas_memory_free(buffer);
FUNCTION_PROFILE_END(4, n * n / 2 + n, n * n);
IDEBUG_END;
return;
}

207
interface/zhpr2.c Normal file
View File

@ -0,0 +1,207 @@
/*********************************************************************/
/* Copyright 2009, 2010 The University of Texas at Austin. */
/* All rights reserved. */
/* */
/* Redistribution and use in source and binary forms, with or */
/* without modification, are permitted provided that the following */
/* conditions are met: */
/* */
/* 1. Redistributions of source code must retain the above */
/* copyright notice, this list of conditions and the following */
/* disclaimer. */
/* */
/* 2. Redistributions in binary form must reproduce the above */
/* copyright notice, this list of conditions and the following */
/* disclaimer in the documentation and/or other materials */
/* provided with the distribution. */
/* */
/* THIS SOFTWARE IS PROVIDED BY THE UNIVERSITY OF TEXAS AT */
/* AUSTIN ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, */
/* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF */
/* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE */
/* DISCLAIMED. IN NO EVENT SHALL THE UNIVERSITY OF TEXAS AT */
/* AUSTIN OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, */
/* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES */
/* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE */
/* GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR */
/* BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF */
/* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT */
/* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT */
/* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE */
/* POSSIBILITY OF SUCH DAMAGE. */
/* */
/* The views and conclusions contained in the software and */
/* documentation are those of the authors and should not be */
/* interpreted as representing official policies, either expressed */
/* or implied, of The University of Texas at Austin. */
/*********************************************************************/
#include <stdio.h>
#include <ctype.h>
#include "common.h"
#ifdef FUNCTION_PROFILE
#include "functable.h"
#endif
#ifdef XDOUBLE
#define ERROR_NAME "XHPR2 "
#elif defined(DOUBLE)
#define ERROR_NAME "ZHPR2 "
#else
#define ERROR_NAME "CHPR2 "
#endif
static int (*hpr2[])(BLASLONG, FLOAT, FLOAT, FLOAT *, BLASLONG, FLOAT *, BLASLONG, FLOAT *, FLOAT *) = {
#ifdef XDOUBLE
xhpr2_U, xhpr2_L, xhpr2_V, xhpr2_M,
#elif defined(DOUBLE)
zhpr2_U, zhpr2_L, zhpr2_V, zhpr2_M,
#else
chpr2_U, chpr2_L, chpr2_V, chpr2_M,
#endif
};
#ifdef SMPTEST
static int (*hpr2_thread[])(BLASLONG, FLOAT *, FLOAT *, BLASLONG, FLOAT *, BLASLONG, FLOAT *, FLOAT *, int) = {
#ifdef XDOUBLE
xhpr2_thread_U, xhpr2_thread_L, xhpr2_thread_V, xhpr2_thread_M,
#elif defined(DOUBLE)
zhpr2_thread_U, zhpr2_thread_L, zhpr2_thread_V, zhpr2_thread_M,
#else
chpr2_thread_U, chpr2_thread_L, chpr2_thread_V, chpr2_thread_M,
#endif
};
#endif
#ifndef CBLAS
void NAME(char *UPLO, blasint *N, FLOAT *ALPHA,
FLOAT *x, blasint *INCX, FLOAT *y, blasint *INCY, FLOAT *a){
char uplo_arg = *UPLO;
blasint n = *N;
FLOAT alpha_r = ALPHA[0];
FLOAT alpha_i = ALPHA[1];
blasint incx = *INCX;
blasint incy = *INCY;
blasint info;
int uplo;
FLOAT *buffer;
#ifdef SMPTEST
int nthreads;
#endif
PRINT_DEBUG_NAME;
TOUPPER(uplo_arg);
uplo = -1;
if (uplo_arg == 'U') uplo = 0;
if (uplo_arg == 'L') uplo = 1;
info = 0;
if (incy == 0) info = 7;
if (incx == 0) info = 5;
if (n < 0) info = 2;
if (uplo < 0) info = 1;
if (info != 0) {
BLASFUNC(xerbla)(ERROR_NAME, &info, sizeof(ERROR_NAME));
return;
}
#else
void CNAME(enum CBLAS_ORDER order,
enum CBLAS_UPLO Uplo,
blasint n,
FLOAT *ALPHA,
FLOAT *x, blasint incx,
FLOAT *y, blasint incy,
FLOAT *a) {
FLOAT alpha_r = ALPHA[0];
FLOAT alpha_i = ALPHA[1];
FLOAT *buffer;
int uplo;
blasint info;
#ifdef SMPTEST
int nthreads;
#endif
PRINT_DEBUG_CNAME;
uplo = -1;
info = 0;
if (order == CblasColMajor) {
if (Uplo == CblasUpper) uplo = 0;
if (Uplo == CblasLower) uplo = 1;
info = -1;
if (incy == 0) info = 7;
if (incx == 0) info = 5;
if (n < 0) info = 2;
if (uplo < 0) info = 1;
}
if (order == CblasRowMajor) {
if (Uplo == CblasUpper) uplo = 3;
if (Uplo == CblasLower) uplo = 2;
info = -1;
if (incx == 0) info = 7;
if (incy == 0) info = 5;
if (n < 0) info = 2;
if (uplo < 0) info = 1;
}
if (info >= 0) {
BLASFUNC(xerbla)(ERROR_NAME, &info, sizeof(ERROR_NAME));
return;
}
#endif
if (n == 0) return;
if ((alpha_r == ZERO) && (alpha_i == ZERO)) return;
IDEBUG_START;
FUNCTION_PROFILE_START();
if (incx < 0 ) x -= (n - 1) * incx * 2;
if (incy < 0 ) y -= (n - 1) * incy * 2;
buffer = (FLOAT *)blas_memory_alloc(1);
#ifdef SMPTEST
nthreads = num_cpu_avail(2);
if (nthreads == 1) {
#endif
(hpr2[uplo])(n, alpha_r, alpha_i, x, incx, y, incy, a, buffer);
#ifdef SMPTEST
} else {
(hpr2_thread[uplo])(n, ALPHA, x, incx, y, incy, a, buffer, nthreads);
}
#endif
blas_memory_free(buffer);
FUNCTION_PROFILE_END(4, n * n / 2 + 2 * n, 2 * n * n);
IDEBUG_END;
return;
}

72
interface/zrot.c Normal file
View File

@ -0,0 +1,72 @@
/*********************************************************************/
/* Copyright 2009, 2010 The University of Texas at Austin. */
/* All rights reserved. */
/* */
/* Redistribution and use in source and binary forms, with or */
/* without modification, are permitted provided that the following */
/* conditions are met: */
/* */
/* 1. Redistributions of source code must retain the above */
/* copyright notice, this list of conditions and the following */
/* disclaimer. */
/* */
/* 2. Redistributions in binary form must reproduce the above */
/* copyright notice, this list of conditions and the following */
/* disclaimer in the documentation and/or other materials */
/* provided with the distribution. */
/* */
/* THIS SOFTWARE IS PROVIDED BY THE UNIVERSITY OF TEXAS AT */
/* AUSTIN ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, */
/* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF */
/* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE */
/* DISCLAIMED. IN NO EVENT SHALL THE UNIVERSITY OF TEXAS AT */
/* AUSTIN OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, */
/* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES */
/* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE */
/* GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR */
/* BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF */
/* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT */
/* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT */
/* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE */
/* POSSIBILITY OF SUCH DAMAGE. */
/* */
/* The views and conclusions contained in the software and */
/* documentation are those of the authors and should not be */
/* interpreted as representing official policies, either expressed */
/* or implied, of The University of Texas at Austin. */
/*********************************************************************/
#include <stdio.h>
#include "common.h"
#ifdef FUNCTION_PROFILE
#include "functable.h"
#endif
void NAME(blasint *N, FLOAT *x, blasint *INCX, FLOAT *y, blasint *INCY, FLOAT *C, FLOAT *S){
BLASLONG n = *N;
BLASLONG incx = *INCX;
BLASLONG incy = *INCY;
FLOAT c = *C;
FLOAT s = *S;
PRINT_DEBUG_NAME;
if (n <= 0) return;
IDEBUG_START;
FUNCTION_PROFILE_START();
if (incx < 0) x -= (n - 1) * 2 * incx;
if (incy < 0) y -= (n - 1) * 2 * incy;
ROT_K(n, x, incx, y, incy, c, s);
FUNCTION_PROFILE_END(4, n, n);
IDEBUG_END;
return;
}

115
interface/zrotg.c Normal file
View File

@ -0,0 +1,115 @@
#include <math.h>
#include "common.h"
#ifdef FUNCTION_PROFILE
#include "functable.h"
#endif
void NAME(FLOAT *DA, FLOAT *DB, FLOAT *C, FLOAT *S){
PRINT_DEBUG_NAME;
IDEBUG_START;
FUNCTION_PROFILE_START();
#if defined(__i386__) || defined(__x86_64__) || defined(__ia64__)
long double da_r = *(DA + 0);
long double da_i = *(DA + 1);
long double db_r = *(DB + 0);
long double db_i = *(DB + 1);
long double r;
long double ada = fabs(da_r) + fabs(da_i);
if (ada == ZERO) {
*C = ZERO;
*(S + 0) = ONE;
*(S + 1) = ZERO;
*(DA + 0) = db_r;
*(DA + 1) = db_i;
} else {
long double alpha_r, alpha_i;
ada = sqrt(da_r * da_r + da_i * da_i);
r = sqrt(da_r * da_r + da_i * da_i + db_r * db_r + db_i * db_i);
alpha_r = da_r / ada;
alpha_i = da_i / ada;
*(C + 0) = ada / r;
*(S + 0) = (alpha_r * db_r + alpha_i *db_i) / r;
*(S + 1) = (alpha_i * db_r - alpha_r *db_i) / r;
*(DA + 0) = alpha_r * r;
*(DA + 1) = alpha_i * r;
}
#else
FLOAT da_r = *(DA + 0);
FLOAT da_i = *(DA + 1);
FLOAT db_r = *(DB + 0);
FLOAT db_i = *(DB + 1);
FLOAT r;
FLOAT ada = fabs(da_r) + fabs(da_i);
FLOAT adb;
if (ada == ZERO) {
*C = ZERO;
*(S + 0) = ONE;
*(S + 1) = ZERO;
*(DA + 0) = db_r;
*(DA + 1) = db_i;
} else {
FLOAT scale;
FLOAT aa_r, aa_i, bb_r, bb_i;
FLOAT alpha_r, alpha_i;
aa_r = fabs(da_r);
aa_i = fabs(da_i);
if (aa_i > aa_r) {
aa_r = fabs(da_i);
aa_i = fabs(da_r);
}
scale = (aa_i / aa_r);
ada = aa_r * sqrt(ONE + scale * scale);
bb_r = fabs(db_r);
bb_i = fabs(db_i);
if (bb_i > bb_r) {
bb_r = fabs(bb_i);
bb_i = fabs(bb_r);
}
scale = (bb_i / bb_r);
adb = bb_r * sqrt(ONE + scale * scale);
scale = ada + adb;
aa_r = da_r / scale;
aa_i = da_i / scale;
bb_r = db_r / scale;
bb_i = db_i / scale;
r = scale * sqrt(aa_r * aa_r + aa_i * aa_i + bb_r * bb_r + bb_i * bb_i);
alpha_r = da_r / ada;
alpha_i = da_i / ada;
*(C + 0) = ada / r;
*(S + 0) = (alpha_r * db_r + alpha_i *db_i) / r;
*(S + 1) = (alpha_i * db_r - alpha_r *db_i) / r;
*(DA + 0) = alpha_r * r;
*(DA + 1) = alpha_i * r;
}
#endif
FUNCTION_PROFILE_END(4, 4, 4);
IDEBUG_END;
return;
}

157
interface/zsbmv.c Normal file
View File

@ -0,0 +1,157 @@
/*********************************************************************/
/* Copyright 2009, 2010 The University of Texas at Austin. */
/* All rights reserved. */
/* */
/* Redistribution and use in source and binary forms, with or */
/* without modification, are permitted provided that the following */
/* conditions are met: */
/* */
/* 1. Redistributions of source code must retain the above */
/* copyright notice, this list of conditions and the following */
/* disclaimer. */
/* */
/* 2. Redistributions in binary form must reproduce the above */
/* copyright notice, this list of conditions and the following */
/* disclaimer in the documentation and/or other materials */
/* provided with the distribution. */
/* */
/* THIS SOFTWARE IS PROVIDED BY THE UNIVERSITY OF TEXAS AT */
/* AUSTIN ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, */
/* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF */
/* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE */
/* DISCLAIMED. IN NO EVENT SHALL THE UNIVERSITY OF TEXAS AT */
/* AUSTIN OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, */
/* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES */
/* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE */
/* GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR */
/* BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF */
/* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT */
/* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT */
/* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE */
/* POSSIBILITY OF SUCH DAMAGE. */
/* */
/* The views and conclusions contained in the software and */
/* documentation are those of the authors and should not be */
/* interpreted as representing official policies, either expressed */
/* or implied, of The University of Texas at Austin. */
/*********************************************************************/
#include <stdio.h>
#include <ctype.h>
#include "common.h"
#ifdef FUNCTION_PROFILE
#include "functable.h"
#endif
#ifdef XDOUBLE
#define ERROR_NAME "XSBMV "
#elif defined(DOUBLE)
#define ERROR_NAME "ZSBMV "
#else
#define ERROR_NAME "CSBMV "
#endif
static int (*sbmv[])(BLASLONG, BLASLONG, FLOAT, FLOAT, FLOAT *, BLASLONG, FLOAT *, BLASLONG, FLOAT *, BLASLONG, void *) = {
#ifdef XDOUBLE
xsbmv_U, xsbmv_L,
#elif defined(DOUBLE)
zsbmv_U, zsbmv_L,
#else
csbmv_U, csbmv_L,
#endif
};
#ifdef SMPTEST
static int (*sbmv_thread[])(BLASLONG, BLASLONG, FLOAT *, FLOAT *, BLASLONG, FLOAT *, BLASLONG, FLOAT *, BLASLONG, FLOAT *, int) = {
#ifdef XDOUBLE
xsbmv_thread_U, xsbmv_thread_L,
#elif defined(DOUBLE)
zsbmv_thread_U, zsbmv_thread_L,
#else
csbmv_thread_U, csbmv_thread_L,
#endif
};
#endif
void NAME(char *UPLO, blasint *N, blasint *K, FLOAT *ALPHA, FLOAT *a, blasint *LDA,
FLOAT *b, blasint *INCX, FLOAT *BETA, FLOAT *c, blasint *INCY){
char uplo_arg = *UPLO;
blasint n = *N;
blasint k = *K;
FLOAT alpha_r = ALPHA[0];
FLOAT alpha_i = ALPHA[1];
blasint lda = *LDA;
blasint incx = *INCX;
FLOAT beta_r = BETA[0];
FLOAT beta_i = BETA[1];
blasint incy = *INCY;
blasint info;
int uplo;
FLOAT *buffer;
#ifdef SMPTEST
int nthreads;
#endif
PRINT_DEBUG_NAME;
TOUPPER(uplo_arg);
uplo = -1;
if (uplo_arg == 'U') uplo = 0;
if (uplo_arg == 'L') uplo = 1;
info = 0;
if (incy == 0) info = 11;
if (incx == 0) info = 8;
if (lda < k + 1) info = 6;
if (k < 0) info = 3;
if (n < 0) info = 2;
if (uplo < 0) info = 1;
if (info != 0) {
BLASFUNC(xerbla)(ERROR_NAME, &info, sizeof(ERROR_NAME));
return;
}
if (n == 0) return;
if ((beta_r != ONE) || (beta_i != ZERO)) SCAL_K(n, 0, 0, beta_r, beta_i, c, abs(incy), NULL, 0, NULL, 0);
if ((alpha_r == ZERO) && (alpha_i == ZERO)) return;
IDEBUG_START;
FUNCTION_PROFILE_START();
if (incx < 0 ) b -= (n - 1) * incx * COMPSIZE;
if (incy < 0 ) c -= (n - 1) * incy * COMPSIZE;
buffer = (FLOAT *)blas_memory_alloc(1);
#ifdef SMPTEST
nthreads = num_cpu_avail(2);
if (nthreads == 1) {
#endif
(sbmv[uplo])(n, k, alpha_r, alpha_i, a, lda, b, incx, c, incy, buffer);
#ifdef SMPTEST
} else {
(sbmv_thread[uplo])(n, k, ALPHA, a, lda, b, incx, c, incy, buffer, nthreads);
}
#endif
blas_memory_free(buffer);
FUNCTION_PROFILE_END(4, n * k / 2 + n, n * k);
IDEBUG_END;
return;
}

117
interface/zscal.c Normal file
View File

@ -0,0 +1,117 @@
/*********************************************************************/
/* Copyright 2009, 2010 The University of Texas at Austin. */
/* All rights reserved. */
/* */
/* Redistribution and use in source and binary forms, with or */
/* without modification, are permitted provided that the following */
/* conditions are met: */
/* */
/* 1. Redistributions of source code must retain the above */
/* copyright notice, this list of conditions and the following */
/* disclaimer. */
/* */
/* 2. Redistributions in binary form must reproduce the above */
/* copyright notice, this list of conditions and the following */
/* disclaimer in the documentation and/or other materials */
/* provided with the distribution. */
/* */
/* THIS SOFTWARE IS PROVIDED BY THE UNIVERSITY OF TEXAS AT */
/* AUSTIN ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, */
/* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF */
/* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE */
/* DISCLAIMED. IN NO EVENT SHALL THE UNIVERSITY OF TEXAS AT */
/* AUSTIN OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, */
/* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES */
/* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE */
/* GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR */
/* BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF */
/* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT */
/* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT */
/* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE */
/* POSSIBILITY OF SUCH DAMAGE. */
/* */
/* The views and conclusions contained in the software and */
/* documentation are those of the authors and should not be */
/* interpreted as representing official policies, either expressed */
/* or implied, of The University of Texas at Austin. */
/*********************************************************************/
#include <stdio.h>
#include "common.h"
#ifdef FUNCTION_PROFILE
#include "functable.h"
#endif
#ifndef CBLAS
void NAME(blasint *N, FLOAT *ALPHA, FLOAT *x, blasint *INCX){
blasint n = *N;
blasint incx = *INCX;
#ifndef SSCAL
FLOAT *alpha=ALPHA;
#else
FLOAT alpha[2] = {ALPHA[0], ZERO};
#endif
#else
#ifndef SSCAL
void CNAME(blasint n, FLOAT *ALPHA, FLOAT *x, blasint incx){
FLOAT *alpha=ALPHA;
#else
void CNAME(blasint n, FLOAT alpha_r, FLOAT *x, blasint incx){
FLOAT alpha[2] = {alpha_r, ZERO};
#endif
#endif
#ifdef SMPTEST
int mode;
int nthreads;
#endif
#ifndef CBLAS
PRINT_DEBUG_NAME;
#else
PRINT_DEBUG_CNAME;
#endif
if (incx <= 0 || n <= 0) return;
if ((alpha[0] == ONE) && (alpha[1] == ZERO)) return;
IDEBUG_START;
FUNCTION_PROFILE_START();
#ifdef SMPTEST
nthreads = num_cpu_avail(1);
if (nthreads == 1) {
#endif
SCAL_K(n, 0, 0, alpha[0], alpha[1], x, incx, NULL, 0, NULL, 0);
#ifdef SMPTEST
} else {
#ifdef DOUBLE
mode = BLAS_DOUBLE | BLAS_COMPLEX;
#else
mode = BLAS_SINGLE | BLAS_COMPLEX;
#endif
blas_level1_thread(mode, n, 0, 0, alpha, x, incx, NULL, 0, NULL, 0, (void *)SCAL_K, nthreads);
}
#endif
FUNCTION_PROFILE_END(4, n, n);
IDEBUG_END;
return;
}

154
interface/zspmv.c Normal file
View File

@ -0,0 +1,154 @@
/*********************************************************************/
/* Copyright 2009, 2010 The University of Texas at Austin. */
/* All rights reserved. */
/* */
/* Redistribution and use in source and binary forms, with or */
/* without modification, are permitted provided that the following */
/* conditions are met: */
/* */
/* 1. Redistributions of source code must retain the above */
/* copyright notice, this list of conditions and the following */
/* disclaimer. */
/* */
/* 2. Redistributions in binary form must reproduce the above */
/* copyright notice, this list of conditions and the following */
/* disclaimer in the documentation and/or other materials */
/* provided with the distribution. */
/* */
/* THIS SOFTWARE IS PROVIDED BY THE UNIVERSITY OF TEXAS AT */
/* AUSTIN ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, */
/* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF */
/* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE */
/* DISCLAIMED. IN NO EVENT SHALL THE UNIVERSITY OF TEXAS AT */
/* AUSTIN OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, */
/* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES */
/* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE */
/* GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR */
/* BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF */
/* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT */
/* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT */
/* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE */
/* POSSIBILITY OF SUCH DAMAGE. */
/* */
/* The views and conclusions contained in the software and */
/* documentation are those of the authors and should not be */
/* interpreted as representing official policies, either expressed */
/* or implied, of The University of Texas at Austin. */
/*********************************************************************/
#include <stdio.h>
#include <ctype.h>
#include "common.h"
#ifdef FUNCTION_PROFILE
#include "functable.h"
#endif
#ifdef XDOUBLE
#define ERROR_NAME "ZSPMV "
#elif defined(DOUBLE)
#define ERROR_NAME "ZSPMV "
#else
#define ERROR_NAME "CSPMV "
#endif
static int (*spmv[])(BLASLONG, FLOAT, FLOAT, FLOAT *, FLOAT *, BLASLONG, FLOAT *, BLASLONG, void *) = {
#ifdef XDOUBLE
xspmv_U, xspmv_L,
#elif defined(DOUBLE)
zspmv_U, zspmv_L,
#else
cspmv_U, cspmv_L,
#endif
};
#ifdef SMPTEST
static int (*spmv_thread[])(BLASLONG, FLOAT *, FLOAT *, FLOAT *, BLASLONG, FLOAT *, BLASLONG, FLOAT *, int) = {
#ifdef XDOUBLE
xspmv_thread_U, xspmv_thread_L,
#elif defined(DOUBLE)
zspmv_thread_U, zspmv_thread_L,
#else
cspmv_thread_U, cspmv_thread_L,
#endif
};
#endif
void NAME(char *UPLO, blasint *N, FLOAT *ALPHA, FLOAT *a,
FLOAT *b, blasint *INCX, FLOAT *BETA, FLOAT *c, blasint *INCY){
char uplo_arg = *UPLO;
blasint n = *N;
FLOAT alpha_r = ALPHA[0];
FLOAT alpha_i = ALPHA[1];
blasint incx = *INCX;
FLOAT beta_r = BETA[0];
FLOAT beta_i = BETA[1];
blasint incy = *INCY;
blasint info;
int uplo;
FLOAT *buffer;
#ifdef SMPTEST
int nthreads;
#endif
PRINT_DEBUG_NAME;
TOUPPER(uplo_arg);
uplo = -1;
if (uplo_arg == 'U') uplo = 0;
if (uplo_arg == 'L') uplo = 1;
info = 0;
if (incy == 0) info = 9;
if (incx == 0) info = 6;
if (n < 0) info = 2;
if (uplo < 0) info = 1;
if (info != 0) {
BLASFUNC(xerbla)(ERROR_NAME, &info, sizeof(ERROR_NAME));
return;
}
if (n == 0) return;
if ((beta_r != ONE) || (beta_i != ZERO)) SCAL_K(n, 0, 0, beta_r, beta_i, c, abs(incy), NULL, 0, NULL, 0);
if ((alpha_r == ZERO) && (alpha_i == ZERO)) return;
IDEBUG_START;
FUNCTION_PROFILE_START();
if (incx < 0 ) b -= (n - 1) * incx * COMPSIZE;
if (incy < 0 ) c -= (n - 1) * incy * COMPSIZE;
buffer = (FLOAT *)blas_memory_alloc(1);
#ifdef SMPTEST
nthreads = num_cpu_avail(2);
if (nthreads == 1) {
#endif
(spmv[uplo])(n, alpha_r, alpha_i, a, b, incx, c, incy, buffer);
#ifdef SMPTEST
} else {
(spmv_thread[uplo])(n, ALPHA, a, b, incx, c, incy, buffer, nthreads);
}
#endif
blas_memory_free(buffer);
FUNCTION_PROFILE_END(4, n * n / 2 + n, n * n);
IDEBUG_END;
return;
}

146
interface/zspr.c Normal file
View File

@ -0,0 +1,146 @@
/*********************************************************************/
/* Copyright 2009, 2010 The University of Texas at Austin. */
/* All rights reserved. */
/* */
/* Redistribution and use in source and binary forms, with or */
/* without modification, are permitted provided that the following */
/* conditions are met: */
/* */
/* 1. Redistributions of source code must retain the above */
/* copyright notice, this list of conditions and the following */
/* disclaimer. */
/* */
/* 2. Redistributions in binary form must reproduce the above */
/* copyright notice, this list of conditions and the following */
/* disclaimer in the documentation and/or other materials */
/* provided with the distribution. */
/* */
/* THIS SOFTWARE IS PROVIDED BY THE UNIVERSITY OF TEXAS AT */
/* AUSTIN ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, */
/* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF */
/* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE */
/* DISCLAIMED. IN NO EVENT SHALL THE UNIVERSITY OF TEXAS AT */
/* AUSTIN OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, */
/* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES */
/* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE */
/* GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR */
/* BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF */
/* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT */
/* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT */
/* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE */
/* POSSIBILITY OF SUCH DAMAGE. */
/* */
/* The views and conclusions contained in the software and */
/* documentation are those of the authors and should not be */
/* interpreted as representing official policies, either expressed */
/* or implied, of The University of Texas at Austin. */
/*********************************************************************/
#include <stdio.h>
#include <ctype.h>
#include "common.h"
#ifdef FUNCTION_PROFILE
#include "functable.h"
#endif
#ifdef XDOUBLE
#define ERROR_NAME "XSPR "
#elif defined(DOUBLE)
#define ERROR_NAME "ZSPR "
#else
#define ERROR_NAME "CSPR "
#endif
static int (*spr[])(BLASLONG, FLOAT, FLOAT, FLOAT *, BLASLONG, FLOAT *, FLOAT *) = {
#ifdef XDOUBLE
xspr_U, xspr_L,
#elif defined(DOUBLE)
zspr_U, zspr_L,
#else
cspr_U, cspr_L,
#endif
};
#ifdef SMPTEST
static int (*spr_thread[])(BLASLONG, FLOAT *, FLOAT *, BLASLONG, FLOAT *, FLOAT *, int) = {
#ifdef XDOUBLE
xspr_thread_U, xspr_thread_L,
#elif defined(DOUBLE)
zspr_thread_U, zspr_thread_L,
#else
cspr_thread_U, cspr_thread_L,
#endif
};
#endif
void NAME(char *UPLO, blasint *N, FLOAT *ALPHA,
FLOAT *x, blasint *INCX, FLOAT *a){
char uplo_arg = *UPLO;
blasint n = *N;
FLOAT alpha_r = ALPHA[0];
FLOAT alpha_i = ALPHA[1];
blasint incx = *INCX;
blasint info;
int uplo;
FLOAT *buffer;
#ifdef SMPTEST
int nthreads;
#endif
PRINT_DEBUG_NAME;
TOUPPER(uplo_arg);
uplo = -1;
if (uplo_arg == 'U') uplo = 0;
if (uplo_arg == 'L') uplo = 1;
info = 0;
if (incx == 0) info = 5;
if (n < 0) info = 2;
if (uplo < 0) info = 1;
if (info != 0) {
BLASFUNC(xerbla)(ERROR_NAME, &info, sizeof(ERROR_NAME));
return;
}
if (n == 0) return;
if ((alpha_r == ZERO) && (alpha_i == ZERO)) return;
IDEBUG_START;
FUNCTION_PROFILE_START();
if (incx < 0 ) x -= (n - 1) * incx;
buffer = (FLOAT *)blas_memory_alloc(1);
#ifdef SMPTEST
nthreads = num_cpu_avail(2);
if (nthreads == 1) {
#endif
(spr[uplo])(n, alpha_r, alpha_i, x, incx, a, buffer);
#ifdef SMPTEST
} else {
(spr_thread[uplo])(n, ALPHA, x, incx, a, buffer, nthreads);
}
#endif
blas_memory_free(buffer);
FUNCTION_PROFILE_END(4, n * n / 2 + n, n * n);
IDEBUG_END;
return;
}

149
interface/zspr2.c Normal file
View File

@ -0,0 +1,149 @@
/*********************************************************************/
/* Copyright 2009, 2010 The University of Texas at Austin. */
/* All rights reserved. */
/* */
/* Redistribution and use in source and binary forms, with or */
/* without modification, are permitted provided that the following */
/* conditions are met: */
/* */
/* 1. Redistributions of source code must retain the above */
/* copyright notice, this list of conditions and the following */
/* disclaimer. */
/* */
/* 2. Redistributions in binary form must reproduce the above */
/* copyright notice, this list of conditions and the following */
/* disclaimer in the documentation and/or other materials */
/* provided with the distribution. */
/* */
/* THIS SOFTWARE IS PROVIDED BY THE UNIVERSITY OF TEXAS AT */
/* AUSTIN ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, */
/* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF */
/* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE */
/* DISCLAIMED. IN NO EVENT SHALL THE UNIVERSITY OF TEXAS AT */
/* AUSTIN OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, */
/* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES */
/* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE */
/* GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR */
/* BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF */
/* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT */
/* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT */
/* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE */
/* POSSIBILITY OF SUCH DAMAGE. */
/* */
/* The views and conclusions contained in the software and */
/* documentation are those of the authors and should not be */
/* interpreted as representing official policies, either expressed */
/* or implied, of The University of Texas at Austin. */
/*********************************************************************/
#include <stdio.h>
#include <ctype.h>
#include "common.h"
#ifdef FUNCTION_PROFILE
#include "functable.h"
#endif
#ifdef XDOUBLE
#define ERROR_NAME "XSPR2 "
#elif defined(DOUBLE)
#define ERROR_NAME "ZSPR2 "
#else
#define ERROR_NAME "CSPR2 "
#endif
static int (*spr2[])(BLASLONG, FLOAT, FLOAT, FLOAT *, BLASLONG, FLOAT *, BLASLONG, FLOAT *, FLOAT *) = {
#ifdef XDOUBLE
xspr2_U, xspr2_L,
#elif defined(DOUBLE)
zspr2_U, zspr2_L,
#else
cspr2_U, cspr2_L,
#endif
};
#ifdef SMPTEST
static int (*spr2_thread[])(BLASLONG, FLOAT *, FLOAT *, BLASLONG, FLOAT *, BLASLONG, FLOAT *, FLOAT *, int) = {
#ifdef XDOUBLE
xspr2_thread_U, xspr2_thread_L,
#elif defined(DOUBLE)
zspr2_thread_U, zspr2_thread_L,
#else
cspr2_thread_U, cspr2_thread_L,
#endif
};
#endif
void NAME(char *UPLO, blasint *N, FLOAT *ALPHA,
FLOAT *x, blasint *INCX, FLOAT *y, blasint *INCY, FLOAT *a){
char uplo_arg = *UPLO;
blasint n = *N;
FLOAT alpha_r = ALPHA[0];
FLOAT alpha_i = ALPHA[1];
blasint incx = *INCX;
blasint incy = *INCY;
blasint info;
int uplo;
FLOAT *buffer;
#ifdef SMPTEST
int nthreads;
#endif
PRINT_DEBUG_NAME;
TOUPPER(uplo_arg);
uplo = -1;
if (uplo_arg == 'U') uplo = 0;
if (uplo_arg == 'L') uplo = 1;
info = 0;
if (incy == 0) info = 7;
if (incx == 0) info = 5;
if (n < 0) info = 2;
if (uplo < 0) info = 1;
if (info != 0) {
BLASFUNC(xerbla)(ERROR_NAME, &info, sizeof(ERROR_NAME));
return;
}
if (n == 0) return;
if ((alpha_r == ZERO) && (alpha_i == ZERO)) return;
IDEBUG_START;
FUNCTION_PROFILE_START();
if (incx < 0 ) x -= (n - 1) * incx;
if (incy < 0 ) y -= (n - 1) * incy;
buffer = (FLOAT *)blas_memory_alloc(1);
#ifdef SMPTEST
nthreads = num_cpu_avail(2);
if (nthreads == 1) {
#endif
(spr2[uplo])(n, alpha_r, alpha_i, x, incx, y, incy, a, buffer);
#ifdef SMPTEST
} else {
(spr2_thread[uplo])(n, ALPHA, x, incx, y, incy, a, buffer, nthreads);
}
#endif
blas_memory_free(buffer);
FUNCTION_PROFILE_END(4, n * n / 2 + 2 * n, 2 * n * n);
IDEBUG_END;
return;
}

116
interface/zswap.c Normal file
View File

@ -0,0 +1,116 @@
/*********************************************************************/
/* Copyright 2009, 2010 The University of Texas at Austin. */
/* All rights reserved. */
/* */
/* Redistribution and use in source and binary forms, with or */
/* without modification, are permitted provided that the following */
/* conditions are met: */
/* */
/* 1. Redistributions of source code must retain the above */
/* copyright notice, this list of conditions and the following */
/* disclaimer. */
/* */
/* 2. Redistributions in binary form must reproduce the above */
/* copyright notice, this list of conditions and the following */
/* disclaimer in the documentation and/or other materials */
/* provided with the distribution. */
/* */
/* THIS SOFTWARE IS PROVIDED BY THE UNIVERSITY OF TEXAS AT */
/* AUSTIN ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, */
/* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF */
/* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE */
/* DISCLAIMED. IN NO EVENT SHALL THE UNIVERSITY OF TEXAS AT */
/* AUSTIN OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, */
/* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES */
/* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE */
/* GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR */
/* BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF */
/* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT */
/* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT */
/* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE */
/* POSSIBILITY OF SUCH DAMAGE. */
/* */
/* The views and conclusions contained in the software and */
/* documentation are those of the authors and should not be */
/* interpreted as representing official policies, either expressed */
/* or implied, of The University of Texas at Austin. */
/*********************************************************************/
#include <stdio.h>
#include "common.h"
#ifdef FUNCTION_PROFILE
#include "functable.h"
#endif
#ifndef CBLAS
void NAME(blasint *N, FLOAT *x, blasint *INCX, FLOAT *y, blasint *INCY){
blasint n = *N;
blasint incx = *INCX;
blasint incy = *INCY;
#else
void CNAME(blasint n, FLOAT *x, blasint incx, FLOAT *y, blasint incy){
#endif
#ifdef SMPTEST
int mode;
FLOAT dummyalpha[2] = {ZERO, ZERO};
int nthreads;
#endif
#ifndef CBLAS
PRINT_DEBUG_NAME;
#else
PRINT_DEBUG_CNAME;
#endif
if (n <= 0) return;
IDEBUG_START;
FUNCTION_PROFILE_START();
if (incx < 0) x -= (n - 1) * incx * 2;
if (incy < 0) y -= (n - 1) * incy * 2;
#ifdef SMPTEST
nthreads = num_cpu_avail(1);
//disable multi-thread when incx==0 or incy==0
//In that case, the threads would be dependent.
if (incx == 0 || incy == 0)
nthreads = 1;
if (nthreads == 1) {
#endif
SWAP_K(n, 0, 0, ZERO, ZERO, x, incx, y, incy, NULL, 0);
#ifdef SMPTEST
} else {
#ifdef XDOUBLE
mode = BLAS_XDOUBLE | BLAS_COMPLEX;
#elif defined(DOUBLE)
mode = BLAS_DOUBLE | BLAS_COMPLEX;
#else
mode = BLAS_SINGLE | BLAS_COMPLEX;
#endif
blas_level1_thread(mode, n, 0, 0, dummyalpha,
x, incx, y, incy, NULL, 0, (void *)SWAP_K, nthreads);
}
#endif
FUNCTION_PROFILE_END(2, 2 * n, 0);
IDEBUG_END;
return;
}

143
interface/zsymv.c Normal file
View File

@ -0,0 +1,143 @@
/*********************************************************************/
/* Copyright 2009, 2010 The University of Texas at Austin. */
/* All rights reserved. */
/* */
/* Redistribution and use in source and binary forms, with or */
/* without modification, are permitted provided that the following */
/* conditions are met: */
/* */
/* 1. Redistributions of source code must retain the above */
/* copyright notice, this list of conditions and the following */
/* disclaimer. */
/* */
/* 2. Redistributions in binary form must reproduce the above */
/* copyright notice, this list of conditions and the following */
/* disclaimer in the documentation and/or other materials */
/* provided with the distribution. */
/* */
/* THIS SOFTWARE IS PROVIDED BY THE UNIVERSITY OF TEXAS AT */
/* AUSTIN ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, */
/* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF */
/* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE */
/* DISCLAIMED. IN NO EVENT SHALL THE UNIVERSITY OF TEXAS AT */
/* AUSTIN OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, */
/* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES */
/* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE */
/* GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR */
/* BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF */
/* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT */
/* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT */
/* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE */
/* POSSIBILITY OF SUCH DAMAGE. */
/* */
/* The views and conclusions contained in the software and */
/* documentation are those of the authors and should not be */
/* interpreted as representing official policies, either expressed */
/* or implied, of The University of Texas at Austin. */
/*********************************************************************/
#include <stdio.h>
#include <ctype.h>
#include "common.h"
#ifdef FUNCTION_PROFILE
#include "functable.h"
#endif
#ifdef XDOUBLE
#define ERROR_NAME "XSYMV "
#elif defined(DOUBLE)
#define ERROR_NAME "ZSYMV "
#else
#define ERROR_NAME "CSYMV "
#endif
void NAME(char *UPLO, blasint *N, FLOAT *ALPHA, FLOAT *a, blasint *LDA,
FLOAT *b, blasint *INCX, FLOAT *BETA, FLOAT *c, blasint *INCY){
char uplo_arg = *UPLO;
blasint n = *N;
FLOAT alpha_r = ALPHA[0];
FLOAT alpha_i = ALPHA[1];
blasint lda = *LDA;
blasint incx = *INCX;
FLOAT beta_r = BETA[0];
FLOAT beta_i = BETA[1];
blasint incy = *INCY;
int (*symv[])(BLASLONG, BLASLONG, FLOAT, FLOAT, FLOAT *, BLASLONG, FLOAT *, BLASLONG, FLOAT *, BLASLONG, FLOAT *) = {
SYMV_U, SYMV_L,
};
#ifdef SMPTEST
int (*symv_thread[])(BLASLONG, FLOAT *, FLOAT *, BLASLONG, FLOAT *, BLASLONG, FLOAT *, BLASLONG, FLOAT *, int) = {
SYMV_THREAD_U, SYMV_THREAD_L,
};
#endif
blasint info;
int uplo;
FLOAT *buffer;
#ifdef SMPTEST
int nthreads;
#endif
PRINT_DEBUG_NAME;
TOUPPER(uplo_arg);
uplo = -1;
if (uplo_arg == 'U') uplo = 0;
if (uplo_arg == 'L') uplo = 1;
info = 0;
if (incy == 0) info = 10;
if (incx == 0) info = 7;
if (lda < MAX(1, n)) info = 5;
if (n < 0) info = 2;
if (uplo < 0) info = 1;
if (info != 0) {
BLASFUNC(xerbla)(ERROR_NAME, &info, sizeof(ERROR_NAME));
return;
}
if (n == 0) return;
if ((beta_r != ONE) || (beta_i != ZERO)) SCAL_K(n, 0, 0, beta_r, beta_i, c, abs(incy), NULL, 0, NULL, 0);
if ((alpha_r == ZERO) && (alpha_i == ZERO)) return;
IDEBUG_START;
FUNCTION_PROFILE_START();
if (incx < 0 ) b -= (n - 1) * incx * COMPSIZE;
if (incy < 0 ) c -= (n - 1) * incy * COMPSIZE;
buffer = (FLOAT *)blas_memory_alloc(1);
#ifdef SMPTEST
nthreads = num_cpu_avail(2);
if (nthreads == 1) {
#endif
(symv[uplo])(n, n, alpha_r, alpha_i, a, lda, b, incx, c, incy, buffer);
#ifdef SMPTEST
} else {
(symv_thread[uplo])(n, ALPHA, a, lda, b, incx, c, incy, buffer, nthreads);
}
#endif
blas_memory_free(buffer);
FUNCTION_PROFILE_END(4, n * n / 2 + 2 * n, 2 * n * n);
IDEBUG_END;
return;
}

203
interface/zsyr.c Normal file
View File

@ -0,0 +1,203 @@
/*********************************************************************/
/* Copyright 2009, 2010 The University of Texas at Austin. */
/* All rights reserved. */
/* */
/* Redistribution and use in source and binary forms, with or */
/* without modification, are permitted provided that the following */
/* conditions are met: */
/* */
/* 1. Redistributions of source code must retain the above */
/* copyright notice, this list of conditions and the following */
/* disclaimer. */
/* */
/* 2. Redistributions in binary form must reproduce the above */
/* copyright notice, this list of conditions and the following */
/* disclaimer in the documentation and/or other materials */
/* provided with the distribution. */
/* */
/* THIS SOFTWARE IS PROVIDED BY THE UNIVERSITY OF TEXAS AT */
/* AUSTIN ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, */
/* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF */
/* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE */
/* DISCLAIMED. IN NO EVENT SHALL THE UNIVERSITY OF TEXAS AT */
/* AUSTIN OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, */
/* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES */
/* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE */
/* GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR */
/* BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF */
/* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT */
/* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT */
/* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE */
/* POSSIBILITY OF SUCH DAMAGE. */
/* */
/* The views and conclusions contained in the software and */
/* documentation are those of the authors and should not be */
/* interpreted as representing official policies, either expressed */
/* or implied, of The University of Texas at Austin. */
/*********************************************************************/
#include <stdio.h>
#include <ctype.h>
#include "common.h"
#ifdef FUNCTION_PROFILE
#include "functable.h"
#endif
#ifdef XDOUBLE
#define ERROR_NAME "XSYR "
#elif defined(DOUBLE)
#define ERROR_NAME "ZSYR "
#else
#define ERROR_NAME "CSYR "
#endif
static int (*syr[])(BLASLONG, FLOAT, FLOAT, FLOAT *, BLASLONG, FLOAT *, BLASLONG, FLOAT *) = {
#ifdef XDOUBLE
xsyr_U, xsyr_L,
#elif defined(DOUBLE)
zsyr_U, zsyr_L,
#else
csyr_U, csyr_L,
#endif
};
#ifdef SMPTEST
static int (*syr_thread[])(BLASLONG, FLOAT *, FLOAT *, BLASLONG, FLOAT *, BLASLONG, FLOAT *, int) = {
#ifdef XDOUBLE
xsyr_thread_U, xsyr_thread_L,
#elif defined(DOUBLE)
zsyr_thread_U, zsyr_thread_L,
#else
csyr_thread_U, csyr_thread_L,
#endif
};
#endif
#ifndef CBLAS
void NAME(char *UPLO, blasint *N, FLOAT *ALPHA,
FLOAT *x, blasint *INCX, FLOAT *a, blasint *LDA){
char uplo_arg = *UPLO;
blasint n = *N;
FLOAT alpha_r = ALPHA[0];
FLOAT alpha_i = ALPHA[1];
blasint lda = *LDA;
blasint incx = *INCX;
blasint info;
int uplo;
FLOAT *buffer;
#ifdef SMPTEST
int nthreads;
#endif
PRINT_DEBUG_NAME;
TOUPPER(uplo_arg);
uplo = -1;
if (uplo_arg == 'U') uplo = 0;
if (uplo_arg == 'L') uplo = 1;
info = 0;
if (lda < MAX(1, n)) info = 7;
if (incx == 0) info = 5;
if (n < 0) info = 2;
if (uplo < 0) info = 1;
if (info != 0) {
BLASFUNC(xerbla)(ERROR_NAME, &info, sizeof(ERROR_NAME));
return;
}
#else
void CNAME(enum CBLAS_ORDER order, enum CBLAS_UPLO Uplo, int n, FLOAT alpha, FLOAT *x, int incx, FLOAT *a, int lda) {
FLOAT *buffer;
int trans, uplo;
blasint info;
#ifdef SMPTEST
int nthreads;
#endif
PRINT_DEBUG_CNAME;
trans = -1;
uplo = -1;
info = 0;
if (order == CblasColMajor) {
if (Uplo == CblasUpper) uplo = 0;
if (Uplo == CblasLower) uplo = 1;
info = -1;
if (lda < MAX(1, n)) info = 7;
if (incx == 0) info = 5;
if (n < 0) info = 2;
if (uplo < 0) info = 1;
}
if (order == CblasRowMajor) {
if (Uplo == CblasUpper) uplo = 1;
if (Uplo == CblasLower) uplo = 0;
info = -1;
if (lda < MAX(1, n)) info = 7;
if (incx == 0) info = 5;
if (n < 0) info = 2;
if (uplo < 0) info = 1;
}
if (info >= 0) {
BLASFUNC(xerbla)(ERROR_NAME, &info, sizeof(ERROR_NAME));
return;
}
#endif
if (n == 0) return;
if ((alpha_r == ZERO) && (alpha_i == ZERO)) return;
IDEBUG_START;
FUNCTION_PROFILE_START();
if (incx < 0 ) x -= (n - 1) * incx;
buffer = (FLOAT *)blas_memory_alloc(1);
#ifdef SMPTEST
nthreads = num_cpu_avail(2);
if (nthreads == 1) {
#endif
(syr[uplo])(n, alpha_r, alpha_i, x, incx, a, lda, buffer);
#ifdef SMPTEST
} else {
(syr_thread[uplo])(n, ALPHA, x, incx, a, lda, buffer, nthreads);
}
#endif
blas_memory_free(buffer);
FUNCTION_PROFILE_END(4, n * n / 2 + n, n * n);
IDEBUG_END;
return;
}

151
interface/zsyr2.c Normal file
View File

@ -0,0 +1,151 @@
/*********************************************************************/
/* Copyright 2009, 2010 The University of Texas at Austin. */
/* All rights reserved. */
/* */
/* Redistribution and use in source and binary forms, with or */
/* without modification, are permitted provided that the following */
/* conditions are met: */
/* */
/* 1. Redistributions of source code must retain the above */
/* copyright notice, this list of conditions and the following */
/* disclaimer. */
/* */
/* 2. Redistributions in binary form must reproduce the above */
/* copyright notice, this list of conditions and the following */
/* disclaimer in the documentation and/or other materials */
/* provided with the distribution. */
/* */
/* THIS SOFTWARE IS PROVIDED BY THE UNIVERSITY OF TEXAS AT */
/* AUSTIN ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, */
/* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF */
/* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE */
/* DISCLAIMED. IN NO EVENT SHALL THE UNIVERSITY OF TEXAS AT */
/* AUSTIN OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, */
/* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES */
/* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE */
/* GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR */
/* BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF */
/* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT */
/* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT */
/* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE */
/* POSSIBILITY OF SUCH DAMAGE. */
/* */
/* The views and conclusions contained in the software and */
/* documentation are those of the authors and should not be */
/* interpreted as representing official policies, either expressed */
/* or implied, of The University of Texas at Austin. */
/*********************************************************************/
#include <stdio.h>
#include <ctype.h>
#include "common.h"
#ifdef FUNCTION_PROFILE
#include "functable.h"
#endif
#ifdef XDOUBLE
#define ERROR_NAME "QSYR2 "
#elif defined(DOUBLE)
#define ERROR_NAME "ZSYR2 "
#else
#define ERROR_NAME "CSYR2 "
#endif
static int (*syr2[])(BLASLONG, FLOAT, FLOAT, FLOAT *, BLASLONG, FLOAT *, BLASLONG, FLOAT *, BLASLONG, FLOAT *) = {
#ifdef XDOUBLE
xsyr2_U, xsyr2_L,
#elif defined(DOUBLE)
zsyr2_U, zsyr2_L,
#else
csyr2_U, csyr2_L,
#endif
};
#ifdef SMPTEST
static int (*syr2_thread[])(BLASLONG, FLOAT *, FLOAT *, BLASLONG, FLOAT *, BLASLONG, FLOAT *, BLASLONG, FLOAT *, int) = {
#ifdef XDOUBLE
xsyr2_thread_U, xsyr2_thread_L,
#elif defined(DOUBLE)
zsyr2_thread_U, zsyr2_thread_L,
#else
csyr2_thread_U, csyr2_thread_L,
#endif
};
#endif
void NAME(char *UPLO, blasint *N, FLOAT *ALPHA,
FLOAT *x, blasint *INCX, FLOAT *y, blasint *INCY, FLOAT *a, blasint *LDA){
char uplo_arg = *UPLO;
blasint n = *N;
FLOAT alpha_r = ALPHA[0];
FLOAT alpha_i = ALPHA[1];
blasint lda = *LDA;
blasint incx = *INCX;
blasint incy = *INCY;
blasint info;
int uplo;
FLOAT *buffer;
#ifdef SMPTEST
int nthreads;
#endif
PRINT_DEBUG_NAME;
TOUPPER(uplo_arg);
uplo = -1;
if (uplo_arg == 'U') uplo = 0;
if (uplo_arg == 'L') uplo = 1;
info = 0;
if (lda < MAX(1, n)) info = 9;
if (incy == 0) info = 7;
if (incx == 0) info = 5;
if (n < 0) info = 2;
if (uplo < 0) info = 1;
if (info != 0) {
BLASFUNC(xerbla)(ERROR_NAME, &info, sizeof(ERROR_NAME));
return;
}
if (n == 0) return;
if ((alpha_r == ZERO) && (alpha_i == ZERO)) return;
IDEBUG_START;
FUNCTION_PROFILE_START();
if (incx < 0 ) x -= (n - 1) * incx;
if (incy < 0 ) y -= (n - 1) * incy;
buffer = (FLOAT *)blas_memory_alloc(1);
#ifdef SMPTEST
nthreads = num_cpu_avail(2);
if (nthreads == 1) {
#endif
(syr2[uplo])(n, alpha_r, alpha_i, x, incx, y, incy, a, lda, buffer);
#ifdef SMPTEST
} else {
(syr2_thread[uplo])(n, ALPHA, x, incx, y, incy, a, lda, buffer, nthreads);
}
#endif
blas_memory_free(buffer);
FUNCTION_PROFILE_END(4, n * n / 2 + 2 * n, 2 * n * n);
IDEBUG_END;
return;
}

260
interface/ztbmv.c Normal file
View File

@ -0,0 +1,260 @@
/*********************************************************************/
/* Copyright 2009, 2010 The University of Texas at Austin. */
/* All rights reserved. */
/* */
/* Redistribution and use in source and binary forms, with or */
/* without modification, are permitted provided that the following */
/* conditions are met: */
/* */
/* 1. Redistributions of source code must retain the above */
/* copyright notice, this list of conditions and the following */
/* disclaimer. */
/* */
/* 2. Redistributions in binary form must reproduce the above */
/* copyright notice, this list of conditions and the following */
/* disclaimer in the documentation and/or other materials */
/* provided with the distribution. */
/* */
/* THIS SOFTWARE IS PROVIDED BY THE UNIVERSITY OF TEXAS AT */
/* AUSTIN ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, */
/* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF */
/* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE */
/* DISCLAIMED. IN NO EVENT SHALL THE UNIVERSITY OF TEXAS AT */
/* AUSTIN OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, */
/* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES */
/* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE */
/* GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR */
/* BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF */
/* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT */
/* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT */
/* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE */
/* POSSIBILITY OF SUCH DAMAGE. */
/* */
/* The views and conclusions contained in the software and */
/* documentation are those of the authors and should not be */
/* interpreted as representing official policies, either expressed */
/* or implied, of The University of Texas at Austin. */
/*********************************************************************/
#include <stdio.h>
#include <ctype.h>
#include "common.h"
#ifdef FUNCTION_PROFILE
#include "functable.h"
#endif
#ifdef XDOUBLE
#define ERROR_NAME "XTBMV "
#elif defined(DOUBLE)
#define ERROR_NAME "ZTBMV "
#else
#define ERROR_NAME "CTBMV "
#endif
static int (*tbmv[])(BLASLONG, BLASLONG, FLOAT *, BLASLONG, FLOAT *, BLASLONG, void *) = {
#ifdef XDOUBLE
xtbmv_NUU, xtbmv_NUN, xtbmv_NLU, xtbmv_NLN,
xtbmv_TUU, xtbmv_TUN, xtbmv_TLU, xtbmv_TLN,
xtbmv_RUU, xtbmv_RUN, xtbmv_RLU, xtbmv_RLN,
xtbmv_CUU, xtbmv_CUN, xtbmv_CLU, xtbmv_CLN,
#elif defined(DOUBLE)
ztbmv_NUU, ztbmv_NUN, ztbmv_NLU, ztbmv_NLN,
ztbmv_TUU, ztbmv_TUN, ztbmv_TLU, ztbmv_TLN,
ztbmv_RUU, ztbmv_RUN, ztbmv_RLU, ztbmv_RLN,
ztbmv_CUU, ztbmv_CUN, ztbmv_CLU, ztbmv_CLN,
#else
ctbmv_NUU, ctbmv_NUN, ctbmv_NLU, ctbmv_NLN,
ctbmv_TUU, ctbmv_TUN, ctbmv_TLU, ctbmv_TLN,
ctbmv_RUU, ctbmv_RUN, ctbmv_RLU, ctbmv_RLN,
ctbmv_CUU, ctbmv_CUN, ctbmv_CLU, ctbmv_CLN,
#endif
};
#ifdef SMPTEST
static int (*tbmv_thread[])(BLASLONG, BLASLONG, FLOAT *, BLASLONG, FLOAT *, BLASLONG, FLOAT *, int) = {
#ifdef XDOUBLE
xtbmv_thread_NUU, xtbmv_thread_NUN, xtbmv_thread_NLU, xtbmv_thread_NLN,
xtbmv_thread_TUU, xtbmv_thread_TUN, xtbmv_thread_TLU, xtbmv_thread_TLN,
xtbmv_thread_RUU, xtbmv_thread_RUN, xtbmv_thread_RLU, xtbmv_thread_RLN,
xtbmv_thread_CUU, xtbmv_thread_CUN, xtbmv_thread_CLU, xtbmv_thread_CLN,
#elif defined(DOUBLE)
ztbmv_thread_NUU, ztbmv_thread_NUN, ztbmv_thread_NLU, ztbmv_thread_NLN,
ztbmv_thread_TUU, ztbmv_thread_TUN, ztbmv_thread_TLU, ztbmv_thread_TLN,
ztbmv_thread_RUU, ztbmv_thread_RUN, ztbmv_thread_RLU, ztbmv_thread_RLN,
ztbmv_thread_CUU, ztbmv_thread_CUN, ztbmv_thread_CLU, ztbmv_thread_CLN,
#else
ctbmv_thread_NUU, ctbmv_thread_NUN, ctbmv_thread_NLU, ctbmv_thread_NLN,
ctbmv_thread_TUU, ctbmv_thread_TUN, ctbmv_thread_TLU, ctbmv_thread_TLN,
ctbmv_thread_RUU, ctbmv_thread_RUN, ctbmv_thread_RLU, ctbmv_thread_RLN,
ctbmv_thread_CUU, ctbmv_thread_CUN, ctbmv_thread_CLU, ctbmv_thread_CLN,
#endif
};
#endif
#ifndef CBLAS
void NAME(char *UPLO, char *TRANS, char *DIAG,
blasint *N, blasint *K,
FLOAT *a, blasint *LDA, FLOAT *x, blasint *INCX){
char uplo_arg = *UPLO;
char trans_arg = *TRANS;
char diag_arg = *DIAG;
blasint n = *N;
blasint k = *K;
blasint lda = *LDA;
blasint incx = *INCX;
blasint info;
int uplo;
int unit;
int trans;
FLOAT *buffer;
#ifdef SMPTEST
int nthreads;
#endif
PRINT_DEBUG_NAME;
TOUPPER(uplo_arg);
TOUPPER(trans_arg);
TOUPPER(diag_arg);
trans = -1;
unit = -1;
uplo = -1;
if (trans_arg == 'N') trans = 0;
if (trans_arg == 'T') trans = 1;
if (trans_arg == 'R') trans = 2;
if (trans_arg == 'C') trans = 3;
if (diag_arg == 'U') unit = 0;
if (diag_arg == 'N') unit = 1;
if (uplo_arg == 'U') uplo = 0;
if (uplo_arg == 'L') uplo = 1;
info = 0;
if (incx == 0) info = 9;
if (lda < k + 1) info = 7;
if (k < 0) info = 5;
if (n < 0) info = 4;
if (unit < 0) info = 3;
if (trans < 0) info = 2;
if (uplo < 0) info = 1;
if (info != 0) {
BLASFUNC(xerbla)(ERROR_NAME, &info, sizeof(ERROR_NAME));
return;
}
#else
void CNAME(enum CBLAS_ORDER order, enum CBLAS_UPLO Uplo,
enum CBLAS_TRANSPOSE TransA, enum CBLAS_DIAG Diag,
blasint n, blasint k, FLOAT *a, blasint lda, FLOAT *x, blasint incx) {
int trans, uplo, unit;
blasint info;
FLOAT *buffer;
#ifdef SMPTEST
int nthreads;
#endif
PRINT_DEBUG_CNAME;
unit = -1;
uplo = -1;
trans = -1;
info = 0;
if (order == CblasColMajor) {
if (Uplo == CblasUpper) uplo = 0;
if (Uplo == CblasLower) uplo = 1;
if (TransA == CblasNoTrans) trans = 0;
if (TransA == CblasTrans) trans = 1;
if (TransA == CblasConjNoTrans) trans = 2;
if (TransA == CblasConjTrans) trans = 3;
if (Diag == CblasUnit) unit = 0;
if (Diag == CblasNonUnit) unit = 1;
info = -1;
if (incx == 0) info = 9;
if (lda < k + 1) info = 7;
if (k < 0) info = 5;
if (n < 0) info = 4;
if (unit < 0) info = 3;
if (trans < 0) info = 2;
if (uplo < 0) info = 1;
}
if (order == CblasRowMajor) {
if (Uplo == CblasUpper) uplo = 1;
if (Uplo == CblasLower) uplo = 0;
if (TransA == CblasNoTrans) trans = 1;
if (TransA == CblasTrans) trans = 0;
if (TransA == CblasConjNoTrans) trans = 3;
if (TransA == CblasConjTrans) trans = 2;
if (Diag == CblasUnit) unit = 0;
if (Diag == CblasNonUnit) unit = 1;
info = -1;
if (incx == 0) info = 9;
if (lda < k + 1) info = 7;
if (k < 0) info = 5;
if (n < 0) info = 4;
if (unit < 0) info = 3;
if (trans < 0) info = 2;
if (uplo < 0) info = 1;
}
if (info >= 0) {
BLASFUNC(xerbla)(ERROR_NAME, &info, sizeof(ERROR_NAME));
return;
}
#endif
if (n == 0) return;
IDEBUG_START;
FUNCTION_PROFILE_START();
if (incx < 0 ) x -= (n - 1) * incx * 2;
buffer = (FLOAT *)blas_memory_alloc(1);
#ifdef SMPTEST
nthreads = num_cpu_avail(2);
if (nthreads == 1) {
#endif
(tbmv[(trans<<2) | (uplo<<1) | unit])(n, k, a, lda, x, incx, buffer);
#ifdef SMPTEST
} else {
(tbmv_thread[(trans<<2) | (uplo<<1) | unit])(n, k, a, lda, x, incx, buffer, nthreads);
}
#endif
blas_memory_free(buffer);
FUNCTION_PROFILE_END(4, n * k / 2 + n, n * k);
IDEBUG_END;
return;
}

219
interface/ztbsv.c Normal file
View File

@ -0,0 +1,219 @@
/*********************************************************************/
/* Copyright 2009, 2010 The University of Texas at Austin. */
/* All rights reserved. */
/* */
/* Redistribution and use in source and binary forms, with or */
/* without modification, are permitted provided that the following */
/* conditions are met: */
/* */
/* 1. Redistributions of source code must retain the above */
/* copyright notice, this list of conditions and the following */
/* disclaimer. */
/* */
/* 2. Redistributions in binary form must reproduce the above */
/* copyright notice, this list of conditions and the following */
/* disclaimer in the documentation and/or other materials */
/* provided with the distribution. */
/* */
/* THIS SOFTWARE IS PROVIDED BY THE UNIVERSITY OF TEXAS AT */
/* AUSTIN ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, */
/* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF */
/* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE */
/* DISCLAIMED. IN NO EVENT SHALL THE UNIVERSITY OF TEXAS AT */
/* AUSTIN OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, */
/* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES */
/* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE */
/* GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR */
/* BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF */
/* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT */
/* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT */
/* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE */
/* POSSIBILITY OF SUCH DAMAGE. */
/* */
/* The views and conclusions contained in the software and */
/* documentation are those of the authors and should not be */
/* interpreted as representing official policies, either expressed */
/* or implied, of The University of Texas at Austin. */
/*********************************************************************/
#include <stdio.h>
#include <ctype.h>
#include "common.h"
#ifdef FUNCTION_PROFILE
#include "functable.h"
#endif
#ifdef XDOUBLE
#define ERROR_NAME "XTBSV "
#elif defined(DOUBLE)
#define ERROR_NAME "ZTBSV "
#else
#define ERROR_NAME "CTBSV "
#endif
static int (*tbsv[])(BLASLONG, BLASLONG, FLOAT *, BLASLONG, FLOAT *, BLASLONG, void *) = {
#ifdef XDOUBLE
xtbsv_NUU, xtbsv_NUN, xtbsv_NLU, xtbsv_NLN,
xtbsv_TUU, xtbsv_TUN, xtbsv_TLU, xtbsv_TLN,
xtbsv_RUU, xtbsv_RUN, xtbsv_RLU, xtbsv_RLN,
xtbsv_CUU, xtbsv_CUN, xtbsv_CLU, xtbsv_CLN,
#elif defined(DOUBLE)
ztbsv_NUU, ztbsv_NUN, ztbsv_NLU, ztbsv_NLN,
ztbsv_TUU, ztbsv_TUN, ztbsv_TLU, ztbsv_TLN,
ztbsv_RUU, ztbsv_RUN, ztbsv_RLU, ztbsv_RLN,
ztbsv_CUU, ztbsv_CUN, ztbsv_CLU, ztbsv_CLN,
#else
ctbsv_NUU, ctbsv_NUN, ctbsv_NLU, ctbsv_NLN,
ctbsv_TUU, ctbsv_TUN, ctbsv_TLU, ctbsv_TLN,
ctbsv_RUU, ctbsv_RUN, ctbsv_RLU, ctbsv_RLN,
ctbsv_CUU, ctbsv_CUN, ctbsv_CLU, ctbsv_CLN,
#endif
};
#ifndef CBLAS
void NAME(char *UPLO, char *TRANS, char *DIAG,
blasint *N, blasint *K,
FLOAT *a, blasint *LDA, FLOAT *x, blasint *INCX){
char uplo_arg = *UPLO;
char trans_arg = *TRANS;
char diag_arg = *DIAG;
blasint n = *N;
blasint k = *K;
blasint lda = *LDA;
blasint incx = *INCX;
blasint info;
int uplo;
int unit;
int trans;
FLOAT *buffer;
PRINT_DEBUG_NAME;
TOUPPER(uplo_arg);
TOUPPER(trans_arg);
TOUPPER(diag_arg);
trans = -1;
unit = -1;
uplo = -1;
if (trans_arg == 'N') trans = 0;
if (trans_arg == 'T') trans = 1;
if (trans_arg == 'R') trans = 2;
if (trans_arg == 'C') trans = 3;
if (diag_arg == 'U') unit = 0;
if (diag_arg == 'N') unit = 1;
if (uplo_arg == 'U') uplo = 0;
if (uplo_arg == 'L') uplo = 1;
info = 0;
if (incx == 0) info = 9;
if (lda < k + 1) info = 7;
if (k < 0) info = 5;
if (n < 0) info = 4;
if (unit < 0) info = 3;
if (trans < 0) info = 2;
if (uplo < 0) info = 1;
if (info != 0) {
BLASFUNC(xerbla)(ERROR_NAME, &info, sizeof(ERROR_NAME));
return;
}
#else
void CNAME(enum CBLAS_ORDER order, enum CBLAS_UPLO Uplo,
enum CBLAS_TRANSPOSE TransA, enum CBLAS_DIAG Diag,
blasint n, blasint k, FLOAT *a, blasint lda, FLOAT *x, blasint incx) {
int trans, uplo, unit;
blasint info;
FLOAT *buffer;
PRINT_DEBUG_CNAME;
unit = -1;
uplo = -1;
trans = -1;
info = 0;
if (order == CblasColMajor) {
if (Uplo == CblasUpper) uplo = 0;
if (Uplo == CblasLower) uplo = 1;
if (TransA == CblasNoTrans) trans = 0;
if (TransA == CblasTrans) trans = 1;
if (TransA == CblasConjNoTrans) trans = 2;
if (TransA == CblasConjTrans) trans = 3;
if (Diag == CblasUnit) unit = 0;
if (Diag == CblasNonUnit) unit = 1;
info = -1;
if (incx == 0) info = 9;
if (lda < k + 1) info = 7;
if (k < 0) info = 5;
if (n < 0) info = 4;
if (unit < 0) info = 3;
if (trans < 0) info = 2;
if (uplo < 0) info = 1;
}
if (order == CblasRowMajor) {
if (Uplo == CblasUpper) uplo = 1;
if (Uplo == CblasLower) uplo = 0;
if (TransA == CblasNoTrans) trans = 1;
if (TransA == CblasTrans) trans = 0;
if (TransA == CblasConjNoTrans) trans = 3;
if (TransA == CblasConjTrans) trans = 2;
if (Diag == CblasUnit) unit = 0;
if (Diag == CblasNonUnit) unit = 1;
info = -1;
if (incx == 0) info = 9;
if (lda < k + 1) info = 7;
if (k < 0) info = 5;
if (n < 0) info = 4;
if (unit < 0) info = 3;
if (trans < 0) info = 2;
if (uplo < 0) info = 1;
}
if (info >= 0) {
BLASFUNC(xerbla)(ERROR_NAME, &info, sizeof(ERROR_NAME));
return;
}
#endif
if (n == 0) return;
IDEBUG_START;
FUNCTION_PROFILE_START();
if (incx < 0 ) x -= (n - 1) * incx * 2;
buffer = (FLOAT *)blas_memory_alloc(1);
(tbsv[(trans<<2) | (uplo<<1) | unit])(n, k, a, lda, x, incx, buffer);
blas_memory_free(buffer);
FUNCTION_PROFILE_END(4, n * k / 2 + n, n * k);
IDEBUG_END;
return;
}

252
interface/ztpmv.c Normal file
View File

@ -0,0 +1,252 @@
/*********************************************************************/
/* Copyright 2009, 2010 The University of Texas at Austin. */
/* All rights reserved. */
/* */
/* Redistribution and use in source and binary forms, with or */
/* without modification, are permitted provided that the following */
/* conditions are met: */
/* */
/* 1. Redistributions of source code must retain the above */
/* copyright notice, this list of conditions and the following */
/* disclaimer. */
/* */
/* 2. Redistributions in binary form must reproduce the above */
/* copyright notice, this list of conditions and the following */
/* disclaimer in the documentation and/or other materials */
/* provided with the distribution. */
/* */
/* THIS SOFTWARE IS PROVIDED BY THE UNIVERSITY OF TEXAS AT */
/* AUSTIN ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, */
/* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF */
/* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE */
/* DISCLAIMED. IN NO EVENT SHALL THE UNIVERSITY OF TEXAS AT */
/* AUSTIN OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, */
/* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES */
/* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE */
/* GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR */
/* BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF */
/* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT */
/* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT */
/* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE */
/* POSSIBILITY OF SUCH DAMAGE. */
/* */
/* The views and conclusions contained in the software and */
/* documentation are those of the authors and should not be */
/* interpreted as representing official policies, either expressed */
/* or implied, of The University of Texas at Austin. */
/*********************************************************************/
#include <stdio.h>
#include <ctype.h>
#include "common.h"
#ifdef FUNCTION_PROFILE
#include "functable.h"
#endif
#ifdef XDOUBLE
#define ERROR_NAME "XTPMV "
#elif defined(DOUBLE)
#define ERROR_NAME "ZTPMV "
#else
#define ERROR_NAME "CTPMV "
#endif
static int (*tpmv[])(BLASLONG, FLOAT *, FLOAT *, BLASLONG, void *) = {
#ifdef XDOUBLE
xtpmv_NUU, xtpmv_NUN, xtpmv_NLU, xtpmv_NLN,
xtpmv_TUU, xtpmv_TUN, xtpmv_TLU, xtpmv_TLN,
xtpmv_RUU, xtpmv_RUN, xtpmv_RLU, xtpmv_RLN,
xtpmv_CUU, xtpmv_CUN, xtpmv_CLU, xtpmv_CLN,
#elif defined(DOUBLE)
ztpmv_NUU, ztpmv_NUN, ztpmv_NLU, ztpmv_NLN,
ztpmv_TUU, ztpmv_TUN, ztpmv_TLU, ztpmv_TLN,
ztpmv_RUU, ztpmv_RUN, ztpmv_RLU, ztpmv_RLN,
ztpmv_CUU, ztpmv_CUN, ztpmv_CLU, ztpmv_CLN,
#else
ctpmv_NUU, ctpmv_NUN, ctpmv_NLU, ctpmv_NLN,
ctpmv_TUU, ctpmv_TUN, ctpmv_TLU, ctpmv_TLN,
ctpmv_RUU, ctpmv_RUN, ctpmv_RLU, ctpmv_RLN,
ctpmv_CUU, ctpmv_CUN, ctpmv_CLU, ctpmv_CLN,
#endif
};
#ifdef SMPTEST
static int (*tpmv_thread[])(BLASLONG, FLOAT *, FLOAT *, BLASLONG, FLOAT *, int) = {
#ifdef XDOUBLE
xtpmv_thread_NUU, xtpmv_thread_NUN, xtpmv_thread_NLU, xtpmv_thread_NLN,
xtpmv_thread_TUU, xtpmv_thread_TUN, xtpmv_thread_TLU, xtpmv_thread_TLN,
xtpmv_thread_RUU, xtpmv_thread_RUN, xtpmv_thread_RLU, xtpmv_thread_RLN,
xtpmv_thread_CUU, xtpmv_thread_CUN, xtpmv_thread_CLU, xtpmv_thread_CLN,
#elif defined(DOUBLE)
ztpmv_thread_NUU, ztpmv_thread_NUN, ztpmv_thread_NLU, ztpmv_thread_NLN,
ztpmv_thread_TUU, ztpmv_thread_TUN, ztpmv_thread_TLU, ztpmv_thread_TLN,
ztpmv_thread_RUU, ztpmv_thread_RUN, ztpmv_thread_RLU, ztpmv_thread_RLN,
ztpmv_thread_CUU, ztpmv_thread_CUN, ztpmv_thread_CLU, ztpmv_thread_CLN,
#else
ctpmv_thread_NUU, ctpmv_thread_NUN, ctpmv_thread_NLU, ctpmv_thread_NLN,
ctpmv_thread_TUU, ctpmv_thread_TUN, ctpmv_thread_TLU, ctpmv_thread_TLN,
ctpmv_thread_RUU, ctpmv_thread_RUN, ctpmv_thread_RLU, ctpmv_thread_RLN,
ctpmv_thread_CUU, ctpmv_thread_CUN, ctpmv_thread_CLU, ctpmv_thread_CLN,
#endif
};
#endif
#ifndef CBLAS
void NAME(char *UPLO, char *TRANS, char *DIAG,
blasint *N, FLOAT *a, FLOAT *x, blasint *INCX){
char uplo_arg = *UPLO;
char trans_arg = *TRANS;
char diag_arg = *DIAG;
blasint n = *N;
blasint incx = *INCX;
blasint info;
int uplo;
int unit;
int trans;
FLOAT *buffer;
#ifdef SMPTEST
int nthreads;
#endif
PRINT_DEBUG_NAME;
TOUPPER(uplo_arg);
TOUPPER(trans_arg);
TOUPPER(diag_arg);
trans = -1;
unit = -1;
uplo = -1;
if (trans_arg == 'N') trans = 0;
if (trans_arg == 'T') trans = 1;
if (trans_arg == 'R') trans = 2;
if (trans_arg == 'C') trans = 3;
if (diag_arg == 'U') unit = 0;
if (diag_arg == 'N') unit = 1;
if (uplo_arg == 'U') uplo = 0;
if (uplo_arg == 'L') uplo = 1;
info = 0;
if (incx == 0) info = 7;
if (n < 0) info = 4;
if (unit < 0) info = 3;
if (trans < 0) info = 2;
if (uplo < 0) info = 1;
if (info != 0) {
BLASFUNC(xerbla)(ERROR_NAME, &info, sizeof(ERROR_NAME));
return;
}
#else
void CNAME(enum CBLAS_ORDER order, enum CBLAS_UPLO Uplo,
enum CBLAS_TRANSPOSE TransA, enum CBLAS_DIAG Diag,
blasint n, FLOAT *a, FLOAT *x, blasint incx) {
int trans, uplo, unit;
blasint info;
FLOAT *buffer;
PRINT_DEBUG_CNAME;
unit = -1;
uplo = -1;
trans = -1;
info = 0;
#ifdef SMPTEST
int nthreads;
#endif
if (order == CblasColMajor) {
if (Uplo == CblasUpper) uplo = 0;
if (Uplo == CblasLower) uplo = 1;
if (TransA == CblasNoTrans) trans = 0;
if (TransA == CblasTrans) trans = 1;
if (TransA == CblasConjNoTrans) trans = 2;
if (TransA == CblasConjTrans) trans = 3;
if (Diag == CblasUnit) unit = 0;
if (Diag == CblasNonUnit) unit = 1;
info = -1;
if (incx == 0) info = 7;
if (n < 0) info = 4;
if (unit < 0) info = 3;
if (trans < 0) info = 2;
if (uplo < 0) info = 1;
}
if (order == CblasRowMajor) {
if (Uplo == CblasUpper) uplo = 1;
if (Uplo == CblasLower) uplo = 0;
if (TransA == CblasNoTrans) trans = 1;
if (TransA == CblasTrans) trans = 0;
if (TransA == CblasConjNoTrans) trans = 3;
if (TransA == CblasConjTrans) trans = 2;
if (Diag == CblasUnit) unit = 0;
if (Diag == CblasNonUnit) unit = 1;
info = -1;
if (incx == 0) info = 7;
if (n < 0) info = 4;
if (unit < 0) info = 3;
if (trans < 0) info = 2;
if (uplo < 0) info = 1;
}
if (info >= 0) {
BLASFUNC(xerbla)(ERROR_NAME, &info, sizeof(ERROR_NAME));
return;
}
#endif
if (n == 0) return;
IDEBUG_START;
FUNCTION_PROFILE_START();
if (incx < 0 ) x -= (n - 1) * incx * 2;
buffer = (FLOAT *)blas_memory_alloc(1);
#ifdef SMPTEST
nthreads = num_cpu_avail(2);
if (nthreads == 1) {
#endif
(tpmv[(trans<<2) | (uplo<<1) | unit])(n, a, x, incx, buffer);
#ifdef SMPTEST
} else {
(tpmv_thread[(trans<<2) | (uplo<<1) | unit])(n, a, x, incx, buffer, nthreads);
}
#endif
blas_memory_free(buffer);
FUNCTION_PROFILE_END(4, n * n / 2 + n, n * n);
IDEBUG_END;
return;
}

210
interface/ztpsv.c Normal file
View File

@ -0,0 +1,210 @@
/*********************************************************************/
/* Copyright 2009, 2010 The University of Texas at Austin. */
/* All rights reserved. */
/* */
/* Redistribution and use in source and binary forms, with or */
/* without modification, are permitted provided that the following */
/* conditions are met: */
/* */
/* 1. Redistributions of source code must retain the above */
/* copyright notice, this list of conditions and the following */
/* disclaimer. */
/* */
/* 2. Redistributions in binary form must reproduce the above */
/* copyright notice, this list of conditions and the following */
/* disclaimer in the documentation and/or other materials */
/* provided with the distribution. */
/* */
/* THIS SOFTWARE IS PROVIDED BY THE UNIVERSITY OF TEXAS AT */
/* AUSTIN ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, */
/* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF */
/* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE */
/* DISCLAIMED. IN NO EVENT SHALL THE UNIVERSITY OF TEXAS AT */
/* AUSTIN OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, */
/* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES */
/* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE */
/* GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR */
/* BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF */
/* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT */
/* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT */
/* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE */
/* POSSIBILITY OF SUCH DAMAGE. */
/* */
/* The views and conclusions contained in the software and */
/* documentation are those of the authors and should not be */
/* interpreted as representing official policies, either expressed */
/* or implied, of The University of Texas at Austin. */
/*********************************************************************/
#include <stdio.h>
#include <ctype.h>
#include "common.h"
#ifdef FUNCTION_PROFILE
#include "functable.h"
#endif
#ifdef XDOUBLE
#define ERROR_NAME "XTPSV "
#elif defined(DOUBLE)
#define ERROR_NAME "ZTPSV "
#else
#define ERROR_NAME "CTPSV "
#endif
static int (*tpsv[])(BLASLONG, FLOAT *, FLOAT *, BLASLONG, void *) = {
#ifdef XDOUBLE
xtpsv_NUU, xtpsv_NUN, xtpsv_NLU, xtpsv_NLN,
xtpsv_TUU, xtpsv_TUN, xtpsv_TLU, xtpsv_TLN,
xtpsv_RUU, xtpsv_RUN, xtpsv_RLU, xtpsv_RLN,
xtpsv_CUU, xtpsv_CUN, xtpsv_CLU, xtpsv_CLN,
#elif defined(DOUBLE)
ztpsv_NUU, ztpsv_NUN, ztpsv_NLU, ztpsv_NLN,
ztpsv_TUU, ztpsv_TUN, ztpsv_TLU, ztpsv_TLN,
ztpsv_RUU, ztpsv_RUN, ztpsv_RLU, ztpsv_RLN,
ztpsv_CUU, ztpsv_CUN, ztpsv_CLU, ztpsv_CLN,
#else
ctpsv_NUU, ctpsv_NUN, ctpsv_NLU, ctpsv_NLN,
ctpsv_TUU, ctpsv_TUN, ctpsv_TLU, ctpsv_TLN,
ctpsv_RUU, ctpsv_RUN, ctpsv_RLU, ctpsv_RLN,
ctpsv_CUU, ctpsv_CUN, ctpsv_CLU, ctpsv_CLN,
#endif
};
#ifndef CBLAS
void NAME(char *UPLO, char *TRANS, char *DIAG,
blasint *N, FLOAT *a, FLOAT *x, blasint *INCX){
char uplo_arg = *UPLO;
char trans_arg = *TRANS;
char diag_arg = *DIAG;
blasint n = *N;
blasint incx = *INCX;
blasint info;
int uplo;
int unit;
int trans;
FLOAT *buffer;
PRINT_DEBUG_NAME;
TOUPPER(uplo_arg);
TOUPPER(trans_arg);
TOUPPER(diag_arg);
trans = -1;
unit = -1;
uplo = -1;
if (trans_arg == 'N') trans = 0;
if (trans_arg == 'T') trans = 1;
if (trans_arg == 'R') trans = 2;
if (trans_arg == 'C') trans = 3;
if (diag_arg == 'U') unit = 0;
if (diag_arg == 'N') unit = 1;
if (uplo_arg == 'U') uplo = 0;
if (uplo_arg == 'L') uplo = 1;
info = 0;
if (incx == 0) info = 7;
if (n < 0) info = 4;
if (unit < 0) info = 3;
if (trans < 0) info = 2;
if (uplo < 0) info = 1;
if (info != 0) {
BLASFUNC(xerbla)(ERROR_NAME, &info, sizeof(ERROR_NAME));
return;
}
#else
void CNAME(enum CBLAS_ORDER order, enum CBLAS_UPLO Uplo,
enum CBLAS_TRANSPOSE TransA, enum CBLAS_DIAG Diag,
blasint n, FLOAT *a, FLOAT *x, blasint incx) {
int trans, uplo, unit;
blasint info;
FLOAT *buffer;
PRINT_DEBUG_CNAME;
unit = -1;
uplo = -1;
trans = -1;
info = 0;
if (order == CblasColMajor) {
if (Uplo == CblasUpper) uplo = 0;
if (Uplo == CblasLower) uplo = 1;
if (TransA == CblasNoTrans) trans = 0;
if (TransA == CblasTrans) trans = 1;
if (TransA == CblasConjNoTrans) trans = 2;
if (TransA == CblasConjTrans) trans = 3;
if (Diag == CblasUnit) unit = 0;
if (Diag == CblasNonUnit) unit = 1;
info = -1;
if (incx == 0) info = 7;
if (n < 0) info = 4;
if (unit < 0) info = 3;
if (trans < 0) info = 2;
if (uplo < 0) info = 1;
}
if (order == CblasRowMajor) {
if (Uplo == CblasUpper) uplo = 1;
if (Uplo == CblasLower) uplo = 0;
if (TransA == CblasNoTrans) trans = 1;
if (TransA == CblasTrans) trans = 0;
if (TransA == CblasConjNoTrans) trans = 3;
if (TransA == CblasConjTrans) trans = 2;
if (Diag == CblasUnit) unit = 0;
if (Diag == CblasNonUnit) unit = 1;
info = -1;
if (incx == 0) info = 7;
if (n < 0) info = 4;
if (unit < 0) info = 3;
if (trans < 0) info = 2;
if (uplo < 0) info = 1;
}
if (info >= 0) {
BLASFUNC(xerbla)(ERROR_NAME, &info, sizeof(ERROR_NAME));
return;
}
#endif
if (n == 0) return;
IDEBUG_START;
FUNCTION_PROFILE_START();
if (incx < 0 ) x -= (n - 1) * incx * 2;
buffer = (FLOAT *)blas_memory_alloc(1);
(tpsv[(trans<<2) | (uplo<<1) | unit])(n, a, x, incx, buffer);
blas_memory_free(buffer);
FUNCTION_PROFILE_END(4, n * n / 2 + n, n * n);
IDEBUG_END;
return;
}

255
interface/ztrmv.c Normal file
View File

@ -0,0 +1,255 @@
/*********************************************************************/
/* Copyright 2009, 2010 The University of Texas at Austin. */
/* All rights reserved. */
/* */
/* Redistribution and use in source and binary forms, with or */
/* without modification, are permitted provided that the following */
/* conditions are met: */
/* */
/* 1. Redistributions of source code must retain the above */
/* copyright notice, this list of conditions and the following */
/* disclaimer. */
/* */
/* 2. Redistributions in binary form must reproduce the above */
/* copyright notice, this list of conditions and the following */
/* disclaimer in the documentation and/or other materials */
/* provided with the distribution. */
/* */
/* THIS SOFTWARE IS PROVIDED BY THE UNIVERSITY OF TEXAS AT */
/* AUSTIN ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, */
/* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF */
/* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE */
/* DISCLAIMED. IN NO EVENT SHALL THE UNIVERSITY OF TEXAS AT */
/* AUSTIN OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, */
/* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES */
/* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE */
/* GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR */
/* BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF */
/* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT */
/* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT */
/* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE */
/* POSSIBILITY OF SUCH DAMAGE. */
/* */
/* The views and conclusions contained in the software and */
/* documentation are those of the authors and should not be */
/* interpreted as representing official policies, either expressed */
/* or implied, of The University of Texas at Austin. */
/*********************************************************************/
#include <stdio.h>
#include <ctype.h>
#include "common.h"
#ifdef FUNCTION_PROFILE
#include "functable.h"
#endif
#ifdef XDOUBLE
#define ERROR_NAME "XTRMV "
#elif defined(DOUBLE)
#define ERROR_NAME "ZTRMV "
#else
#define ERROR_NAME "CTRMV "
#endif
static int (*trmv[])(BLASLONG, FLOAT *, BLASLONG, FLOAT *, BLASLONG, FLOAT *) = {
#ifdef XDOUBLE
xtrmv_NUU, xtrmv_NUN, xtrmv_NLU, xtrmv_NLN,
xtrmv_TUU, xtrmv_TUN, xtrmv_TLU, xtrmv_TLN,
xtrmv_RUU, xtrmv_RUN, xtrmv_RLU, xtrmv_RLN,
xtrmv_CUU, xtrmv_CUN, xtrmv_CLU, xtrmv_CLN,
#elif defined(DOUBLE)
ztrmv_NUU, ztrmv_NUN, ztrmv_NLU, ztrmv_NLN,
ztrmv_TUU, ztrmv_TUN, ztrmv_TLU, ztrmv_TLN,
ztrmv_RUU, ztrmv_RUN, ztrmv_RLU, ztrmv_RLN,
ztrmv_CUU, ztrmv_CUN, ztrmv_CLU, ztrmv_CLN,
#else
ctrmv_NUU, ctrmv_NUN, ctrmv_NLU, ctrmv_NLN,
ctrmv_TUU, ctrmv_TUN, ctrmv_TLU, ctrmv_TLN,
ctrmv_RUU, ctrmv_RUN, ctrmv_RLU, ctrmv_RLN,
ctrmv_CUU, ctrmv_CUN, ctrmv_CLU, ctrmv_CLN,
#endif
};
#ifdef SMPTEST
static int (*trmv_thread[])(BLASLONG, FLOAT *, BLASLONG, FLOAT *, BLASLONG, FLOAT *, int) = {
#ifdef XDOUBLE
xtrmv_thread_NUU, xtrmv_thread_NUN, xtrmv_thread_NLU, xtrmv_thread_NLN,
xtrmv_thread_TUU, xtrmv_thread_TUN, xtrmv_thread_TLU, xtrmv_thread_TLN,
xtrmv_thread_RUU, xtrmv_thread_RUN, xtrmv_thread_RLU, xtrmv_thread_RLN,
xtrmv_thread_CUU, xtrmv_thread_CUN, xtrmv_thread_CLU, xtrmv_thread_CLN,
#elif defined(DOUBLE)
ztrmv_thread_NUU, ztrmv_thread_NUN, ztrmv_thread_NLU, ztrmv_thread_NLN,
ztrmv_thread_TUU, ztrmv_thread_TUN, ztrmv_thread_TLU, ztrmv_thread_TLN,
ztrmv_thread_RUU, ztrmv_thread_RUN, ztrmv_thread_RLU, ztrmv_thread_RLN,
ztrmv_thread_CUU, ztrmv_thread_CUN, ztrmv_thread_CLU, ztrmv_thread_CLN,
#else
ctrmv_thread_NUU, ctrmv_thread_NUN, ctrmv_thread_NLU, ctrmv_thread_NLN,
ctrmv_thread_TUU, ctrmv_thread_TUN, ctrmv_thread_TLU, ctrmv_thread_TLN,
ctrmv_thread_RUU, ctrmv_thread_RUN, ctrmv_thread_RLU, ctrmv_thread_RLN,
ctrmv_thread_CUU, ctrmv_thread_CUN, ctrmv_thread_CLU, ctrmv_thread_CLN,
#endif
};
#endif
#ifndef CBLAS
void NAME(char *UPLO, char *TRANS, char *DIAG,
blasint *N, FLOAT *a, blasint *LDA, FLOAT *x, blasint *INCX){
char uplo_arg = *UPLO;
char trans_arg = *TRANS;
char diag_arg = *DIAG;
blasint n = *N;
blasint lda = *LDA;
blasint incx = *INCX;
blasint info;
int uplo;
int unit;
int trans;
FLOAT *buffer;
#ifdef SMPTEST
int nthreads;
#endif
PRINT_DEBUG_NAME;
TOUPPER(uplo_arg);
TOUPPER(trans_arg);
TOUPPER(diag_arg);
trans = -1;
unit = -1;
uplo = -1;
if (trans_arg == 'N') trans = 0;
if (trans_arg == 'T') trans = 1;
if (trans_arg == 'R') trans = 2;
if (trans_arg == 'C') trans = 3;
if (diag_arg == 'U') unit = 0;
if (diag_arg == 'N') unit = 1;
if (uplo_arg == 'U') uplo = 0;
if (uplo_arg == 'L') uplo = 1;
info = 0;
if (incx == 0) info = 8;
if (lda < MAX(1, n)) info = 6;
if (n < 0) info = 4;
if (unit < 0) info = 3;
if (trans < 0) info = 2;
if (uplo < 0) info = 1;
if (info != 0) {
BLASFUNC(xerbla)(ERROR_NAME, &info, sizeof(ERROR_NAME));
return;
}
#else
void CNAME(enum CBLAS_ORDER order, enum CBLAS_UPLO Uplo,
enum CBLAS_TRANSPOSE TransA, enum CBLAS_DIAG Diag,
blasint n, FLOAT *a, blasint lda, FLOAT *x, blasint incx) {
int trans, uplo, unit;
blasint info;
FLOAT *buffer;
#ifdef SMPTEST
int nthreads;
#endif
PRINT_DEBUG_CNAME;
unit = -1;
uplo = -1;
trans = -1;
info = 0;
if (order == CblasColMajor) {
if (Uplo == CblasUpper) uplo = 0;
if (Uplo == CblasLower) uplo = 1;
if (TransA == CblasNoTrans) trans = 0;
if (TransA == CblasTrans) trans = 1;
if (TransA == CblasConjNoTrans) trans = 2;
if (TransA == CblasConjTrans) trans = 3;
if (Diag == CblasUnit) unit = 0;
if (Diag == CblasNonUnit) unit = 1;
info = -1;
if (incx == 0) info = 8;
if (lda < MAX(1, n)) info = 6;
if (n < 0) info = 4;
if (unit < 0) info = 3;
if (trans < 0) info = 2;
if (uplo < 0) info = 1;
}
if (order == CblasRowMajor) {
if (Uplo == CblasUpper) uplo = 1;
if (Uplo == CblasLower) uplo = 0;
if (TransA == CblasNoTrans) trans = 1;
if (TransA == CblasTrans) trans = 0;
if (TransA == CblasConjNoTrans) trans = 3;
if (TransA == CblasConjTrans) trans = 2;
if (Diag == CblasUnit) unit = 0;
if (Diag == CblasNonUnit) unit = 1;
info = -1;
if (incx == 0) info = 8;
if (lda < MAX(1, n)) info = 6;
if (n < 0) info = 4;
if (unit < 0) info = 3;
if (trans < 0) info = 2;
if (uplo < 0) info = 1;
}
if (info >= 0) {
BLASFUNC(xerbla)(ERROR_NAME, &info, sizeof(ERROR_NAME));
return;
}
#endif
if (n == 0) return;
IDEBUG_START;
FUNCTION_PROFILE_START();
if (incx < 0 ) x -= (n - 1) * incx * 2;
buffer = (FLOAT *)blas_memory_alloc(1);
#ifdef SMPTEST
nthreads = num_cpu_avail(2);
if (nthreads == 1) {
#endif
(trmv[(trans<<2) | (uplo<<1) | unit])(n, a, lda, x, incx, buffer);
#ifdef SMPTEST
} else {
(trmv_thread[(trans<<2) | (uplo<<1) | unit])(n, a, lda, x, incx, buffer, nthreads);
}
#endif
blas_memory_free(buffer);
FUNCTION_PROFILE_END(4, n * n / 2 + n, n * n);
IDEBUG_END;
return;
}

216
interface/ztrsv.c Normal file
View File

@ -0,0 +1,216 @@
/*********************************************************************/
/* Copyright 2009, 2010 The University of Texas at Austin. */
/* All rights reserved. */
/* */
/* Redistribution and use in source and binary forms, with or */
/* without modification, are permitted provided that the following */
/* conditions are met: */
/* */
/* 1. Redistributions of source code must retain the above */
/* copyright notice, this list of conditions and the following */
/* disclaimer. */
/* */
/* 2. Redistributions in binary form must reproduce the above */
/* copyright notice, this list of conditions and the following */
/* disclaimer in the documentation and/or other materials */
/* provided with the distribution. */
/* */
/* THIS SOFTWARE IS PROVIDED BY THE UNIVERSITY OF TEXAS AT */
/* AUSTIN ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, */
/* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF */
/* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE */
/* DISCLAIMED. IN NO EVENT SHALL THE UNIVERSITY OF TEXAS AT */
/* AUSTIN OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, */
/* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES */
/* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE */
/* GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR */
/* BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF */
/* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT */
/* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT */
/* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE */
/* POSSIBILITY OF SUCH DAMAGE. */
/* */
/* The views and conclusions contained in the software and */
/* documentation are those of the authors and should not be */
/* interpreted as representing official policies, either expressed */
/* or implied, of The University of Texas at Austin. */
/*********************************************************************/
#include <stdio.h>
#include <ctype.h>
#include "common.h"
#ifdef FUNCTION_PROFILE
#include "functable.h"
#endif
#ifdef XDOUBLE
#define ERROR_NAME "XTRSV "
#elif defined(DOUBLE)
#define ERROR_NAME "ZTRSV "
#else
#define ERROR_NAME "CTRSV "
#endif
static int (*trsv[])(BLASLONG, FLOAT *, BLASLONG, FLOAT *, BLASLONG, void *) = {
#ifdef XDOUBLE
xtrsv_NUU, xtrsv_NUN, xtrsv_NLU, xtrsv_NLN,
xtrsv_TUU, xtrsv_TUN, xtrsv_TLU, xtrsv_TLN,
xtrsv_RUU, xtrsv_RUN, xtrsv_RLU, xtrsv_RLN,
xtrsv_CUU, xtrsv_CUN, xtrsv_CLU, xtrsv_CLN,
#elif defined(DOUBLE)
ztrsv_NUU, ztrsv_NUN, ztrsv_NLU, ztrsv_NLN,
ztrsv_TUU, ztrsv_TUN, ztrsv_TLU, ztrsv_TLN,
ztrsv_RUU, ztrsv_RUN, ztrsv_RLU, ztrsv_RLN,
ztrsv_CUU, ztrsv_CUN, ztrsv_CLU, ztrsv_CLN,
#else
ctrsv_NUU, ctrsv_NUN, ctrsv_NLU, ctrsv_NLN,
ctrsv_TUU, ctrsv_TUN, ctrsv_TLU, ctrsv_TLN,
ctrsv_RUU, ctrsv_RUN, ctrsv_RLU, ctrsv_RLN,
ctrsv_CUU, ctrsv_CUN, ctrsv_CLU, ctrsv_CLN,
#endif
};
#ifndef CBLAS
void NAME(char *UPLO, char *TRANS, char *DIAG,
blasint *N, FLOAT *a, blasint *LDA, FLOAT *x, blasint *INCX){
char uplo_arg = *UPLO;
char trans_arg = *TRANS;
char diag_arg = *DIAG;
blasint n = *N;
blasint lda = *LDA;
blasint incx = *INCX;
blasint info;
int uplo;
int unit;
int trans;
FLOAT *buffer;
PRINT_DEBUG_NAME;
TOUPPER(uplo_arg);
TOUPPER(trans_arg);
TOUPPER(diag_arg);
trans = -1;
unit = -1;
uplo = -1;
if (trans_arg == 'N') trans = 0;
if (trans_arg == 'T') trans = 1;
if (trans_arg == 'R') trans = 2;
if (trans_arg == 'C') trans = 3;
if (diag_arg == 'U') unit = 0;
if (diag_arg == 'N') unit = 1;
if (uplo_arg == 'U') uplo = 0;
if (uplo_arg == 'L') uplo = 1;
info = 0;
if (incx == 0) info = 8;
if (lda < MAX(1, n)) info = 6;
if (n < 0) info = 4;
if (unit < 0) info = 3;
if (trans < 0) info = 2;
if (uplo < 0) info = 1;
if (info != 0) {
BLASFUNC(xerbla)(ERROR_NAME, &info, sizeof(ERROR_NAME));
return;
}
#else
void CNAME(enum CBLAS_ORDER order, enum CBLAS_UPLO Uplo,
enum CBLAS_TRANSPOSE TransA, enum CBLAS_DIAG Diag,
blasint n, FLOAT *a, blasint lda, FLOAT *x, blasint incx) {
int trans, uplo, unit;
blasint info;
FLOAT *buffer;
PRINT_DEBUG_CNAME;
unit = -1;
uplo = -1;
trans = -1;
info = 0;
if (order == CblasColMajor) {
if (Uplo == CblasUpper) uplo = 0;
if (Uplo == CblasLower) uplo = 1;
if (TransA == CblasNoTrans) trans = 0;
if (TransA == CblasTrans) trans = 1;
if (TransA == CblasConjNoTrans) trans = 2;
if (TransA == CblasConjTrans) trans = 3;
if (Diag == CblasUnit) unit = 0;
if (Diag == CblasNonUnit) unit = 1;
info = -1;
if (incx == 0) info = 8;
if (lda < MAX(1, n)) info = 6;
if (n < 0) info = 4;
if (unit < 0) info = 3;
if (trans < 0) info = 2;
if (uplo < 0) info = 1;
}
if (order == CblasRowMajor) {
if (Uplo == CblasUpper) uplo = 1;
if (Uplo == CblasLower) uplo = 0;
if (TransA == CblasNoTrans) trans = 1;
if (TransA == CblasTrans) trans = 0;
if (TransA == CblasConjNoTrans) trans = 3;
if (TransA == CblasConjTrans) trans = 2;
if (Diag == CblasUnit) unit = 0;
if (Diag == CblasNonUnit) unit = 1;
info = -1;
if (incx == 0) info = 8;
if (lda < MAX(1, n)) info = 6;
if (n < 0) info = 4;
if (unit < 0) info = 3;
if (trans < 0) info = 2;
if (uplo < 0) info = 1;
}
if (info >= 0) {
BLASFUNC(xerbla)(ERROR_NAME, &info, sizeof(ERROR_NAME));
return;
}
#endif
if (n == 0) return;
IDEBUG_START;
FUNCTION_PROFILE_START();
if (incx < 0 ) x -= (n - 1) * incx * 2;
buffer = (FLOAT *)blas_memory_alloc(1);
(trsv[(trans<<2) | (uplo<<1) | unit])(n, a, lda, x, incx, buffer);
blas_memory_free(buffer);
FUNCTION_PROFILE_END(4, n * n / 2 + n, n * n);
IDEBUG_END;
return;
}

134
interface/ztrti2.c Normal file
View File

@ -0,0 +1,134 @@
/*********************************************************************/
/* Copyright 2009, 2010 The University of Texas at Austin. */
/* All rights reserved. */
/* */
/* Redistribution and use in source and binary forms, with or */
/* without modification, are permitted provided that the following */
/* conditions are met: */
/* */
/* 1. Redistributions of source code must retain the above */
/* copyright notice, this list of conditions and the following */
/* disclaimer. */
/* */
/* 2. Redistributions in binary form must reproduce the above */
/* copyright notice, this list of conditions and the following */
/* disclaimer in the documentation and/or other materials */
/* provided with the distribution. */
/* */
/* THIS SOFTWARE IS PROVIDED BY THE UNIVERSITY OF TEXAS AT */
/* AUSTIN ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, */
/* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF */
/* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE */
/* DISCLAIMED. IN NO EVENT SHALL THE UNIVERSITY OF TEXAS AT */
/* AUSTIN OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, */
/* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES */
/* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE */
/* GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR */
/* BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF */
/* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT */
/* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT */
/* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE */
/* POSSIBILITY OF SUCH DAMAGE. */
/* */
/* The views and conclusions contained in the software and */
/* documentation are those of the authors and should not be */
/* interpreted as representing official policies, either expressed */
/* or implied, of The University of Texas at Austin. */
/*********************************************************************/
#include <stdio.h>
#include "common.h"
#ifdef FUNCTION_PROFILE
#include "functable.h"
#endif
#ifdef XDOUBLE
#define ERROR_NAME "XTRTI2"
#elif defined(DOUBLE)
#define ERROR_NAME "ZTRTI2"
#else
#define ERROR_NAME "CTRTI2"
#endif
static blasint (*trti2[])(blas_arg_t *, BLASLONG *, BLASLONG *, FLOAT *, FLOAT *, BLASLONG) = {
#ifdef XDOUBLE
xtrti2_UU, xtrti2_UN, xtrti2_LU, xtrti2_LN,
#elif defined(DOUBLE)
ztrti2_UU, ztrti2_UN, ztrti2_LU, ztrti2_LN,
#else
ctrti2_UU, ctrti2_UN, ctrti2_LU, ctrti2_LN,
#endif
};
int NAME(char *UPLO, char *DIAG, blasint *N, FLOAT *a, blasint *ldA, blasint *Info){
blas_arg_t args;
blasint uplo_arg = *UPLO;
blasint diag_arg = *DIAG;
blasint uplo, diag;
blasint info;
FLOAT *buffer;
#ifdef PPC440
extern
#endif
FLOAT *sa, *sb;
PRINT_DEBUG_NAME;
args.n = *N;
args.a = (void *)a;
args.lda = *ldA;
TOUPPER(uplo_arg);
TOUPPER(diag_arg);
uplo = -1;
if (uplo_arg == 'U') uplo = 0;
if (uplo_arg == 'L') uplo = 1;
diag = -1;
if (diag_arg == 'U') diag = 0;
if (diag_arg == 'N') diag = 1;
info = 0;
if (args.lda < MAX(1,args.n)) info = 5;
if (args.n < 0) info = 3;
if (diag < 0) info = 2;
if (uplo < 0) info = 1;
if (info) {
BLASFUNC(xerbla)(ERROR_NAME, &info, sizeof(ERROR_NAME));
*Info = - info;
return 0;
}
*Info = 0;
if (args.n <= 0) return 0;
IDEBUG_START;
FUNCTION_PROFILE_START();
#ifndef PPC440
buffer = (FLOAT *)blas_memory_alloc(1);
sa = (FLOAT *)((BLASLONG)buffer + GEMM_OFFSET_A);
sb = (FLOAT *)(((BLASLONG)sa + ((GEMM_P * GEMM_Q * COMPSIZE * SIZE + GEMM_ALIGN) & ~GEMM_ALIGN)) + GEMM_OFFSET_B);
#endif
info = (trti2[(uplo << 1) | diag])(&args, NULL, NULL, sa, sb, 0);
*Info = info;
#ifndef PPC440
blas_memory_free(buffer);
#endif
FUNCTION_PROFILE_END(1, .5 * args.n * args.n,
2. * args.n * (1./3. + args.n * ( 1./2. + args.n * 1./6.))
+ 6. * args.n * (1./3. + args.n * (-1./2. + args.n * 1./6.)));
IDEBUG_END;
return 0;
}

154
interface/ztrtri.c Normal file
View File

@ -0,0 +1,154 @@
/*********************************************************************/
/* Copyright 2009, 2010 The University of Texas at Austin. */
/* All rights reserved. */
/* */
/* Redistribution and use in source and binary forms, with or */
/* without modification, are permitted provided that the following */
/* conditions are met: */
/* */
/* 1. Redistributions of source code must retain the above */
/* copyright notice, this list of conditions and the following */
/* disclaimer. */
/* */
/* 2. Redistributions in binary form must reproduce the above */
/* copyright notice, this list of conditions and the following */
/* disclaimer in the documentation and/or other materials */
/* provided with the distribution. */
/* */
/* THIS SOFTWARE IS PROVIDED BY THE UNIVERSITY OF TEXAS AT */
/* AUSTIN ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, */
/* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF */
/* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE */
/* DISCLAIMED. IN NO EVENT SHALL THE UNIVERSITY OF TEXAS AT */
/* AUSTIN OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, */
/* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES */
/* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE */
/* GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR */
/* BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF */
/* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT */
/* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT */
/* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE */
/* POSSIBILITY OF SUCH DAMAGE. */
/* */
/* The views and conclusions contained in the software and */
/* documentation are those of the authors and should not be */
/* interpreted as representing official policies, either expressed */
/* or implied, of The University of Texas at Austin. */
/*********************************************************************/
#include <stdio.h>
#include "common.h"
#ifdef FUNCTION_PROFILE
#include "functable.h"
#endif
#ifdef XDOUBLE
#define ERROR_NAME "XTRTRI"
#elif defined(DOUBLE)
#define ERROR_NAME "ZTRTRI"
#else
#define ERROR_NAME "CTRTRI"
#endif
static blasint (*trtri_single[])(blas_arg_t *, BLASLONG *, BLASLONG *, FLOAT *, FLOAT *, BLASLONG) ={
TRTRI_UU_SINGLE, TRTRI_UN_SINGLE, TRTRI_LU_SINGLE, TRTRI_LN_SINGLE,
};
#ifdef SMPTEST
static blasint (*trtri_parallel[])(blas_arg_t *, BLASLONG *, BLASLONG *, FLOAT *, FLOAT *, BLASLONG) ={
TRTRI_UU_PARALLEL, TRTRI_UN_PARALLEL, TRTRI_LU_PARALLEL, TRTRI_LN_PARALLEL,
};
#endif
int NAME(char *UPLO, char *DIAG, blasint *N, FLOAT *a, blasint *ldA, blasint *Info){
blas_arg_t args;
blasint uplo_arg = *UPLO;
blasint diag_arg = *DIAG;
blasint uplo, diag;
blasint info;
FLOAT *buffer;
#ifdef PPC440
extern
#endif
FLOAT *sa, *sb;
PRINT_DEBUG_NAME;
args.n = *N;
args.a = (void *)a;
args.lda = *ldA;
TOUPPER(uplo_arg);
TOUPPER(diag_arg);
uplo = -1;
if (uplo_arg == 'U') uplo = 0;
if (uplo_arg == 'L') uplo = 1;
diag = -1;
if (diag_arg == 'U') diag = 0;
if (diag_arg == 'N') diag = 1;
info = 0;
if (args.lda < MAX(1,args.n)) info = 5;
if (args.n < 0) info = 3;
if (diag < 0) info = 2;
if (uplo < 0) info = 1;
if (info) {
BLASFUNC(xerbla)(ERROR_NAME, &info, sizeof(ERROR_NAME));
*Info = - info;
return 0;
}
*Info = 0;
if (args.n == 0) return 0;
if (diag) {
if (AMIN_K(args.n, args.a, args.lda + 1) == ZERO) {
*Info = IAMIN_K(args.n, args.a, args.lda + 1);
return 0;
}
}
IDEBUG_START;
FUNCTION_PROFILE_START();
#ifndef PPC440
buffer = (FLOAT *)blas_memory_alloc(1);
sa = (FLOAT *)((BLASLONG)buffer + GEMM_OFFSET_A);
sb = (FLOAT *)(((BLASLONG)sa + ((GEMM_P * GEMM_Q * COMPSIZE * SIZE + GEMM_ALIGN) & ~GEMM_ALIGN)) + GEMM_OFFSET_B);
#endif
#ifdef SMPTEST
args.common = NULL;
args.nthreads = num_cpu_avail(4);
if (args.nthreads == 1) {
#endif
*Info = (trtri_single[(uplo << 1) | diag])(&args, NULL, NULL, sa, sb, 0);
#ifdef SMPTEST
} else {
*Info = (trtri_parallel[(uplo << 1) | diag])(&args, NULL, NULL, sa, sb, 0);
}
#endif
#ifndef PPC440
blas_memory_free(buffer);
#endif
FUNCTION_PROFILE_END(1, .5 * args.n * args.n,
2. * args.n * (1./3. + args.n * ( 1./2. + args.n * 1./6.))
+ 6. * args.n * (1./3. + args.n * (-1./2. + args.n * 1./6.)));
IDEBUG_END;
return 0;
}