From 29711dd5a35ea3ab23e9b71dbf83f574cd3a5dcd Mon Sep 17 00:00:00 2001 From: jagar Date: Wed, 13 Sep 2023 16:18:39 +0530 Subject: [PATCH] Gtestsuite: Updated testings_basics.* to print matrix/vector name AMD-Internal: [CPUPL-2732] Change-Id: I89b4ffc97ea852e66f42b82058af67c16144fbf6 --- .../inc/common/testing_basics.h | 4 ++- .../src/common/testing_basics.cpp | 27 ++++++++++--------- 2 files changed, 18 insertions(+), 13 deletions(-) diff --git a/gtestsuite/testinghelpers/inc/common/testing_basics.h b/gtestsuite/testinghelpers/inc/common/testing_basics.h index 46bcfeb4a..67e51254d 100644 --- a/gtestsuite/testinghelpers/inc/common/testing_basics.h +++ b/gtestsuite/testinghelpers/inc/common/testing_basics.h @@ -327,7 +327,7 @@ void make_triangular( char storage, char uplo, gtint_t n, T* a, gtint_t ld ); /** * ========================================================================== * MKDIAG - * Make an m x n matrix A, which adds a scalar value to + * Make an m x n matrix A, which adds a scalar value to * every element along an arbitrary diagonal of a matrix. * It is assumed that the diagonal offset of A is zero * ========================================================================== @@ -351,6 +351,7 @@ void print_scalar( T x, const char *spec ); /** * print vector of length n + * @param[in] vec specifies the vector name * @param[in] n specifies the length of the given vector. * @param[in] a specifies pointer which points to the first element of a. * @param[in] incx specifies storage spacing between elements of a. @@ -361,6 +362,7 @@ void print_vector( const char *vec, gtint_t n, T *x, gtint_t incx, const char *s /** * print matrix of size m x n + * @param[in] mat specifies the matrix name * @param[in] storage specifies the storage format of matrix in memory. * @param[in] m specifies the number of rows of given matrix. * @param[in] n specifies the number of columns of given matrix. diff --git a/gtestsuite/testinghelpers/src/common/testing_basics.cpp b/gtestsuite/testinghelpers/src/common/testing_basics.cpp index c7f8d50da..6f3c2b8f9 100644 --- a/gtestsuite/testinghelpers/src/common/testing_basics.cpp +++ b/gtestsuite/testinghelpers/src/common/testing_basics.cpp @@ -493,7 +493,7 @@ template void make_triangular( char, char, gtint_t, dcomplex *, gtint_ /** * ========================================================================== * MKDIAG - * Make an m x n matrix A, which adds a scalar value to + * Make an m x n matrix A, which adds a scalar value to * every element along an arbitrary diagonal of a matrix. * It is assumed that the diagonal offset of A is zero * ========================================================================== @@ -551,17 +551,18 @@ template void print_scalar( dcomplex x, const char * ); /** * print vector of length n + * @param[in] vec specifies the vector name * @param[in] n specifies the length of the given vector. * @param[in] a specifies pointer which points to the first element of a. * @param[in] incx specifies storage spacing between elements of a. * @param[in] spec specifies the format specifer. */ template -void print_vector( gtint_t n, T *x, gtint_t incx, const char *spec ) +void print_vector( const char *vec, gtint_t n, T *x, gtint_t incx, const char *spec ) { gtint_t i, idx; T val; - + std::cout << "Vector " << vec << std::endl; for ( i = 0; i < n; i++ ) { idx = (incx > 0) ? (i * incx) : ( - ( n - i - 1 ) * incx ); @@ -571,13 +572,14 @@ void print_vector( gtint_t n, T *x, gtint_t incx, const char *spec ) } printf( "\n\n" ); } -template void print_vector( gtint_t, float *, gtint_t, const char * ); -template void print_vector( gtint_t, double *, gtint_t, const char * ); -template void print_vector( gtint_t, scomplex *, gtint_t, const char * ); -template void print_vector( gtint_t, dcomplex *, gtint_t, const char * ); +template void print_vector( const char *vec, gtint_t, float *, gtint_t, const char * ); +template void print_vector( const char *vec, gtint_t, double *, gtint_t, const char * ); +template void print_vector( const char *vec, gtint_t, scomplex *, gtint_t, const char * ); +template void print_vector( const char *vec, gtint_t, dcomplex *, gtint_t, const char * ); /** * print matrix of size m x n + * @param[in] mat specifies the matrix name * @param[in] storage specifies the storage format of matrix in memory. * @param[in] m specifies the number of rows of given matrix. * @param[in] n specifies the number of columns of given matrix. @@ -586,7 +588,7 @@ template void print_vector( gtint_t, dcomplex *, gtint_t, const char * * @param[in] spec specifies the format specifer. */ template -void print_matrix( char storage, gtint_t m, gtint_t n, T *a, gtint_t ld, const char *spec ) +void print_matrix( const char *mat, char storage, gtint_t m, gtint_t n, T *a, gtint_t ld, const char *spec ) { gtint_t rs,cs; rs=cs=1; @@ -597,6 +599,7 @@ void print_matrix( char storage, gtint_t m, gtint_t n, T *a, gtint_t ld, const c rs = ld ; gtint_t i, j; + std::cout << "Matrix " << mat << std::endl; for ( i = 0; i < m; i++ ) { for ( j = 0; j < n; j++ ) @@ -609,10 +612,10 @@ void print_matrix( char storage, gtint_t m, gtint_t n, T *a, gtint_t ld, const c } printf( "\n" ); } -template void print_matrix( char, gtint_t, gtint_t, float *, gtint_t, const char * ); -template void print_matrix( char, gtint_t, gtint_t, double *, gtint_t, const char * ); -template void print_matrix( char, gtint_t, gtint_t, scomplex *, gtint_t, const char * ); -template void print_matrix( char, gtint_t, gtint_t, dcomplex *, gtint_t, const char * ); +template void print_matrix( const char *mat, char, gtint_t, gtint_t, float *, gtint_t, const char * ); +template void print_matrix( const char *mat, char, gtint_t, gtint_t, double *, gtint_t, const char * ); +template void print_matrix( const char *mat, char, gtint_t, gtint_t, scomplex *, gtint_t, const char * ); +template void print_matrix( const char *mat, char, gtint_t, gtint_t, dcomplex *, gtint_t, const char * ); /*