diff --git a/CMakeLists.txt b/CMakeLists.txt index 6b739aaa..36c36265 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -450,8 +450,6 @@ add_library( src/sygv.cc src/sygvd.cc src/sygvx.cc - src/symv.cc - src/syr.cc src/syrfs.cc src/syrfsx.cc src/sysv_aa.cc diff --git a/docs/doxygen/groups.dox b/docs/doxygen/groups.dox index c31aa8a8..72610c9f 100644 --- a/docs/doxygen/groups.dox +++ b/docs/doxygen/groups.dox @@ -111,16 +111,6 @@ @defgroup auxiliary Other auxiliary routines @} - ---------------------------------------------------------------------------- - @defgroup group_blas BLAS extensions in LAPACK - @{ - @defgroup symv symv: Symmetric matrix-vector multiply - @brief $y = \alpha Ax + \beta y$ - - @defgroup syr syr: Symmetric rank 1 update - @brief $A = \alpha xx^T + A$ - @} - ---------------------------------------------------------------------------- @defgroup group_test Test routines @{ diff --git a/include/lapack/config.h b/include/lapack/config.h index e85432fa..f1a5c37f 100644 --- a/include/lapack/config.h +++ b/include/lapack/config.h @@ -21,7 +21,7 @@ #else typedef int lapack_int; #endif - /* #define so that #ifdef works. */ + // #define so we can check later with #ifdef. #define lapack_int lapack_int #endif @@ -29,84 +29,49 @@ #define lapack_logical lapack_int #endif -/* f2c, hence MacOS Accelerate, returns double instead of float - * for sdot, slange, clange, etc. */ +// f2c, hence MacOS Accelerate (before 13.3), returns double instead of float +// for sdot, slange, clange, etc. +// LAPACKE's lapack.h is missing #define to protect against multiple +// definitions, so use lapackpp prefix. #if defined(BLAS_HAVE_ACCELERATE) || defined(BLAS_HAVE_F2C) - typedef double lapack_float_return; + typedef double lapackpp_float_return; #else - typedef float lapack_float_return; + typedef float lapackpp_float_return; #endif +// #define so we can check later with #ifdef. +#define lapackpp_float_return lapackpp_float_return -/* -------------------------------------------------------------------------- - * Complex types */ -#if defined(LAPACK_COMPLEX_CUSTOM) - /* If user defines LAPACK_COMPLEX_CUSTOM, then the user must define: - * lapack_complex_float - * lapack_complex_double - * lapack_complex_float_real(z) - * lapack_complex_float_imag(z) - * lapack_complex_double_real(z) - * lapack_complex_double_imag(z) - */ +//------------------------------------------------------------------------------ +// Complex types +#if defined( lapack_complex_float ) || defined( LAPACK_COMPLEX_CUSTOM ) + // LAPACKE's header may already define lapack_complex_float. Otherwise, + // if user defines LAPACK_COMPLEX_CUSTOM, then the user must define: + // lapack_complex_float + // lapack_complex_double #elif defined(LAPACK_COMPLEX_STRUCTURE) || defined(_MSC_VER) - - /* If user defines LAPACK_COMPLEX_STRUCTURE, then use a struct. - * Also use this for MSVC, as it has no C99 _Complex. - */ + // If user defines LAPACK_COMPLEX_STRUCTURE, then use a struct. + // Also use this for MSVC, as it has no C99 _Complex. typedef struct { float real, imag; } lapack_complex_float; typedef struct { double real, imag; } lapack_complex_double; - #define lapack_complex_float_real(z) ((z).real) - #define lapack_complex_float_imag(z) ((z).imag) - #define lapack_complex_double_real(z) ((z).real) - #define lapack_complex_double_imag(z) ((z).imag) #elif defined(LAPACK_COMPLEX_CPP) && defined(__cplusplus) - /* If user defines LAPACK_COMPLEX_CPP, then use C++ std::complex. - * This isn't compatible as a return type from extern C functions, - * so it may generate compiler warnings or errors. */ + // If user defines LAPACK_COMPLEX_CPP, then use C++ std::complex. + // This isn't compatible as a return type from extern C functions, + // so it may generate compiler warnings or errors. #include typedef std::complex lapack_complex_float; typedef std::complex lapack_complex_double; - #define lapack_complex_float_real(z) ((z).real()) - #define lapack_complex_float_imag(z) ((z).imag()) - #define lapack_complex_double_real(z) ((z).real()) - #define lapack_complex_double_imag(z) ((z).imag()) #else - - /* Otherwise, by default use C99 _Complex. */ + // Otherwise, by default use C99 _Complex. #include typedef float _Complex lapack_complex_float; typedef double _Complex lapack_complex_double; - #define lapack_complex_float_real(z) (creal(z)) - #define lapack_complex_float_imag(z) (cimag(z)) - #define lapack_complex_double_real(z) (creal(z)) - #define lapack_complex_double_imag(z) (cimag(z)) - #endif -/* define so we can check later with ifdef */ +// #define so we can check later with #ifdef. #define lapack_complex_float lapack_complex_float #define lapack_complex_double lapack_complex_double -#ifdef __cplusplus -extern "C" { -#endif /* __cplusplus */ - -lapack_complex_float lapack_make_complex_float( float re, float im ); -lapack_complex_double lapack_make_complex_double( double re, double im ); - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - -#ifndef LAPACK_malloc -#define LAPACK_malloc( size ) malloc( size ) -#endif - -#ifndef LAPACK_free -#define LAPACK_free( p ) free( p ) -#endif - -#endif /* LAPACK_CONFIG_H */ +#endif // LAPACK_CONFIG_H diff --git a/include/lapack/fortran.h b/include/lapack/fortran.h index bf73c123..fa9b94f4 100644 --- a/include/lapack/fortran.h +++ b/include/lapack/fortran.h @@ -15161,7 +15161,7 @@ void LAPACK_zlaswp( /* ----- general matrix norm */ #define LAPACK_slange_base LAPACK_GLOBAL( slange, SLANGE ) -lapack_float_return LAPACK_slange_base( +lapackpp_float_return LAPACK_slange_base( char const* norm, lapack_int const* m, lapack_int const* n, float const* a, lapack_int const* lda, @@ -15183,7 +15183,7 @@ double LAPACK_dlange_base( ); #define LAPACK_clange_base LAPACK_GLOBAL( clange, CLANGE ) -lapack_float_return LAPACK_clange_base( +lapackpp_float_return LAPACK_clange_base( char const* norm, lapack_int const* m, lapack_int const* n, lapack_complex_float const* a, lapack_int const* lda, @@ -15216,7 +15216,7 @@ double LAPACK_zlange_base( #endif #define LAPACK_slangb_base LAPACK_GLOBAL( slangb, SLANGB ) -lapack_float_return LAPACK_slangb_base( +lapackpp_float_return LAPACK_slangb_base( char const* norm, lapack_int const* n, lapack_int const* kl, lapack_int const* ku, float const* AB, lapack_int const* ldab, @@ -15238,7 +15238,7 @@ double LAPACK_dlangb_base( ); #define LAPACK_clangb_base LAPACK_GLOBAL( clangb, CLANGB ) -lapack_float_return LAPACK_clangb_base( +lapackpp_float_return LAPACK_clangb_base( char const* norm, lapack_int const* n, lapack_int const* kl, lapack_int const* ku, lapack_complex_float const* AB, lapack_int const* ldab, @@ -15271,7 +15271,7 @@ double LAPACK_zlangb_base( #endif #define LAPACK_slangt_base LAPACK_GLOBAL( slangt, SLANGT ) -lapack_float_return LAPACK_slangt_base( +lapackpp_float_return LAPACK_slangt_base( char const* norm, lapack_int const* n, float const* DL, float const* D, @@ -15293,7 +15293,7 @@ double LAPACK_dlangt_base( ); #define LAPACK_clangt_base LAPACK_GLOBAL( clangt, CLANGT ) -lapack_float_return LAPACK_clangt_base( +lapackpp_float_return LAPACK_clangt_base( char const* norm, lapack_int const* n, lapack_complex_float const* DL, lapack_complex_float const* D, @@ -15327,7 +15327,7 @@ double LAPACK_zlangt_base( /* ----- Hessenberg matrix norm */ #define LAPACK_slanhs_base LAPACK_GLOBAL( slanhs, SLANHS ) -lapack_float_return LAPACK_slanhs_base( +lapackpp_float_return LAPACK_slanhs_base( char const* norm, lapack_int const* n, float const* A, lapack_int const* lda, @@ -15349,7 +15349,7 @@ double LAPACK_dlanhs_base( ); #define LAPACK_clanhs_base LAPACK_GLOBAL( clanhs, CLANHS ) -lapack_float_return LAPACK_clanhs_base( +lapackpp_float_return LAPACK_clanhs_base( char const* norm, lapack_int const* n, lapack_complex_float const* A, lapack_int const* lda, @@ -15383,7 +15383,7 @@ double LAPACK_zlanhs_base( /* ----- Hermitian matrix norm */ #define LAPACK_clanhe_base LAPACK_GLOBAL( clanhe, CLANHE ) -lapack_float_return LAPACK_clanhe_base( +lapackpp_float_return LAPACK_clanhe_base( char const* norm, char const* uplo, lapack_int const* n, lapack_complex_float const* a, lapack_int const* lda, @@ -15412,7 +15412,7 @@ double LAPACK_zlanhe_base( #endif #define LAPACK_clanhp_base LAPACK_GLOBAL( clanhp, CLANHP ) -lapack_float_return LAPACK_clanhp_base( +lapackpp_float_return LAPACK_clanhp_base( char const* norm, char const* uplo, lapack_int const* n, lapack_complex_float const* AP, @@ -15441,7 +15441,7 @@ double LAPACK_zlanhp_base( #endif #define LAPACK_clanhb_base LAPACK_GLOBAL( clanhb, CLANHB ) -lapack_float_return LAPACK_clanhb_base( +lapackpp_float_return LAPACK_clanhb_base( char const* norm, char const* uplo, lapack_int const* n, lapack_int const* kd, lapack_complex_float const* AB, lapack_int const* ldab, @@ -15470,7 +15470,7 @@ double LAPACK_zlanhb_base( #endif #define LAPACK_clanht_base LAPACK_GLOBAL( clanht, CLANHT ) -lapack_float_return LAPACK_clanht_base( +lapackpp_float_return LAPACK_clanht_base( char const* norm, lapack_int const* n, float const* D, lapack_complex_float const* E @@ -15498,7 +15498,7 @@ double LAPACK_zlanht_base( /* ----- symmetric matrix norm */ #define LAPACK_slansy_base LAPACK_GLOBAL( slansy, SLANSY ) -lapack_float_return LAPACK_slansy_base( +lapackpp_float_return LAPACK_slansy_base( char const* norm, char const* uplo, lapack_int const* n, float const* a, lapack_int const* lda, @@ -15520,7 +15520,7 @@ double LAPACK_dlansy_base( ); #define LAPACK_clansy_base LAPACK_GLOBAL( clansy, CLANSY ) -lapack_float_return LAPACK_clansy_base( +lapackpp_float_return LAPACK_clansy_base( char const* norm, char const* uplo, lapack_int const* n, lapack_complex_float const* a, lapack_int const* lda, @@ -15553,7 +15553,7 @@ double LAPACK_zlansy_base( #endif #define LAPACK_slansp_base LAPACK_GLOBAL( slansp, SLANSP ) -lapack_float_return LAPACK_slansp_base( +lapackpp_float_return LAPACK_slansp_base( char const* norm, char const* uplo, lapack_int const* n, float const* AP, @@ -15575,7 +15575,7 @@ double LAPACK_dlansp_base( ); #define LAPACK_clansp_base LAPACK_GLOBAL( clansp, CLANSP ) -lapack_float_return LAPACK_clansp_base( +lapackpp_float_return LAPACK_clansp_base( char const* norm, char const* uplo, lapack_int const* n, lapack_complex_float const* AP, @@ -15608,7 +15608,7 @@ double LAPACK_zlansp_base( #endif #define LAPACK_slansb_base LAPACK_GLOBAL( slansb, SLANSB ) -lapack_float_return LAPACK_slansb_base( +lapackpp_float_return LAPACK_slansb_base( char const* norm, char const* uplo, lapack_int const* n, lapack_int const* kd, float const* AB, lapack_int const* ldab, @@ -15630,7 +15630,7 @@ double LAPACK_dlansb_base( ); #define LAPACK_clansb_base LAPACK_GLOBAL( clansb, CLANSB ) -lapack_float_return LAPACK_clansb_base( +lapackpp_float_return LAPACK_clansb_base( char const* norm, char const* uplo, lapack_int const* n, lapack_int const* kd, lapack_complex_float const* AB, lapack_int const* ldab, @@ -15663,7 +15663,7 @@ double LAPACK_zlansb_base( #endif #define LAPACK_slanst_base LAPACK_GLOBAL( slanst, SLANST ) -lapack_float_return LAPACK_slanst_base( +lapackpp_float_return LAPACK_slanst_base( char const* norm, lapack_int const* n, float const* D, float const* E @@ -15691,7 +15691,7 @@ double LAPACK_dlanst_base( /* ----- triangular matrix norm */ #define LAPACK_slantr_base LAPACK_GLOBAL( slantr, SLANTR ) -lapack_float_return LAPACK_slantr_base( +lapackpp_float_return LAPACK_slantr_base( char const* norm, char const* uplo, char const* diag, lapack_int const* m, lapack_int const* n, @@ -15715,7 +15715,7 @@ double LAPACK_dlantr_base( ); #define LAPACK_clantr_base LAPACK_GLOBAL( clantr, CLANTR ) -lapack_float_return LAPACK_clantr_base( +lapackpp_float_return LAPACK_clantr_base( char const* norm, char const* uplo, char const* diag, lapack_int const* m, lapack_int const* n, @@ -15750,7 +15750,7 @@ double LAPACK_zlantr_base( #endif #define LAPACK_slantp_base LAPACK_GLOBAL( slantp, SLANTP ) -lapack_float_return LAPACK_slantp_base( +lapackpp_float_return LAPACK_slantp_base( char const* norm, char const* uplo, char const* diag, lapack_int const* n, float const* AP, @@ -15772,7 +15772,7 @@ double LAPACK_dlantp_base( ); #define LAPACK_clantp_base LAPACK_GLOBAL( clantp, CLANTP ) -lapack_float_return LAPACK_clantp_base( +lapackpp_float_return LAPACK_clantp_base( char const* norm, char const* uplo, char const* diag, lapack_int const* n, lapack_complex_float const* AP, @@ -15805,7 +15805,7 @@ double LAPACK_zlantp_base( #endif #define LAPACK_slantb_base LAPACK_GLOBAL( slantb, SLANTB ) -lapack_float_return LAPACK_slantb_base( +lapackpp_float_return LAPACK_slantb_base( char const* norm, char const* uplo, char const* diag, lapack_int const* n, lapack_int const* k, float const* AB, lapack_int const* ldab, @@ -15827,7 +15827,7 @@ double LAPACK_dlantb_base( ); #define LAPACK_clantb_base LAPACK_GLOBAL( clantb, CLANTB ) -lapack_float_return LAPACK_clantb_base( +lapackpp_float_return LAPACK_clantb_base( char const* norm, char const* uplo, char const* diag, lapack_int const* n, lapack_int const* k, lapack_complex_float const* AB, lapack_int const* ldab, @@ -15861,7 +15861,7 @@ double LAPACK_zlantb_base( /* ----- machine properties */ #define LAPACK_slamch_base LAPACK_GLOBAL( slamch, SLAMCH ) -lapack_float_return LAPACK_slamch_base( +lapackpp_float_return LAPACK_slamch_base( char const* cmach #ifdef LAPACK_FORTRAN_STRLEN_END , size_t cmach_len @@ -16734,13 +16734,13 @@ void LAPACK_zlapmt( /* ----- sqrt( x^2 + y^2 ) and sqrt( x^2 + y^2 + z^2 ) */ #define LAPACK_slapy2 LAPACK_GLOBAL( slapy2, SLAPY2 ) -lapack_float_return LAPACK_slapy2( +lapackpp_float_return LAPACK_slapy2( float const* x, float const* y ); #define LAPACK_dlapy2 LAPACK_GLOBAL( dlapy2, DLAPY2 ) double LAPACK_dlapy2( double const* x, double const* y ); #define LAPACK_slapy3 LAPACK_GLOBAL( slapy3, SLAPY3 ) -lapack_float_return LAPACK_slapy3( +lapackpp_float_return LAPACK_slapy3( float const* x, float const* y, float const* z ); #define LAPACK_dlapy3 LAPACK_GLOBAL( dlapy3, DLAPY3 ) double LAPACK_dlapy3( @@ -16784,75 +16784,6 @@ void LAPACK_dlartgs( double const* x, double const* y, double const* sigma, double* cs, double* sn ); -/* ----- symmetric rank-1 update, addition to BLAS */ -#define LAPACK_csyr_base LAPACK_GLOBAL( csyr, CSYR ) -void LAPACK_csyr_base( - char const* uplo, - lapack_int const* n, - lapack_complex_float const* alpha, - lapack_complex_float const* x, lapack_int const* incx, - lapack_complex_float* a, lapack_int const* lda - #ifdef LAPACK_FORTRAN_STRLEN_END - , size_t uplo_len - #endif - ); - -#define LAPACK_zsyr_base LAPACK_GLOBAL( zsyr, ZSYR ) -void LAPACK_zsyr_base( - char const* uplo, - lapack_int const* n, - lapack_complex_double const* alpha, - lapack_complex_double const* x, lapack_int const* incx, - lapack_complex_double* a, lapack_int const* lda - #ifdef LAPACK_FORTRAN_STRLEN_END - , size_t uplo_len - #endif - ); -#ifdef LAPACK_FORTRAN_STRLEN_END - #define LAPACK_csyr( ... ) LAPACK_csyr_base( __VA_ARGS__, 1 ) - #define LAPACK_zsyr( ... ) LAPACK_zsyr_base( __VA_ARGS__, 1 ) -#else - #define LAPACK_csyr( ... ) LAPACK_csyr_base( __VA_ARGS__ ) - #define LAPACK_zsyr( ... ) LAPACK_zsyr_base( __VA_ARGS__ ) -#endif - -/* symv, moved from BLAS++ */ -#define LAPACK_csymv_base LAPACK_GLOBAL(csymv, CSYMV) -void LAPACK_csymv_base( - char const* uplo, - lapack_int const* n, - lapack_complex_float const* alpha, - lapack_complex_float const* A, lapack_int const* lda, - lapack_complex_float const* x, lapack_int const* incx, - lapack_complex_float const* beta, - lapack_complex_float* y, lapack_int const* incy - #ifdef LAPACK_FORTRAN_STRLEN_END - , size_t uplo_len - #endif - ); - - -#define LAPACK_zsymv_base LAPACK_GLOBAL(zsymv, ZSYMV) -void LAPACK_zsymv_base( - char const* uplo, - lapack_int const* n, - lapack_complex_double const* alpha, - lapack_complex_double const* A, lapack_int const* lda, - lapack_complex_double const* x, lapack_int const* incx, - lapack_complex_double const* beta, - lapack_complex_double* y, lapack_int const* incy - #ifdef LAPACK_FORTRAN_STRLEN_END - , size_t uplo_len - #endif - ); -#ifdef LAPACK_FORTRAN_STRLEN_END - #define LAPACK_csymv( ... ) LAPACK_csymv_base( __VA_ARGS__, 1 ) - #define LAPACK_zsymv( ... ) LAPACK_zsymv_base( __VA_ARGS__, 1 ) -#else - #define LAPACK_csymv( ... ) LAPACK_csymv_base( __VA_ARGS__ ) - #define LAPACK_zsymv( ... ) LAPACK_zsymv_base( __VA_ARGS__ ) -#endif - /* ----- LAPACK version number */ #define LAPACK_ilaver LAPACK_GLOBAL( ilaver, ILAVER ) void LAPACK_ilaver( diff --git a/include/lapack/wrappers.hh b/include/lapack/wrappers.hh index b207d7aa..fdc97ef0 100644 --- a/include/lapack/wrappers.hh +++ b/include/lapack/wrappers.hh @@ -8118,45 +8118,6 @@ inline int64_t hegvx( return sygvx( itype, jobz, range, uplo, n, A, lda, B, ldb, vl, vu, il, iu, abstol, m, W, Z, ldz, ifail ); } -// ----------------------------------------------------------------------------- -} // end namespace lapack -namespace blas { - -void syr( - blas::Layout layout, - blas::Uplo uplo, int64_t n, std::complex alpha, - std::complex const* X, int64_t incx, - std::complex* A, int64_t lda ); - -void syr( - blas::Layout layout, - blas::Uplo uplo, int64_t n, std::complex alpha, - std::complex const* X, int64_t incx, - std::complex* A, int64_t lda ); - -void symv( - blas::Layout layout, - blas::Uplo uplo, - int64_t n, - std::complex alpha, - std::complex const *A, int64_t lda, - std::complex const *x, int64_t incx, - std::complex beta, - std::complex *y, int64_t incy ); - -void symv( - blas::Layout layout, - blas::Uplo uplo, - int64_t n, - std::complex alpha, - std::complex const*A, int64_t lda, - std::complex const *x, int64_t incx, - std::complex beta, - std::complex *y, int64_t incy ); - -} // end namespace blas -namespace lapack { - // ----------------------------------------------------------------------------- int64_t syrfs( lapack::Uplo uplo, int64_t n, int64_t nrhs, diff --git a/src/symv.cc b/src/symv.cc deleted file mode 100644 index fd5dc0d3..00000000 --- a/src/symv.cc +++ /dev/null @@ -1,105 +0,0 @@ -// Copyright (c) 2017-2023, University of Tennessee. All rights reserved. -// SPDX-License-Identifier: BSD-3-Clause -// This program is free software: you can redistribute it and/or modify it under -// the terms of the BSD 3-Clause license. See the accompanying LICENSE file. - -// -// ----------------------------------------------------------------------------- - -#include "lapack/fortran.h" -#include "lapack.hh" -#include "lapack_internal.hh" - -#include - -namespace blas { - -// ============================================================================= -// Overloaded wrappers for c, z precisions. - - -/// @ingroup symv -void symv( - blas::Layout layout, - blas::Uplo uplo, - int64_t n, - std::complex alpha, - std::complex const *A, int64_t lda, - std::complex const *x, int64_t incx, - std::complex beta, - std::complex *y, int64_t incy ) -{ - // check arguments - lapack_error_if( layout != Layout::ColMajor && - layout != Layout::RowMajor ); - lapack_error_if( uplo != Uplo::Upper && - uplo != Uplo::Lower ); - lapack_error_if( n < 0 ); - lapack_error_if( lda < n ); - lapack_error_if( incx == 0 ); - lapack_error_if( incy == 0 ); - - lapack_int n_ = to_lapack_int( n ); - lapack_int lda_ = to_lapack_int( lda ); - lapack_int incx_ = to_lapack_int( incx ); - lapack_int incy_ = to_lapack_int( incy ); - - if (layout == Layout::RowMajor) { - // swap lower <=> upper - uplo = (uplo == Uplo::Lower ? Uplo::Upper : Uplo::Lower); - } - - char uplo_ = to_char( uplo ); - LAPACK_csymv( &uplo_, &n_, - (lapack_complex_float*) &alpha, - (lapack_complex_float*) A, &lda_, - (lapack_complex_float*) x, &incx_, - (lapack_complex_float*) &beta, - (lapack_complex_float*) y, &incy_ - ); -} - -// ----------------------------------------------------------------------------- -/// @ingroup symv -void symv( - blas::Layout layout, - blas::Uplo uplo, - int64_t n, - std::complex alpha, - std::complex const *A, int64_t lda, - std::complex const *x, int64_t incx, - std::complex beta, - std::complex *y, int64_t incy ) -{ - // check arguments - lapack_error_if( layout != Layout::ColMajor && - layout != Layout::RowMajor ); - lapack_error_if( uplo != Uplo::Upper && - uplo != Uplo::Lower ); - lapack_error_if( n < 0 ); - lapack_error_if( lda < n ); - lapack_error_if( incx == 0 ); - lapack_error_if( incy == 0 ); - - lapack_int n_ = to_lapack_int( n ); - lapack_int lda_ = to_lapack_int( lda ); - lapack_int incx_ = to_lapack_int( incx ); - lapack_int incy_ = to_lapack_int( incy ); - - if (layout == Layout::RowMajor) { - // swap lower <=> upper - uplo = (uplo == Uplo::Lower ? Uplo::Upper : Uplo::Lower); - } - - char uplo_ = to_char( uplo ); - LAPACK_zsymv( &uplo_, &n_, - (lapack_complex_double*) &alpha, - (lapack_complex_double*) A, &lda_, - (lapack_complex_double*) x, &incx_, - (lapack_complex_double*) &beta, - (lapack_complex_double*) y, &incy_ - ); -} - -} // namespace blas - diff --git a/src/syr.cc b/src/syr.cc deleted file mode 100644 index d43f41bd..00000000 --- a/src/syr.cc +++ /dev/null @@ -1,90 +0,0 @@ -// Copyright (c) 2017-2023, University of Tennessee. All rights reserved. -// SPDX-License-Identifier: BSD-3-Clause -// This program is free software: you can redistribute it and/or modify it under -// the terms of the BSD 3-Clause license. See the accompanying LICENSE file. - -#include "lapack.hh" -#include "lapack_internal.hh" -#include "lapack/fortran.h" - -// while [cz]syr are in LAPACK, [sd]syr are in BLAS, -// so we put them all in the blas namespace -namespace blas { - -using blas::max; -using blas::min; -using blas::real; - -// ----------------------------------------------------------------------------- -/// @ingroup syr -void syr( - blas::Layout layout, - blas::Uplo uplo, - int64_t n, - std::complex alpha, - std::complex const *x, int64_t incx, - std::complex *A, int64_t lda ) -{ - // check arguments - lapack_error_if( layout != Layout::ColMajor && - layout != Layout::RowMajor ); - lapack_error_if( uplo != Uplo::Lower && - uplo != Uplo::Upper ); - lapack_error_if( n < 0 ); - lapack_error_if( lda < n ); - lapack_error_if( incx == 0 ); - - lapack_int n_ = to_lapack_int( n ); - lapack_int lda_ = to_lapack_int( lda ); - lapack_int incx_ = to_lapack_int( incx ); - - if (layout == Layout::RowMajor) { - // swap lower <=> upper - uplo = (uplo == Uplo::Lower ? Uplo::Upper : Uplo::Lower); - } - - char uplo_ = to_char( uplo ); - LAPACK_csyr( &uplo_, &n_, - (lapack_complex_float*) &alpha, - (lapack_complex_float*) x, &incx_, - (lapack_complex_float*) A, &lda_ - ); -} - -// ----------------------------------------------------------------------------- -/// @ingroup syr -void syr( - blas::Layout layout, - blas::Uplo uplo, - int64_t n, - std::complex alpha, - std::complex const *x, int64_t incx, - std::complex *A, int64_t lda ) -{ - // check arguments - lapack_error_if( layout != Layout::ColMajor && - layout != Layout::RowMajor ); - lapack_error_if( uplo != Uplo::Lower && - uplo != Uplo::Upper ); - lapack_error_if( n < 0 ); - lapack_error_if( lda < n ); - lapack_error_if( incx == 0 ); - - lapack_int n_ = to_lapack_int( n ); - lapack_int lda_ = to_lapack_int( lda ); - lapack_int incx_ = to_lapack_int( incx ); - - if (layout == Layout::RowMajor) { - // swap lower <=> upper - uplo = (uplo == Uplo::Lower ? Uplo::Upper : Uplo::Lower); - } - - char uplo_ = to_char( uplo ); - LAPACK_zsyr( &uplo_, &n_, - (lapack_complex_double*) &alpha, - (lapack_complex_double*) x, &incx_, - (lapack_complex_double*) A, &lda_ - ); -} - -} // namespace blas diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 17f60457..1b67a8a3 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -186,7 +186,6 @@ add_executable( test_sptrs.cc test_sturm.cc test_sycon.cc - test_syr.cc test_syrfs.cc test_sysv.cc test_sysv_aa.cc @@ -220,7 +219,6 @@ add_executable( test_tpqrt.cc test_tpqrt2.cc test_tprfb.cc - test_symv.cc test_larfy.cc ) diff --git a/test/cblas_wrappers.cc b/test/cblas_wrappers.cc index abc15790..84c24aa9 100644 --- a/test/cblas_wrappers.cc +++ b/test/cblas_wrappers.cc @@ -9,109 +9,3 @@ #include "cblas_wrappers.hh" #include - -// ----------------------------------------------------------------------------- -void -cblas_symv( - CBLAS_LAYOUT layout, - CBLAS_UPLO uplo, - int n, - std::complex alpha, - std::complex const* A, int lda, - std::complex const* x, int incx, - std::complex beta, - std::complex* yref, int incy ) -{ - lapack_int n_ = lapack_int( n ); - lapack_int incx_ = lapack_int( incx ); - lapack_int incy_ = lapack_int( incy ); - lapack_int lda_ = lapack_int( lda ); - char uplo_ = lapack_uplo_const( uplo ); - if (layout == CblasRowMajor) { - uplo_ = (uplo == CblasUpper ? 'l' : 'u'); // switch upper <=> lower - } - LAPACK_csymv( - &uplo_, &n_, - (lapack_complex_float*) &alpha, - (lapack_complex_float*) A, &lda_, - (lapack_complex_float*) x, &incx_, - (lapack_complex_float*) &beta, - (lapack_complex_float*) yref, &incy_ - ); -} - -// ----------------------------------------------------------------------------- -void -cblas_symv( - CBLAS_LAYOUT layout, - CBLAS_UPLO uplo, - int n, - std::complex alpha, - std::complex const* A, int lda, - std::complex const* x, int incx, - std::complex beta, - std::complex* yref, int incy ) -{ - lapack_int n_ = lapack_int( n ); - lapack_int incx_ = lapack_int( incx ); - lapack_int incy_ = lapack_int( incy ); - lapack_int lda_ = lapack_int( lda ); - char uplo_ = lapack_uplo_const( uplo ); - if (layout == CblasRowMajor) { - uplo_ = (uplo == CblasUpper ? 'l' : 'u'); // switch upper <=> lower - } - LAPACK_zsymv( - &uplo_, &n_, - (lapack_complex_double*) &alpha, - (lapack_complex_double*) A, &lda_, - (lapack_complex_double*) x, &incx_, - (lapack_complex_double*) &beta, - (lapack_complex_double*) yref, &incy_ - ); -} - -// ----------------------------------------------------------------------------- -void -cblas_syr( - CBLAS_LAYOUT layout, CBLAS_UPLO uplo, int n, - std::complex alpha, - std::complex const *x, int incx, - std::complex* A, int lda ) -{ - lapack_int n_ = lapack_int( n ); - lapack_int incx_ = lapack_int( incx ); - lapack_int lda_ = lapack_int( lda ); - char uplo_ = lapack_uplo_const( uplo ); - if (layout == CblasRowMajor) { - uplo_ = (uplo == CblasUpper ? 'l' : 'u'); // switch upper <=> lower - } - LAPACK_csyr( - &uplo_, &n_, - (lapack_complex_float*) &alpha, - (lapack_complex_float*) x, &incx_, - (lapack_complex_float*) A, &lda_ - ); -} - -// ----------------------------------------------------------------------------- -void -cblas_syr( - CBLAS_LAYOUT layout, CBLAS_UPLO uplo, int n, - std::complex alpha, - std::complex const *x, int incx, - std::complex* A, int lda ) -{ - lapack_int n_ = lapack_int( n ); - lapack_int incx_ = lapack_int( incx ); - lapack_int lda_ = lapack_int( lda ); - char uplo_ = lapack_uplo_const( uplo ); - if (layout == CblasRowMajor) { - uplo_ = (uplo == CblasUpper ? 'l' : 'u'); // switch upper <=> lower - } - LAPACK_zsyr( - &uplo_, &n_, - (lapack_complex_double*) &alpha, - (lapack_complex_double*) x, &incx_, - (lapack_complex_double*) A, &lda_ - ); -} diff --git a/test/cblas_wrappers.hh b/test/cblas_wrappers.hh index 38a49c59..f2924c57 100644 --- a/test/cblas_wrappers.hh +++ b/test/cblas_wrappers.hh @@ -200,92 +200,6 @@ inline char lapack_uplo_const( CBLAS_UPLO uplo ) // ============================================================================= // Level 2 BLAS -// ----------------------------------------------------------------------------- -inline void -cblas_symv( - CBLAS_LAYOUT layout, CBLAS_UPLO uplo, int n, - float alpha, - float const *A, int lda, - float const *x, int incx, - float beta, - float* y, int incy ) -{ - cblas_ssymv( layout, uplo, n, - alpha, A, lda, x, incx, beta, y, incy ); -} - -inline void -cblas_symv( - CBLAS_LAYOUT layout, CBLAS_UPLO uplo, int n, - double alpha, - double const *A, int lda, - double const *x, int incx, - double beta, - double* y, int incy ) -{ - cblas_dsymv( layout, uplo, n, - alpha, A, lda, x, incx, beta, y, incy ); -} - -// LAPACK provides [cz]symv, CBLAS lacks them -void -cblas_symv( - CBLAS_LAYOUT layout, - CBLAS_UPLO uplo, - int n, - std::complex alpha, - std::complex const* A, int lda, - std::complex const* x, int incx, - std::complex beta, - std::complex* yref, int incy ); - -void -cblas_symv( - CBLAS_LAYOUT layout, - CBLAS_UPLO uplo, - int n, - std::complex alpha, - std::complex const* A, int lda, - std::complex const* x, int incx, - std::complex beta, - std::complex* yref, int incy ); - -// ----------------------------------------------------------------------------- -inline void -cblas_syr( - CBLAS_LAYOUT layout, CBLAS_UPLO uplo, int n, - float alpha, - float const *x, int incx, - float* A, int lda ) -{ - cblas_ssyr( layout, uplo, n, alpha, x, incx, A, lda ); -} - -inline void -cblas_syr( - CBLAS_LAYOUT layout, CBLAS_UPLO uplo, int n, - double alpha, - double const *x, int incx, - double* A, int lda ) -{ - cblas_dsyr( layout, uplo, n, alpha, x, incx, A, lda ); -} - -// LAPACK provides [cz]syr, CBLAS lacks them -void -cblas_syr( - CBLAS_LAYOUT layout, CBLAS_UPLO uplo, int n, - std::complex alpha, - std::complex const *x, int incx, - std::complex* A, int lda ); - -void -cblas_syr( - CBLAS_LAYOUT layout, CBLAS_UPLO uplo, int n, - std::complex alpha, - std::complex const *x, int incx, - std::complex* A, int lda ); - // ----------------------------------------------------------------------------- inline void cblas_gbmv( diff --git a/test/check_gemm2.hh b/test/check_gemm2.hh deleted file mode 100644 index 38c67e88..00000000 --- a/test/check_gemm2.hh +++ /dev/null @@ -1,124 +0,0 @@ -// Copyright (c) 2017-2023, University of Tennessee. All rights reserved. -// SPDX-License-Identifier: BSD-3-Clause -// This program is free software: you can redistribute it and/or modify it under -// the terms of the BSD 3-Clause license. See the accompanying LICENSE file. - -// this is similar to blaspp/test/check_gemm.hh, -// except it uses LAPACK++ instead of calling Fortran LAPACK. - -#ifndef CHECK_GEMM_HH -#define CHECK_GEMM_HH - -#include "blas/util.hh" -#include "lapack.hh" - -#include - -// ----------------------------------------------------------------------------- -// Computes error for multiplication with general matrix result. -// Covers dot, gemv, ger, geru, gemm, symv, hemv, symm, trmv, trsv?, trmm, trsm?. -// Cnorm is norm of original C, before multiplication operation. -template< typename T > -void check_gemm( - int64_t m, int64_t n, int64_t k, - T alpha, - T beta, - blas::real_type Anorm, - blas::real_type Bnorm, - blas::real_type Cnorm, - T const* Cref, int64_t ldcref, - T* C, int64_t ldc, - blas::real_type error[1], - int64_t* okay ) -{ - #define C(i_, j_) C[ (i_) + (j_)*ldc ] - #define Cref(i_, j_) Cref[ (i_) + (j_)*ldcref ] - - using real_t = blas::real_type; - - require( m >= 0 ); - require( n >= 0 ); - require( k >= 0 ); - require( ldc >= m ); - require( ldcref >= m ); - - // C -= Cref - for (int64_t j = 0; j < n; ++j) { - for (int64_t i = 0; i < m; ++i) { - C(i,j) -= Cref(i,j); - } - } - - error[0] = lapack::lange( lapack::Norm::Fro, m, n, C, ldc ) - / (sqrt(real_t(k)+2)*std::abs(alpha)*Anorm*Bnorm + 2*std::abs(beta)*Cnorm); - - // Allow 3*eps; complex needs 2*sqrt(2) factor; see Higham, 2002, sec. 3.6. - real_t eps = std::numeric_limits< real_t >::epsilon(); - *okay = (error[0] < 3*eps); - - #undef C - #undef Cref -} - -// ----------------------------------------------------------------------------- -// Computes error for multiplication with symmetric or Hermitian matrix result. -// Covers syr, syr2, syrk, syr2k, her, her2, herk, her2k. -// Cnorm is norm of original C, before multiplication operation. -// -// alpha and beta are either real or complex, depending on routine: -// zher zher2 zherk zher2k zsyr zsyr2 zsyrk zsyr2k -// alpha real complex real complex complex complex complex complex -// beta -- -- real real -- -- complex complex -// zsyr2 doesn't exist in standard BLAS or LAPACK. -template< typename TA, typename TB, typename T > -void check_herk( - blas::Uplo uplo, - int64_t n, int64_t k, - TA alpha, - TB beta, - blas::real_type Anorm, - blas::real_type Bnorm, - blas::real_type Cnorm, - T const* Cref, int64_t ldcref, - T* C, int64_t ldc, - blas::real_type error[1], - int64_t* okay ) -{ - #define C(i_, j_) C[ (i_) + (j_)*ldc ] - #define Cref(i_, j_) Cref[ (i_) + (j_)*ldcref ] - - using real_t = blas::real_type; - - require( n >= 0 ); - require( k >= 0 ); - require( ldc >= n ); - require( ldcref >= n ); - - // C -= Cref - if (uplo == blas::Uplo::Lower) { - for (int64_t j = 0; j < n; ++j) { - for (int64_t i = j; i < n; ++i) { - C(i,j) -= Cref(i,j); - } - } - } - else { - for (int64_t j = 0; j < n; ++j) { - for (int64_t i = 0; i <= j; ++i) { - C(i,j) -= Cref(i,j); - } - } - } - - error[0] = lapack::lanhe( lapack::Norm::Fro, uplo, n, C, ldc ) - / (sqrt(real_t(k)+2)*std::abs(alpha)*Anorm*Bnorm + 2*std::abs(beta)*Cnorm); - - // Allow 3*eps; complex needs 2*sqrt(2) factor; see Higham, 2002, sec. 3.6. - real_t eps = std::numeric_limits< real_t >::epsilon(); - *okay = (error[0] < 3*eps); - - #undef C - #undef Cref -} - -#endif // #ifndef CHECK_GEMM_HH diff --git a/test/lapacke_wrappers.hh b/test/lapacke_wrappers.hh index f6a73181..034531a1 100644 --- a/test/lapacke_wrappers.hh +++ b/test/lapacke_wrappers.hh @@ -4809,7 +4809,7 @@ extern "C" { /* ----- matrix norm - general banded */ #ifndef LAPACK_slangb #define LAPACK_slangb LAPACK_GLOBAL(slangb,SLANGB) -lapack_float_return LAPACK_slangb( +lapackpp_float_return LAPACK_slangb( char const* norm, lapack_int const* n, lapack_int const* kl, lapack_int const* ku, float const* AB, lapack_int const* ldab, @@ -4827,7 +4827,7 @@ double LAPACK_dlangb( #ifndef LAPACK_clangb #define LAPACK_clangb LAPACK_GLOBAL(clangb,CLANGB) -lapack_float_return LAPACK_clangb( +lapackpp_float_return LAPACK_clangb( char const* norm, lapack_int const* n, lapack_int const* kl, lapack_int const* ku, lapack_complex_float const* AB, lapack_int const* ldab, @@ -4931,7 +4931,7 @@ extern "C" { /* ----- matrix norm - general tridiagonal */ #ifndef LAPACK_slangt #define LAPACK_slangt LAPACK_GLOBAL(slangt,SLANGT) -lapack_float_return LAPACK_slangt( +lapackpp_float_return LAPACK_slangt( char const* norm, lapack_int const* n, float const* DL, float const* D, @@ -4949,7 +4949,7 @@ double LAPACK_dlangt( #ifndef LAPACK_clangt #define LAPACK_clangt LAPACK_GLOBAL(clangt,CLANGT) -lapack_float_return LAPACK_clangt( +lapackpp_float_return LAPACK_clangt( char const* norm, lapack_int const* n, lapack_complex_float const* DL, lapack_complex_float const* D, @@ -5028,7 +5028,7 @@ extern "C" { /* ----- matrix norm - symmetric banded */ #ifndef LAPACK_slansb #define LAPACK_slansb LAPACK_GLOBAL(slansb,SLANSB) -lapack_float_return LAPACK_slansb( +lapackpp_float_return LAPACK_slansb( char const* norm, char const* uplo, lapack_int const* n, lapack_int const* kd, float const* AB, lapack_int const* ldab, @@ -5046,7 +5046,7 @@ double LAPACK_dlansb( #ifndef LAPACK_clanhb #define LAPACK_clanhb LAPACK_GLOBAL(clanhb,CLANHB) -lapack_float_return LAPACK_clanhb( +lapackpp_float_return LAPACK_clanhb( char const* norm, char const* uplo, lapack_int const* n, lapack_int const* kd, lapack_complex_float const* AB, lapack_int const* ldab, @@ -5150,7 +5150,7 @@ extern "C" { /* ----- matrix norm - symmetric packed */ #ifndef LAPACK_slansp #define LAPACK_slansp LAPACK_GLOBAL(slansp,SLANSP) -lapack_float_return LAPACK_slansp( +lapackpp_float_return LAPACK_slansp( char const* norm, char const* uplo, lapack_int const* n, float const* AP, float* work ); @@ -5166,7 +5166,7 @@ double LAPACK_dlansp( #ifndef LAPACK_clanhp #define LAPACK_clanhp LAPACK_GLOBAL(clanhp,CLANHP) -lapack_float_return LAPACK_clanhp( +lapackpp_float_return LAPACK_clanhp( char const* norm, char const* uplo, lapack_int const* n, lapack_complex_float const* AP, float* work ); @@ -5231,7 +5231,7 @@ extern "C" { /* ----- matrix norm - symmetric packed */ #ifndef LAPACK_slanhs #define LAPACK_slanhs LAPACK_GLOBAL(slanhs,SLANHS) -lapack_float_return LAPACK_slanhs( +lapackpp_float_return LAPACK_slanhs( char const* norm, lapack_int const* n, float const* A, lapack_int const* lda, float* work ); @@ -5247,7 +5247,7 @@ double LAPACK_dlanhs( #ifndef LAPACK_clanhs #define LAPACK_clanhs LAPACK_GLOBAL(clanhs,CLANHS) -lapack_float_return LAPACK_clanhs( +lapackpp_float_return LAPACK_clanhs( char const* norm, lapack_int const* n, lapack_complex_float const* A, lapack_int const* lda, float* work ); @@ -5312,7 +5312,7 @@ extern "C" { /* ----- matrix norm - symmetric tridiagonal */ #ifndef LAPACK_slanst #define LAPACK_slanst LAPACK_GLOBAL(slanst,SLANST) -lapack_float_return LAPACK_slanst( +lapackpp_float_return LAPACK_slanst( char const* norm, lapack_int const* n, float const* D, float const* E ); @@ -5328,7 +5328,7 @@ double LAPACK_dlanst( #ifndef LAPACK_clanht #define LAPACK_clanht LAPACK_GLOBAL(clanht,CLANHT) -lapack_float_return LAPACK_clanht( +lapackpp_float_return LAPACK_clanht( char const* norm, lapack_int const* n, float const* D, lapack_complex_float const* E ); @@ -5419,7 +5419,7 @@ extern "C" { /* ----- matrix norm - symmetric banded */ #ifndef LAPACK_slansb #define LAPACK_slansb LAPACK_GLOBAL(slansb,SLANSB) -lapack_float_return LAPACK_slansb( +lapackpp_float_return LAPACK_slansb( char const* norm, char const* uplo, lapack_int const* n, lapack_int const* kd, float const* AB, lapack_int const* ldab, @@ -5437,7 +5437,7 @@ double LAPACK_dlansb( #ifndef LAPACK_clansb #define LAPACK_clansb LAPACK_GLOBAL(clansb,CLANSB) -lapack_float_return LAPACK_clansb( +lapackpp_float_return LAPACK_clansb( char const* norm, char const* uplo, lapack_int const* n, lapack_int const* kd, lapack_complex_float const* AB, lapack_int const* ldab, @@ -5504,7 +5504,7 @@ extern "C" { /* ----- matrix norm - symmetric packed */ #ifndef LAPACK_slansp #define LAPACK_slansp LAPACK_GLOBAL(slansp,SLANSP) -lapack_float_return LAPACK_slansp( +lapackpp_float_return LAPACK_slansp( char const* norm, char const* uplo, lapack_int const* n, float const* AP, float* work ); @@ -5520,7 +5520,7 @@ double LAPACK_dlansp( #ifndef LAPACK_clansp #define LAPACK_clansp LAPACK_GLOBAL(clansp,CLANSP) -lapack_float_return LAPACK_clansp( +lapackpp_float_return LAPACK_clansp( char const* norm, char const* uplo, lapack_int const* n, lapack_complex_float const* AP, float* work ); @@ -5622,7 +5622,7 @@ extern "C" { /* ----- matrix norm - triangular banded */ #ifndef LAPACK_slantb #define LAPACK_slantb LAPACK_GLOBAL(slantb,SLANTB) -lapack_float_return LAPACK_slantb( +lapackpp_float_return LAPACK_slantb( char const* norm, char const* uplo, char const* diag, lapack_int const* n, lapack_int const* k, float const* AB, lapack_int const* ldab, @@ -5640,7 +5640,7 @@ double LAPACK_dlantb( #ifndef LAPACK_clantb #define LAPACK_clantb LAPACK_GLOBAL(clantb,CLANTB) -lapack_float_return LAPACK_clantb( +lapackpp_float_return LAPACK_clantb( char const* norm, char const* uplo, char const* diag, lapack_int const* n, lapack_int const* k, lapack_complex_float const* AB, lapack_int const* ldab, @@ -5707,7 +5707,7 @@ extern "C" { /* ----- matrix norm - triangular packed */ #ifndef LAPACK_slantp #define LAPACK_slantp LAPACK_GLOBAL(slantp,SLANTP) -lapack_float_return LAPACK_slantp( +lapackpp_float_return LAPACK_slantp( char const* norm, char const* uplo, char const* diag, lapack_int const* n, float const* AP, @@ -5725,7 +5725,7 @@ double LAPACK_dlantp( #ifndef LAPACK_clantp #define LAPACK_clantp LAPACK_GLOBAL(clantp,CLANTP) -lapack_float_return LAPACK_clantp( +lapackpp_float_return LAPACK_clantp( char const* norm, char const* uplo, char const* diag, lapack_int const* n, lapack_complex_float const* AP, diff --git a/test/run_tests.py b/test/run_tests.py index 9e3c4b23..bb80c881 100755 --- a/test/run_tests.py +++ b/test/run_tests.py @@ -79,7 +79,6 @@ group_cat.add_argument( '--aux-house', action='store_true', help='run auxiliary Householder reflector tests' ), group_cat.add_argument( '--aux-givens', action='store_true', help='run auxiliary Givens rotations tests' ), group_cat.add_argument( '--aux-norm', action='store_true', help='run auxiliary norm tests' ), - group_cat.add_argument( '--blas', action='store_true', help='run additional BLAS tests' ), ] # map category objects to category names: ['lu', 'chol', ...] categories = list( map( lambda x: x.dest, categories ) ) @@ -749,13 +748,6 @@ def filter_csv( values, csv ): [ 'lanst', gen + dtype + n + norm ], ] -# additional blas -if (opts.blas and opts.host): - cmds += [ - [ 'syr', gen + dtype + align + n + uplo ], - [ 'symv', gen + dtype + layout + align + uplo + n + incx + incy ], - ] - # ------------------------------------------------------------------------------ # When stdout is redirected to file instead of TTY console, # and stderr is still going to a TTY console, diff --git a/test/test.cc b/test/test.cc index de4416af..839f4e85 100644 --- a/test/test.cc +++ b/test/test.cc @@ -71,9 +71,6 @@ enum Section { aux_householder, aux_givens, aux_gen, - blas1, - blas2, - blas3, gpu, num_sections, // last }; @@ -95,9 +92,6 @@ const char* section_names[] = { "auxiliary - Householder", "auxiliary - Givens", "auxiliary - matrix generation", - "Level 1 BLAS (additional)", - "Level 2 BLAS (additional)", - "Level 3 BLAS (additional)", "GPU device functions", }; @@ -484,11 +478,6 @@ std::vector< testsweeper::routines_t > routines = { //{ "lagtr", test_lagtr, Section::aux_gen }, { "", nullptr, Section::newline }, - // additional BLAS - { "syr", test_syr, Section::blas2 }, - { "symv", test_symv, Section::blas2 }, - { "", nullptr, Section::newline }, - //---------------------------------------- // GPU device functions { "dev-potrf", test_potrf_device, Section::gpu }, diff --git a/test/test.hh b/test/test.hh index 6df593eb..6b902b50 100644 --- a/test/test.hh +++ b/test/test.hh @@ -463,10 +463,6 @@ void test_lagsy ( Params& params, bool run ); void test_laghe ( Params& params, bool run ); void test_lagtr ( Params& params, bool run ); -// additional BLAS -void test_syr ( Params& params, bool run ); -void test_symv ( Params& params, bool run ); - //---------------------------------------- // GPU device functions void test_potrf_device ( Params& params, bool run ); diff --git a/test/test_symv.cc b/test/test_symv.cc deleted file mode 100644 index cd85c539..00000000 --- a/test/test_symv.cc +++ /dev/null @@ -1,173 +0,0 @@ -// Copyright (c) 2017-2023, University of Tennessee. All rights reserved. -// SPDX-License-Identifier: BSD-3-Clause -// This program is free software: you can redistribute it and/or modify it under -// the terms of the BSD 3-Clause license. See the accompanying LICENSE file. - -#include "test.hh" -#include "blas/flops.hh" -#include "print_matrix.hh" -#include "check_gemm2.hh" -#include "cblas_wrappers.hh" - -// ----------------------------------------------------------------------------- -template< typename TA, typename TX, typename TY > -void test_symv_work( Params& params, bool run ) -{ - using namespace testsweeper; - using namespace blas; - using blas::real; - using blas::imag; - using scalar_t = blas::scalar_type; - using real_t = blas::real_type; - - // get & mark input values - blas::Layout layout = params.layout(); - blas::Uplo uplo = params.uplo(); - scalar_t alpha = params.alpha.get(); - scalar_t beta = params.beta.get(); - int64_t n = params.dim.n(); - int64_t incx = params.incx(); - int64_t incy = params.incy(); - int64_t align = params.align(); - int64_t verbose = params.verbose(); - - // mark non-standard output values - params.gflops(); - params.gbytes(); - params.ref_time(); - params.ref_gflops(); - params.ref_gbytes(); - - // adjust header to msec - params.time.name( "time (ms)" ); - params.ref_time.name( "time (ms)" ); - - if (! run) - return; - - // setup - int64_t lda = roundup( n, align ); - size_t size_A = size_t(lda)*n; - size_t size_x = (n - 1) * std::abs(incx) + 1; - size_t size_y = (n - 1) * std::abs(incy) + 1; - std::vector A ( size_A ); - std::vector x ( size_x ); - std::vector y ( size_y ); - std::vector yref( size_y ); - - int64_t idist = 1; - int64_t iseed[4] = { 0, 1, 2, 3 }; - lapack::generate_matrix( params.matrix, n, n, &A[0], lda ); - lapack::larnv( idist, iseed, x.size(), &x[0] ); - lapack::larnv( idist, iseed, y.size(), &y[0] ); - yref = y; - - // norms for error check - real_t Anorm = lapack::lansy( lapack::Norm::Fro, uplo, n, &A[0], lda ); - real_t Xnorm = blas::nrm2( n, &x[0], std::abs(incx) ); - real_t Ynorm = blas::nrm2( n, &y[0], std::abs(incy) ); - - // test error exits - if (params.error_exit() == 'y') { - using blas::Layout; - using blas::Uplo; - assert_throw( blas::symv( Layout(0), uplo, n, alpha, &A[0], lda, &x[0], incx, beta, &y[0], incy ), blas::Error ); - assert_throw( blas::symv( layout, Uplo(0), n, alpha, &A[0], lda, &x[0], incx, beta, &y[0], incy ), blas::Error ); - assert_throw( blas::symv( layout, uplo, -1, alpha, &A[0], lda, &x[0], incx, beta, &y[0], incy ), blas::Error ); - assert_throw( blas::symv( layout, uplo, n, alpha, &A[0], n-1, &x[0], incx, beta, &y[0], incy ), blas::Error ); - assert_throw( blas::symv( layout, uplo, n, alpha, &A[0], lda, &x[0], 0, beta, &y[0], incy ), blas::Error ); - assert_throw( blas::symv( layout, uplo, n, alpha, &A[0], lda, &x[0], incx, beta, &y[0], 0 ), blas::Error ); - } - - if (verbose >= 1) { - printf( "\n" - "A n=%5lld, lda=%5lld, size=%10lld, norm=%.2e\n" - "x n=%5lld, inc=%5lld, size=%10lld, norm=%.2e\n" - "y n=%5lld, inc=%5lld, size=%10lld, norm=%.2e\n", - llong( n ), llong( lda ), llong( size_A ), Anorm, - llong( n ), llong( incx ), llong( size_x ), Xnorm, - llong( n ), llong( incy ), llong( size_y ), Ynorm ); - } - if (verbose >= 2) { - printf( "alpha = %.4e + %.4ei; beta = %.4e + %.4ei;\n", - real(alpha), imag(alpha), - real(beta), imag(beta) ); - printf( "A = " ); print_matrix( n, n, &A[0], lda ); - printf( "x = " ); print_vector( n, &x[0], incx ); - printf( "y = " ); print_vector( n, &y[0], incy ); - } - - // run test - testsweeper::flush_cache( params.cache() ); - double time = get_wtime(); - blas::symv( layout, uplo, n, alpha, &A[0], lda, &x[0], incx, beta, &y[0], incy ); - time = get_wtime() - time; - - double gflop = Gflop < scalar_t >::symv( n ); - double gbyte = Gbyte < scalar_t >::symv( n ); - params.time() = time * 1000; // msec - params.gflops() = gflop / time; - params.gbytes() = gbyte / time; - - if (verbose >= 2) { - printf( "y2 = " ); print_vector( n, &y[0], incy ); - } - - if (params.check() == 'y') { - // run reference - testsweeper::flush_cache( params.cache() ); - time = get_wtime(); - cblas_symv( cblas_layout_const(layout), cblas_uplo_const(uplo), n, - alpha, &A[0], lda, &x[0], incx, beta, &yref[0], incy ); - time = get_wtime() - time; - - params.ref_time() = time * 1000; // msec - params.ref_gflops() = gflop / time; - params.ref_gbytes() = gbyte / time; - - if (verbose >= 2) { - printf( "yref = " ); print_vector( n, &yref[0], incy ); - } - - // check error compared to reference - // treat y as 1 x leny matrix with ld = incy; k = lenx is reduction dimension - real_t error; - int64_t okay; - check_gemm( 1, n, n, - alpha, beta, - Anorm, Xnorm, Ynorm, - &yref[0], std::abs(incy), - &y[0], std::abs(incy), - &error, &okay ); - params.error() = error; - params.okay() = okay; - } -} - -// ----------------------------------------------------------------------------- -void test_symv( Params& params, bool run ) -{ - switch (params.datatype()) { - case testsweeper::DataType::Single: - test_symv_work< float, float, float >( params, run ); - break; - - case testsweeper::DataType::Double: - test_symv_work< double, double, double >( params, run ); - break; - - case testsweeper::DataType::SingleComplex: - test_symv_work< std::complex, std::complex, - std::complex >( params, run ); - break; - - case testsweeper::DataType::DoubleComplex: - test_symv_work< std::complex, std::complex, - std::complex >( params, run ); - break; - - default: - throw std::runtime_error( "unknown datatype" ); - break; - } -} diff --git a/test/test_syr.cc b/test/test_syr.cc deleted file mode 100644 index c26992d9..00000000 --- a/test/test_syr.cc +++ /dev/null @@ -1,154 +0,0 @@ -// Copyright (c) 2017-2023, University of Tennessee. All rights reserved. -// SPDX-License-Identifier: BSD-3-Clause -// This program is free software: you can redistribute it and/or modify it under -// the terms of the BSD 3-Clause license. See the accompanying LICENSE file. - -// this is similar to blaspp/test/test_syr.hh, -// except it uses LAPACK++ instead of calling Fortran LAPACK, -// and tests syr< complex >. - - -#include "test.hh" -#include "lapack.hh" -#include "blas/flops.hh" -#include "print_matrix.hh" -#include "check_gemm2.hh" // uses LAPACK++ instead of Fortran lapack -#include "cblas_wrappers.hh" -#include "blas/syr.hh" // from BLAS++ - -// ----------------------------------------------------------------------------- -template< typename TA, typename TX > -void test_syr_work( Params& params, bool run ) -{ - using blas::real; - using blas::imag; - using scalar_t = blas::scalar_type< TA, TX >; - using real_t = blas::real_type< scalar_t >; - - // get & mark input values - blas::Layout layout = params.layout(); - blas::Uplo uplo = params.uplo(); - scalar_t alpha = params.alpha.get(); - int64_t n = params.dim.n(); - int64_t incx = params.incx(); - int64_t align = params.align(); - int64_t verbose = params.verbose(); - - // mark non-standard output values - params.ref_time(); - params.ref_gflops(); - params.gflops(); - - if (! run) - return; - - // setup - int64_t lda = roundup( n, align ); - size_t size_A = size_t(lda)*n; - size_t size_x = (n - 1) * std::abs(incx) + 1; - std::vector A ( size_A ); - std::vector Aref( size_A ); - std::vector x ( size_x ); - - int64_t idist = 1; - int64_t iseed[4] = { 0, 0, 0, 1 }; - lapack::generate_matrix( params.matrix, n, n, &A[0], lda ); - lapack::larnv( idist, iseed, size_x, &x[0] ); - Aref = A; - - // norms for error check - real_t Anorm = lapack::lansy( lapack::Norm::Fro, uplo, n, &A[0], lda ); - real_t Xnorm = blas::nrm2( n, &x[0], std::abs(incx) ); - - // test error exits - if (params.error_exit() == 'y') { - using blas::Layout; - using blas::Uplo; - assert_throw( blas::syr( Layout(0), uplo, n, alpha, &x[0], incx, &A[0], lda ), blas::Error ); - assert_throw( blas::syr( layout, Uplo(0), n, alpha, &x[0], incx, &A[0], lda ), blas::Error ); - assert_throw( blas::syr( layout, uplo, -1, alpha, &x[0], incx, &A[0], lda ), blas::Error ); - assert_throw( blas::syr( layout, uplo, n, alpha, &x[0], 0, &A[0], lda ), blas::Error ); - assert_throw( blas::syr( layout, uplo, n, alpha, &x[0], incx, &A[0], n-1 ), blas::Error ); - } - - if (verbose >= 1) { - printf( "\n" - "A n=%5lld, lda=%5lld, size=%10lld, norm=%.2e\n" - "x n=%5lld, inc=%5lld, size=%10lld, norm=%.2e\n", - llong( n ), llong( lda ), llong( size_A ), Anorm, - llong( n ), llong( incx ), llong( size_x ), Xnorm ); - } - if (verbose >= 2) { - printf( "alpha = %.4e + %.4ei;\n", - real(alpha), imag(alpha) ); - printf( "A = " ); print_matrix( n, n, &A[0], lda ); - printf( "x = " ); print_vector( n, &x[0], incx ); - } - - // run test - testsweeper::flush_cache( params.cache() ); - double time = testsweeper::get_wtime(); - blas::syr( layout, uplo, n, alpha, &x[0], incx, &A[0], lda ); - time = testsweeper::get_wtime() - time; - - params.time() = time * 1000; // msec - double gflop = blas::Gflop< scalar_t >::syr( n ); - params.gflops() = gflop / time; - - if (verbose >= 2) { - printf( "A2 = " ); print_matrix( n, n, &A[0], lda ); - } - - if (params.check() == 'y') { - // run reference - testsweeper::flush_cache( params.cache() ); - time = testsweeper::get_wtime(); - cblas_syr( cblas_layout_const(layout), cblas_uplo_const(uplo), - n, alpha, &x[0], incx, &Aref[0], lda ); - time = testsweeper::get_wtime() - time; - - params.ref_time() = time * 1000; // msec - params.ref_gflops() = gflop / time; - - if (verbose >= 2) { - printf( "Aref = " ); print_matrix( n, n, &Aref[0], lda ); - } - - // check error compared to reference - // beta = 1 - real_t error; - int64_t okay; - check_herk( uplo, n, 1, alpha, scalar_t(1), Xnorm, Xnorm, Anorm, - &Aref[0], lda, &A[0], lda, &error, &okay ); - params.error() = error; - params.okay() = okay; - } -} - -// ----------------------------------------------------------------------------- -void test_syr( Params& params, bool run ) -{ - switch (params.datatype()) { - case testsweeper::DataType::Single: - test_syr_work< float, float >( params, run ); - break; - - case testsweeper::DataType::Double: - test_syr_work< double, double >( params, run ); - break; - - case testsweeper::DataType::SingleComplex: - test_syr_work< std::complex, std::complex > - ( params, run ); - break; - - case testsweeper::DataType::DoubleComplex: - test_syr_work< std::complex, std::complex > - ( params, run ); - break; - - default: - throw std::runtime_error( "unknown datatype" ); - break; - } -} diff --git a/tools/first_version.py b/tools/first_version.py index a4803c15..0387cdc1 100644 --- a/tools/first_version.py +++ b/tools/first_version.py @@ -250,8 +250,6 @@ 'sygs2': (1, 0, 0), 'sygst': (1, 0, 0), 'sygv': (1, 0, 0), - 'symv': (1, 0, 0), - 'syr': (1, 0, 0), 'syrfs': (1, 0, 0), 'sysv': (1, 0, 0), 'sysvx': (1, 0, 0), diff --git a/tools/functions.txt b/tools/functions.txt index c0ff8b21..6c6d3836 100644 --- a/tools/functions.txt +++ b/tools/functions.txt @@ -527,8 +527,6 @@ sygv sygv_2stage sygvd sygvx -symv -syr syrfs syrfsx sysv