mirror of
https://github.com/amd/blis.git
synced 2026-04-19 23:28:52 +00:00
CPP Templatee test files update
Change-Id: Ia9637556b50b10cb4409e18f369a3e7fc35569fb
This commit is contained in:
@@ -27,7 +27,6 @@
|
||||
#define BLIS_HH
|
||||
|
||||
#include "cblas.hh"
|
||||
#include "blis_util.hh"
|
||||
|
||||
namespace blis {
|
||||
|
||||
@@ -406,10 +405,7 @@ TR dot(
|
||||
T const *x, int64_t incx,
|
||||
T const *y, int64_t incy )
|
||||
{
|
||||
if((std::is_same<T, float>::value)&(std::is_same<TR, double>::value))
|
||||
return cblas_dsdot( n, x, incx, y, incy );
|
||||
else
|
||||
return cblas_dot( n, x, incx, y, incy );
|
||||
return cblas_dot( n, x, incx, y, incy );
|
||||
}
|
||||
|
||||
/*! \brief Performs the dot product of two complex vectors
|
||||
|
||||
@@ -1,73 +0,0 @@
|
||||
/******************************************************************************
|
||||
* Copyright (c) 2019 - present Advanced Micro Devices, Inc. All rights reserved.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*******************************************************************************/
|
||||
|
||||
/*! @file blis_util.hh
|
||||
* blis_util.hh defines all the utility functions to be invoked in CPP template
|
||||
* interfaces
|
||||
* */
|
||||
|
||||
#ifndef BLIS_UTIL_HH
|
||||
#define BLIS_UTIL_HH
|
||||
|
||||
|
||||
namespace blis {
|
||||
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// for any combination of types, determine associated real, scalar,
|
||||
// and complex types.
|
||||
//
|
||||
// real_type< float > is float
|
||||
// real_type< float, double, complex<float> > is double
|
||||
//
|
||||
// scalar_type< float > is float
|
||||
// scalar_type< float, complex<float> > is complex<float>
|
||||
// scalar_type< float, double, complex<float> > is complex<double>
|
||||
//
|
||||
// complex_type< float > is complex<float>
|
||||
// complex_type< float, double > is complex<double>
|
||||
// complex_type< float, double, complex<float> > is complex<double>
|
||||
|
||||
// for zero types
|
||||
template< typename... Types >
|
||||
struct real_type_traits;
|
||||
|
||||
// define real_type<> type alias
|
||||
template< typename... Types >
|
||||
using real_type = typename real_type_traits< Types... >::real_t;
|
||||
|
||||
// for one type
|
||||
template< typename T >
|
||||
struct real_type_traits<T>
|
||||
{
|
||||
using real_t = T;
|
||||
};
|
||||
|
||||
// for one complex type, strip complex
|
||||
template< typename T >
|
||||
struct real_type_traits< std::complex<T> >
|
||||
{
|
||||
using real_t = T;
|
||||
};
|
||||
} // namespace blis
|
||||
|
||||
#endif // #ifndef BLIS_UTIL_HH
|
||||
26
cpp/cblas.hh
26
cpp/cblas.hh
@@ -31,10 +31,30 @@ extern "C" {
|
||||
#include <blis.h>
|
||||
}
|
||||
|
||||
|
||||
#include <complex>
|
||||
|
||||
namespace blis{
|
||||
|
||||
template< typename... Types > struct real_type_traits;
|
||||
|
||||
//define real_type<> type alias
|
||||
template< typename... Types >
|
||||
using real_type = typename real_type_traits< Types... >::real_t;
|
||||
|
||||
// for one type
|
||||
template< typename T >
|
||||
struct real_type_traits<T>
|
||||
{
|
||||
using real_t = T;
|
||||
};
|
||||
|
||||
// for one complex type, strip complex
|
||||
template< typename T >
|
||||
struct real_type_traits< std::complex<T> >
|
||||
{
|
||||
using real_t = T;
|
||||
};
|
||||
|
||||
// =============================================================================
|
||||
// Level 1 BLAS
|
||||
// -----------------------------------------------------------------------------
|
||||
@@ -96,7 +116,7 @@ cblas_rotm(
|
||||
int n,
|
||||
float *x, int incx,
|
||||
float *y, int incy,
|
||||
float p[5] )
|
||||
const float p[5] )
|
||||
{
|
||||
cblas_srotm( n, x, incx, y, incy, p );
|
||||
}
|
||||
@@ -106,7 +126,7 @@ cblas_rotm(
|
||||
int n,
|
||||
double *x, int incx,
|
||||
double *y, int incy,
|
||||
double p[5] )
|
||||
const double p[5] )
|
||||
{
|
||||
cblas_drotm( n, x, incx, y, incy, p );
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user