diff --git a/testing/testing_zauxiliary.c b/testing/testing_zauxiliary.c index cf2db1c2c4d82b719048ee84f87e470b1fe4668f..eebc0fe5d8cf7ffc3928eb0fc0ef6d14e7dc8213 100644 --- a/testing/testing_zauxiliary.c +++ b/testing/testing_zauxiliary.c @@ -28,10 +28,6 @@ #include <sys/resource.h> #endif #include <morse.h> -#undef REAL -#define COMPLEX -#undef SINGLE -#define DOUBLE #include "testing_zauxiliary.h" int IONE = 1; @@ -199,7 +195,7 @@ int main (int argc, char **argv) else if ( strcmp(func, "GEMM") == 0 ) { info += testing_zgemm( argc, argv ); } -#ifdef COMPLEX +#if defined(PRECISION_z) || defined(PRECISION_c) else if ( strcmp(func, "HEMM") == 0 ) { info += testing_zhemm( argc, argv ); } diff --git a/testing/testing_zgeadd.c b/testing/testing_zgeadd.c index b6744ecd6c286b62ce22bfa4eee48f6730121080..ae417b1f92e3f543b606a4d7e782c0fb1b3106f0 100644 --- a/testing/testing_zgeadd.c +++ b/testing/testing_zgeadd.c @@ -35,9 +35,6 @@ #include <mpi.h> #endif -#undef REAL -#define COMPLEX - static int check_tr_solution(MORSE_enum uplo, MORSE_enum trans, int M, int N, MORSE_Complex64_t alpha, MORSE_Complex64_t *A, int LDA, MORSE_Complex64_t beta, MORSE_Complex64_t *Bref, MORSE_Complex64_t *Bmorse, int LDB); @@ -105,7 +102,7 @@ int testing_zgeadd(int argc, char **argv) LAPACKE_zlarnv_work(IONE, ISEED, LDAxN, A); LAPACKE_zlarnv_work(IONE, ISEED, LDBxN, B); -#ifdef COMPLEX +#if defined(PRECISION_z) || defined(PRECISION_c) for (t=0; t<3; t++) { #else for (t=0; t<2; t++) { @@ -143,7 +140,7 @@ int testing_zgeadd(int argc, char **argv) LAPACKE_zlarnv_work(IONE, ISEED, LDAxN, A); LAPACKE_zlarnv_work(IONE, ISEED, LDBxN, B); -#ifdef COMPLEX +#if defined(PRECISION_z) || defined(PRECISION_c) for (t=0; t<3; t++) { #else for (t=0; t<2; t++) { diff --git a/testing/testing_zgels.c b/testing/testing_zgels.c index 51859d37cc0545a8fc6e06112450c34f64d074e1..1259502af39c374e83d1e28936c80cf804b9cb0f 100644 --- a/testing/testing_zgels.c +++ b/testing/testing_zgels.c @@ -34,9 +34,6 @@ #include <coreblas.h> #include "testing_zauxiliary.h" -#undef REAL -#define COMPLEX - enum blas_order_type { blas_rowmajor = 101, blas_colmajor = 102 }; diff --git a/testing/testing_zgels_hqr.c b/testing/testing_zgels_hqr.c index 97c32a77107601dfab5f3574f8a7cac8c1b88d3e..9583e541381557825e036aeff70040ca099372ed 100644 --- a/testing/testing_zgels_hqr.c +++ b/testing/testing_zgels_hqr.c @@ -30,9 +30,6 @@ #include <coreblas.h> #include "testing_zauxiliary.h" -#undef REAL -#define COMPLEX - static int check_orthogonality(int, int, int, MORSE_Complex64_t*, double); static int check_factorization(int, int, MORSE_Complex64_t*, MORSE_Complex64_t*, int, MORSE_Complex64_t*, double); static int check_solution(int, int, int, MORSE_Complex64_t*, int, MORSE_Complex64_t*, MORSE_Complex64_t*, int, double); diff --git a/testing/testing_zgels_systolic.c b/testing/testing_zgels_systolic.c index 9726b5a59ec7414566b0fa24e5070f8e14730bbf..600c3b142842caac9a54899dfbbe9b62c471558a 100644 --- a/testing/testing_zgels_systolic.c +++ b/testing/testing_zgels_systolic.c @@ -30,9 +30,6 @@ #include <coreblas.h> #include "testing_zauxiliary.h" -#undef REAL -#define COMPLEX - static int check_orthogonality(int, int, int, MORSE_Complex64_t*, double); static int check_factorization(int, int, MORSE_Complex64_t*, MORSE_Complex64_t*, int, MORSE_Complex64_t*, double); static int check_solution(int, int, int, MORSE_Complex64_t*, int, MORSE_Complex64_t*, MORSE_Complex64_t*, int, double); diff --git a/testing/testing_zgemm.c b/testing/testing_zgemm.c index ec2948c5154e2b2ca31ed5217b2305bf906a1e5d..44336fef78a4d24eb5a5fab8ababea132ba58492 100644 --- a/testing/testing_zgemm.c +++ b/testing/testing_zgemm.c @@ -35,9 +35,6 @@ #include <mpi.h> #endif -#undef REAL -#define COMPLEX - static int check_solution(MORSE_enum transA, MORSE_enum transB, int M, int N, int K, MORSE_Complex64_t alpha, MORSE_Complex64_t *A, int LDA, MORSE_Complex64_t *B, int LDB, @@ -113,7 +110,7 @@ int testing_zgemm(int argc, char **argv) LAPACKE_zlarnv_work(IONE, ISEED, LDBxN, B); LAPACKE_zlarnv_work(IONE, ISEED, LDCxN, C); -#ifdef COMPLEX +#if defined(PRECISION_z) || defined(PRECISION_c) for (ta=0; ta<3; ta++) { for (tb=0; tb<3; tb++) { #else diff --git a/testing/testing_zgeqrf_qdwh.c b/testing/testing_zgeqrf_qdwh.c index c669f21675c0641346203fd777fd6c31cb997bc5..6047451cb4d33e95b62f5f548dc8681d2a9f64cb 100644 --- a/testing/testing_zgeqrf_qdwh.c +++ b/testing/testing_zgeqrf_qdwh.c @@ -35,9 +35,6 @@ #include <coreblas/coreblas_z.h> #include "testing_zauxiliary.h" -#undef REAL -#define COMPLEX - static int check_orthogonality(int, int, const MORSE_Complex64_t*, int, double); static int check_factorization(int, int, const MORSE_Complex64_t*, int, const MORSE_Complex64_t*, int, MORSE_Complex64_t*, int, double); diff --git a/testing/testing_zher2k.c b/testing/testing_zher2k.c index f204121124770f6196afa46944be6ffec7ac609c..d53ba235ac23c1465b9a49435c1259d6e4d6cc5a 100644 --- a/testing/testing_zher2k.c +++ b/testing/testing_zher2k.c @@ -33,7 +33,7 @@ #include "testing_zauxiliary.h" static int check_solution(MORSE_enum uplo, MORSE_enum trans, int N, int K, - MORSE_Complex64_t alpha, MORSE_Complex64_t *A, int LDA, + MORSE_Complex64_t alpha, MORSE_Complex64_t *A, int LDA, MORSE_Complex64_t *B, int LDB, double beta, MORSE_Complex64_t *Cref, MORSE_Complex64_t *Cmorse, int LDC); @@ -112,12 +112,12 @@ int testing_zher2k(int argc, char **argv) memcpy(Cinit, C, LDCxN*sizeof(MORSE_Complex64_t)); memcpy(Cfinal, C, LDCxN*sizeof(MORSE_Complex64_t)); - + /* MORSE ZHER2K */ MORSE_zher2k(uplo[u], trans[t], N, K, alpha, A, LDA, B, LDB, beta, Cfinal, LDC); /* Check the solution */ - info_solution = check_solution(uplo[u], trans[t], N, K, + info_solution = check_solution(uplo[u], trans[t], N, K, alpha, A, LDA, B, LDB, beta, Cinit, Cfinal, LDC); if (info_solution == 0) { @@ -156,16 +156,16 @@ static int check_solution(MORSE_enum uplo, MORSE_enum trans, int N, int K, double *work = (double *)malloc(max(N, K)* sizeof(double)); beta_const = -1.0; - Anorm = LAPACKE_zlange_work(LAPACK_COL_MAJOR, 'I', - (trans == MorseNoTrans) ? N : K, + Anorm = LAPACKE_zlange_work(LAPACK_COL_MAJOR, 'I', + (trans == MorseNoTrans) ? N : K, (trans == MorseNoTrans) ? K : N, A, LDA, work); - Bnorm = LAPACKE_zlange_work(LAPACK_COL_MAJOR, 'I', - (trans == MorseNoTrans) ? N : K, + Bnorm = LAPACKE_zlange_work(LAPACK_COL_MAJOR, 'I', + (trans == MorseNoTrans) ? N : K, (trans == MorseNoTrans) ? K : N, B, LDB, work); Cinitnorm = LAPACKE_zlange_work(LAPACK_COL_MAJOR, 'I', N, N, Cref, LDC, work); Cmorsenorm = LAPACKE_zlange_work(LAPACK_COL_MAJOR, 'I', N, N, Cmorse, LDC, work); - cblas_zher2k(CblasColMajor, (CBLAS_UPLO)uplo, (CBLAS_TRANSPOSE)trans, + cblas_zher2k(CblasColMajor, (CBLAS_UPLO)uplo, (CBLAS_TRANSPOSE)trans, N, K, CBLAS_SADDR(alpha), A, LDA, B, LDB, (beta), Cref, LDC); Clapacknorm = LAPACKE_zlange_work(LAPACK_COL_MAJOR, 'I', N, N, Cref, LDC, work); @@ -175,7 +175,7 @@ static int check_solution(MORSE_enum uplo, MORSE_enum trans, int N, int K, Rnorm = LAPACKE_zlange_work(LAPACK_COL_MAJOR, 'I', N, N, Cref, LDC, work); eps = LAPACKE_dlamch_work('e'); - + printf("Rnorm %e, Anorm %e, Cinitnorm %e, Cmorsenorm %e, Clapacknorm %e\n", Rnorm, Anorm, Cinitnorm, Cmorsenorm, Clapacknorm); diff --git a/testing/testing_zlange.c b/testing/testing_zlange.c index 8921f7c0ed93d9bb65c1b6e183b42727ae4b345f..859393db9f6e3f775a9e69da22bf3fc3e29a39a3 100644 --- a/testing/testing_zlange.c +++ b/testing/testing_zlange.c @@ -31,9 +31,6 @@ #include <coreblas.h> #include "testing_zauxiliary.h" -#undef REAL -#define COMPLEX - int testing_zlange(int argc, char **argv) { int hres = 0; @@ -111,50 +108,50 @@ int testing_zlange(int argc, char **argv) } - #ifdef COMPLEX - /* MORSE ZLANTR */ - for(n=1; n<3; n++) { - for(u=0; u<2; u++) { - int d; - for(d=0; d<2; d++) { - normmorse = MORSE_zlantr(norm[n], uplo[u], diag[d], M, N, A, LDA); - normlapack = LAPACKE_zlantr_work(LAPACK_COL_MAJOR, morse_lapack_const(norm[n]), morse_lapack_const(uplo[u]), - morse_lapack_const(diag[d]), M, N, A, LDA, work); - printf("LAPACK %e, CHAMELEON %e\n", normlapack, normmorse); - - result = fabs(normmorse - normlapack) / (normlapack * eps); - switch(norm[n]) { - case MorseMaxNorm: - /* result should be perfectly equal */ - break; - case MorseInfNorm: - /* Sum order on the line can differ */ - result = result / (double)N; - break; - case MorseOneNorm: - /* Sum order on the column can differ */ - result = result / (double)M; - break; - case MorseFrobeniusNorm: - /* Sum oreder on every element can differ */ - result = result / ((double)M * (double)N); - break; - } - - printf("***************************************************\n"); - if ( result < 1. ) { - printf(" ---- TESTING ZLANTR (%s, %s, %s)......... PASSED !\n", - normstr[n], uplostr[u], diagstr[d]); - } - else { - printf(" - TESTING ZLANTR (%s, %s, %s)... FAILED !\n", - normstr[n], uplostr[u], diagstr[d]); - } - printf("***************************************************\n"); +#if defined(PRECISION_z) || defined(PRECISION_c) + /* MORSE ZLANTR */ + for(n=1; n<3; n++) { + for(u=0; u<2; u++) { + int d; + for(d=0; d<2; d++) { + normmorse = MORSE_zlantr(norm[n], uplo[u], diag[d], M, N, A, LDA); + normlapack = LAPACKE_zlantr_work(LAPACK_COL_MAJOR, morse_lapack_const(norm[n]), morse_lapack_const(uplo[u]), + morse_lapack_const(diag[d]), M, N, A, LDA, work); + printf("LAPACK %e, CHAMELEON %e\n", normlapack, normmorse); + + result = fabs(normmorse - normlapack) / (normlapack * eps); + switch(norm[n]) { + case MorseMaxNorm: + /* result should be perfectly equal */ + break; + case MorseInfNorm: + /* Sum order on the line can differ */ + result = result / (double)N; + break; + case MorseOneNorm: + /* Sum order on the column can differ */ + result = result / (double)M; + break; + case MorseFrobeniusNorm: + /* Sum oreder on every element can differ */ + result = result / ((double)M * (double)N); + break; } + + printf("***************************************************\n"); + if ( result < 1. ) { + printf(" ---- TESTING ZLANTR (%s, %s, %s)......... PASSED !\n", + normstr[n], uplostr[u], diagstr[d]); + } + else { + printf(" - TESTING ZLANTR (%s, %s, %s)... FAILED !\n", + normstr[n], uplostr[u], diagstr[d]); + } + printf("***************************************************\n"); } } - #endif + } +#endif /* MORSE ZLANSY */ for(n=0; n<4; n++) { @@ -193,51 +190,51 @@ int testing_zlange(int argc, char **argv) } } - #ifdef COMPLEX - /* MORSE ZLANHE */ - { - int j; - for (j=0; j<min(M,N); j++) { +#if defined(PRECISION_z) || defined(PRECISION_c) + /* MORSE ZLANHE */ + { + int j; + for (j=0; j<min(M,N); j++) { A[j*LDA+j] -= I*cimag(A[j*LDA+j]); - } } + } - for(n=0; n<4; n++) { - for(u=0; u<2; u++) { - normmorse = MORSE_zlanhe(norm[n], uplo[u], min(M,N), A, LDA); - normlapack = LAPACKE_zlanhe_work(LAPACK_COL_MAJOR, morse_lapack_const(norm[n]), morse_lapack_const(uplo[u]), min(M,N), A, LDA, work); - printf("LAPACK %e, CHAMELEON %e\n", normlapack, normmorse); + for(n=0; n<4; n++) { + for(u=0; u<2; u++) { + normmorse = MORSE_zlanhe(norm[n], uplo[u], min(M,N), A, LDA); + normlapack = LAPACKE_zlanhe_work(LAPACK_COL_MAJOR, morse_lapack_const(norm[n]), morse_lapack_const(uplo[u]), min(M,N), A, LDA, work); + printf("LAPACK %e, CHAMELEON %e\n", normlapack, normmorse); - result = fabs(normmorse - normlapack) / (normlapack * eps); - switch(norm[n]) { - case MorseMaxNorm: - /* result should be perfectly equal */ - break; - case MorseInfNorm: - /* Sum order on the line can differ */ - result = result / (double)N; - break; - case MorseOneNorm: - /* Sum order on the column can differ */ - result = result / (double)M; - break; - case MorseFrobeniusNorm: - /* Sum oreder on every element can differ */ - result = result / ((double)M * (double)N); - break; - } + result = fabs(normmorse - normlapack) / (normlapack * eps); + switch(norm[n]) { + case MorseMaxNorm: + /* result should be perfectly equal */ + break; + case MorseInfNorm: + /* Sum order on the line can differ */ + result = result / (double)N; + break; + case MorseOneNorm: + /* Sum order on the column can differ */ + result = result / (double)M; + break; + case MorseFrobeniusNorm: + /* Sum oreder on every element can differ */ + result = result / ((double)M * (double)N); + break; + } - printf("***************************************************\n"); - if ( result < 1. ) { - printf(" ---- TESTING ZLANHE (%s, %s)......... PASSED !\n", normstr[n], uplostr[u]); - } - else { - printf(" - TESTING ZLANHE (%s, %s)... FAILED !\n", normstr[n], uplostr[u]); - } - printf("***************************************************\n"); + printf("***************************************************\n"); + if ( result < 1. ) { + printf(" ---- TESTING ZLANHE (%s, %s)......... PASSED !\n", normstr[n], uplostr[u]); + } + else { + printf(" - TESTING ZLANHE (%s, %s)... FAILED !\n", normstr[n], uplostr[u]); } + printf("***************************************************\n"); } - #endif + } +#endif free(A); free(work); diff --git a/testing/testing_zpemv.c b/testing/testing_zpemv.c index a816862ddccb8d07a48fae948a98c1a025a7539d..9565e8e2f51be9a64c56e564a9c18ac7e123a67f 100644 --- a/testing/testing_zpemv.c +++ b/testing/testing_zpemv.c @@ -31,9 +31,6 @@ #include <coreblas.h> #include "testing_zauxiliary.h" -#define COMPLEX -#undef REAL - /*-------------------------------------------------------------- * Check the pemv */ @@ -164,7 +161,7 @@ int testing_zpemv(int argc, char **argv) } /* Colwise ConjTrans & Rowwise NoTrans */ -#ifdef COMPLEX +#if defined(PRECISION_z) || defined(PRECISION_c) for (t=0; t<3; t++) #else for (t=0; t<2; t++) diff --git a/testing/testing_zsyr2k.c b/testing/testing_zsyr2k.c index c4f1a8a4e80d16fd34309560aca2b8f7451cbf55..eec56cccfedb8b35720f6d483124a47aee7481e9 100644 --- a/testing/testing_zsyr2k.c +++ b/testing/testing_zsyr2k.c @@ -33,7 +33,7 @@ #include "testing_zauxiliary.h" static int check_solution(MORSE_enum uplo, MORSE_enum trans, int N, int K, - MORSE_Complex64_t alpha, MORSE_Complex64_t *A, int LDA, + MORSE_Complex64_t alpha, MORSE_Complex64_t *A, int LDA, MORSE_Complex64_t *B, int LDB, MORSE_Complex64_t beta, MORSE_Complex64_t *Cref, MORSE_Complex64_t *Cmorse, int LDC); @@ -112,12 +112,12 @@ int testing_zsyr2k(int argc, char **argv) memcpy(Cinit, C, LDCxN*sizeof(MORSE_Complex64_t)); memcpy(Cfinal, C, LDCxN*sizeof(MORSE_Complex64_t)); - + /* MORSE ZSYR2K */ MORSE_zsyr2k(uplo[u], trans[t], N, K, alpha, A, LDA, B, LDB, beta, Cfinal, LDC); /* Check the solution */ - info_solution = check_solution(uplo[u], trans[t], N, K, + info_solution = check_solution(uplo[u], trans[t], N, K, alpha, A, LDA, B, LDB, beta, Cinit, Cfinal, LDC); if (info_solution == 0) { @@ -156,16 +156,16 @@ static int check_solution(MORSE_enum uplo, MORSE_enum trans, int N, int K, double *work = (double *)malloc(max(N, K)* sizeof(double)); beta_const = -1.0; - Anorm = LAPACKE_zlange_work(LAPACK_COL_MAJOR, 'I', - (trans == MorseNoTrans) ? N : K, + Anorm = LAPACKE_zlange_work(LAPACK_COL_MAJOR, 'I', + (trans == MorseNoTrans) ? N : K, (trans == MorseNoTrans) ? K : N, A, LDA, work); - Bnorm = LAPACKE_zlange_work(LAPACK_COL_MAJOR, 'I', - (trans == MorseNoTrans) ? N : K, + Bnorm = LAPACKE_zlange_work(LAPACK_COL_MAJOR, 'I', + (trans == MorseNoTrans) ? N : K, (trans == MorseNoTrans) ? K : N, B, LDB, work); Cinitnorm = LAPACKE_zlange_work(LAPACK_COL_MAJOR, 'I', N, N, Cref, LDC, work); Cmorsenorm = LAPACKE_zlange_work(LAPACK_COL_MAJOR, 'I', N, N, Cmorse, LDC, work); - cblas_zsyr2k(CblasColMajor, (CBLAS_UPLO)uplo, (CBLAS_TRANSPOSE)trans, + cblas_zsyr2k(CblasColMajor, (CBLAS_UPLO)uplo, (CBLAS_TRANSPOSE)trans, N, K, CBLAS_SADDR(alpha), A, LDA, B, LDB, CBLAS_SADDR(beta), Cref, LDC); Clapacknorm = LAPACKE_zlange_work(LAPACK_COL_MAJOR, 'I', N, N, Cref, LDC, work); @@ -175,7 +175,7 @@ static int check_solution(MORSE_enum uplo, MORSE_enum trans, int N, int K, Rnorm = LAPACKE_zlange_work(LAPACK_COL_MAJOR, 'I', N, N, Cref, LDC, work); eps = LAPACKE_dlamch_work('e'); - + printf("Rnorm %e, Anorm %e, Cinitnorm %e, Cmorsenorm %e, Clapacknorm %e\n", Rnorm, Anorm, Cinitnorm, Cmorsenorm, Clapacknorm); diff --git a/testing/testing_ztrmm.c b/testing/testing_ztrmm.c index a6a0586354a3acfe2444f4853dcf31a3f3007a35..4d13517b7b68d0af16333d4e3162a5e5975cc3e1 100644 --- a/testing/testing_ztrmm.c +++ b/testing/testing_ztrmm.c @@ -32,9 +32,6 @@ #include <coreblas.h> #include "testing_zauxiliary.h" -#undef REAL -#define COMPLEX - static int check_solution(MORSE_enum side, MORSE_enum uplo, MORSE_enum trans, MORSE_enum diag, int M, int N, MORSE_Complex64_t alpha, MORSE_Complex64_t *A, int LDA, @@ -103,7 +100,7 @@ int testing_ztrmm(int argc, char **argv) for (s=0; s<2; s++) { for (u=0; u<2; u++) { -#ifdef COMPLEX +#if defined(PRECISION_z) || defined(PRECISION_c) for (t=0; t<3; t++) { #else for (t=0; t<2; t++) { diff --git a/testing/testing_ztrsm.c b/testing/testing_ztrsm.c index ba6110955e7575d89580bceb60f6c56fda42c126..4a19927360bcb76d6a1a7f30f07874a7933e23c1 100644 --- a/testing/testing_ztrsm.c +++ b/testing/testing_ztrsm.c @@ -32,9 +32,6 @@ #include <coreblas.h> #include "testing_zauxiliary.h" -#undef REAL -#define COMPLEX - static int check_solution(MORSE_enum side, MORSE_enum uplo, MORSE_enum trans, MORSE_enum diag, int M, int N, MORSE_Complex64_t alpha, MORSE_Complex64_t *A, int LDA, @@ -103,7 +100,7 @@ int testing_ztrsm(int argc, char **argv) for (s=0; s<2; s++) { for (u=0; u<2; u++) { -#ifdef COMPLEX +#if defined(PRECISION_z) || defined(PRECISION_c) for (t=0; t<3; t++) { #else for (t=0; t<2; t++) {