/****************************************************************************** * 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 > is double // // scalar_type< float > is float // scalar_type< float, complex > is complex // scalar_type< float, double, complex > is complex // // complex_type< float > is complex // complex_type< float, double > is complex // complex_type< float, double, complex > is complex // 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 { using real_t = T; }; // for one complex type, strip complex template< typename T > struct real_type_traits< std::complex > { using real_t = T; }; } // namespace blis #endif // #ifndef BLIS_UTIL_HH