max@0: // Copyright (C) 2008-2011 NICTA (www.nicta.com.au) max@0: // Copyright (C) 2008-2011 Conrad Sanderson max@0: // max@0: // This file is part of the Armadillo C++ library. max@0: // It is provided without any warranty of fitness max@0: // for any purpose. You can redistribute this file max@0: // and/or modify it under the terms of the GNU max@0: // Lesser General Public License (LGPL) as published max@0: // by the Free Software Foundation, either version 3 max@0: // of the License or (at your option) any later version. max@0: // (see http://www.opensource.org/licenses for more info) max@0: max@0: max@0: //! \addtogroup traits max@0: //! @{ max@0: max@0: max@0: template max@0: struct get_pod_type max@0: { typedef T1 result; }; max@0: max@0: template max@0: struct get_pod_type< std::complex > max@0: { typedef T2 result; }; max@0: max@0: max@0: max@0: template max@0: struct is_Mat_only max@0: { static const bool value = false; }; max@0: max@0: template max@0: struct is_Mat_only< Mat > max@0: { static const bool value = true; }; max@0: max@0: max@0: max@0: template max@0: struct is_Mat max@0: { static const bool value = false; }; max@0: max@0: template max@0: struct is_Mat< Mat > max@0: { static const bool value = true; }; max@0: max@0: template max@0: struct is_Mat< Row > max@0: { static const bool value = true; }; max@0: max@0: template max@0: struct is_Mat< Col > max@0: { static const bool value = true; }; max@0: max@0: max@0: max@0: template max@0: struct is_Row max@0: { static const bool value = false; }; max@0: max@0: template max@0: struct is_Row< Row > max@0: { static const bool value = true; }; max@0: max@0: max@0: max@0: template max@0: struct is_Col max@0: { static const bool value = false; }; max@0: max@0: template max@0: struct is_Col< Col > max@0: { static const bool value = true; }; max@0: max@0: max@0: max@0: max@0: max@0: max@0: template max@0: struct is_subview max@0: { static const bool value = false; }; max@0: max@0: template max@0: struct is_subview< subview > max@0: { static const bool value = true; }; max@0: max@0: max@0: template max@0: struct is_diagview max@0: { static const bool value = false; }; max@0: max@0: template max@0: struct is_diagview< diagview > max@0: { static const bool value = true; }; max@0: max@0: max@0: // max@0: // max@0: // max@0: max@0: max@0: max@0: template max@0: struct is_Cube max@0: { static const bool value = false; }; max@0: max@0: template max@0: struct is_Cube< Cube > max@0: { static const bool value = true; }; max@0: max@0: template max@0: struct is_subview_cube max@0: { static const bool value = false; }; max@0: max@0: template max@0: struct is_subview_cube< subview_cube > max@0: { static const bool value = true; }; max@0: max@0: max@0: max@0: // max@0: // max@0: // max@0: max@0: max@0: template max@0: struct is_Gen max@0: { static const bool value = false; }; max@0: max@0: template max@0: struct is_Gen< Gen > max@0: { static const bool value = true; }; max@0: max@0: max@0: template max@0: struct is_Op max@0: { static const bool value = false; }; max@0: max@0: template max@0: struct is_Op< Op > max@0: { static const bool value = true; }; max@0: max@0: max@0: template max@0: struct is_eOp max@0: { static const bool value = false; }; max@0: max@0: template max@0: struct is_eOp< eOp > max@0: { static const bool value = true; }; max@0: max@0: max@0: template max@0: struct is_mtOp max@0: { static const bool value = false; }; max@0: max@0: template max@0: struct is_mtOp< mtOp > max@0: { static const bool value = true; }; max@0: max@0: max@0: template max@0: struct is_Glue max@0: { static const bool value = false; }; max@0: max@0: template max@0: struct is_Glue< Glue > max@0: { static const bool value = true; }; max@0: max@0: max@0: template max@0: struct is_eGlue max@0: { static const bool value = false; }; max@0: max@0: template max@0: struct is_eGlue< eGlue > max@0: { static const bool value = true; }; max@0: max@0: max@0: template max@0: struct is_mtGlue max@0: { static const bool value = false; }; max@0: max@0: template max@0: struct is_mtGlue< mtGlue > max@0: { static const bool value = true; }; max@0: max@0: max@0: // max@0: // max@0: max@0: max@0: template max@0: struct is_glue_times max@0: { static const bool value = false; }; max@0: max@0: template max@0: struct is_glue_times< Glue > max@0: { static const bool value = true; }; max@0: max@0: max@0: template max@0: struct is_glue_times_diag max@0: { static const bool value = false; }; max@0: max@0: template max@0: struct is_glue_times_diag< Glue > max@0: { static const bool value = true; }; max@0: max@0: max@0: template max@0: struct is_op_diagmat max@0: { static const bool value = false; }; max@0: max@0: template max@0: struct is_op_diagmat< Op > max@0: { static const bool value = true; }; max@0: max@0: max@0: // max@0: // max@0: max@0: max@0: template max@0: struct is_GenCube max@0: { static const bool value = false; }; max@0: max@0: template max@0: struct is_GenCube< GenCube > max@0: { static const bool value = true; }; max@0: max@0: max@0: template max@0: struct is_OpCube max@0: { static const bool value = false; }; max@0: max@0: template max@0: struct is_OpCube< OpCube > max@0: { static const bool value = true; }; max@0: max@0: max@0: template max@0: struct is_eOpCube max@0: { static const bool value = false; }; max@0: max@0: template max@0: struct is_eOpCube< eOpCube > max@0: { static const bool value = true; }; max@0: max@0: max@0: template max@0: struct is_mtOpCube max@0: { static const bool value = false; }; max@0: max@0: template max@0: struct is_mtOpCube< mtOpCube > max@0: { static const bool value = true; }; max@0: max@0: max@0: template max@0: struct is_GlueCube max@0: { static const bool value = false; }; max@0: max@0: template max@0: struct is_GlueCube< GlueCube > max@0: { static const bool value = true; }; max@0: max@0: max@0: template max@0: struct is_eGlueCube max@0: { static const bool value = false; }; max@0: max@0: template max@0: struct is_eGlueCube< eGlueCube > max@0: { static const bool value = true; }; max@0: max@0: max@0: template max@0: struct is_mtGlueCube max@0: { static const bool value = false; }; max@0: max@0: template max@0: struct is_mtGlueCube< mtGlueCube > max@0: { static const bool value = true; }; max@0: max@0: max@0: // max@0: // max@0: // max@0: max@0: max@0: template max@0: struct is_op_rel max@0: { static const bool value = false; }; max@0: max@0: template max@0: struct is_op_rel< mtOp > max@0: { static const bool value = true; }; max@0: max@0: template max@0: struct is_op_rel< mtOp > max@0: { static const bool value = true; }; max@0: max@0: template max@0: struct is_op_rel< mtOp > max@0: { static const bool value = true; }; max@0: max@0: template max@0: struct is_op_rel< mtOp > max@0: { static const bool value = true; }; max@0: max@0: template max@0: struct is_op_rel< mtOp > max@0: { static const bool value = true; }; max@0: max@0: template max@0: struct is_op_rel< mtOp > max@0: { static const bool value = true; }; max@0: max@0: template max@0: struct is_op_rel< mtOp > max@0: { static const bool value = true; }; max@0: max@0: template max@0: struct is_op_rel< mtOp > max@0: { static const bool value = true; }; max@0: max@0: template max@0: struct is_op_rel< mtOp > max@0: { static const bool value = true; }; max@0: max@0: template max@0: struct is_op_rel< mtOp > max@0: { static const bool value = true; }; max@0: max@0: max@0: max@0: // max@0: // max@0: // max@0: max@0: max@0: max@0: template max@0: struct is_arma_type max@0: { max@0: static const bool value max@0: = is_Mat::value max@0: || is_Gen::value max@0: || is_Op::value max@0: || is_eOp::value max@0: || is_mtOp::value max@0: || is_Glue::value max@0: || is_eGlue::value max@0: || is_mtGlue::value max@0: || is_subview::value max@0: || is_diagview::value max@0: ; max@0: }; max@0: max@0: max@0: max@0: template max@0: struct is_arma_cube_type max@0: { max@0: static const bool value max@0: = is_Cube::value max@0: || is_GenCube::value max@0: || is_OpCube::value max@0: || is_eOpCube::value max@0: || is_mtOpCube::value max@0: || is_GlueCube::value max@0: || is_eGlueCube::value max@0: || is_mtGlueCube::value max@0: || is_subview_cube::value max@0: ; max@0: }; max@0: max@0: max@0: max@0: // max@0: // max@0: // max@0: max@0: max@0: template max@0: struct is_same_type max@0: { static const bool value = false; }; max@0: max@0: max@0: template max@0: struct is_same_type max@0: { static const bool value = true; }; max@0: max@0: max@0: max@0: // max@0: // max@0: // max@0: max@0: max@0: template max@0: struct is_u8 max@0: { static const bool value = false; }; max@0: max@0: template<> max@0: struct is_u8 max@0: { static const bool value = true; }; max@0: max@0: max@0: max@0: template max@0: struct is_s8 max@0: { static const bool value = false; }; max@0: max@0: template<> max@0: struct is_s8 max@0: { static const bool value = true; }; max@0: max@0: max@0: max@0: template max@0: struct is_u16 max@0: { static const bool value = false; }; max@0: max@0: template<> max@0: struct is_u16 max@0: { static const bool value = true; }; max@0: max@0: max@0: max@0: template max@0: struct is_s16 max@0: { static const bool value = false; }; max@0: max@0: template<> max@0: struct is_s16 max@0: { static const bool value = true; }; max@0: max@0: max@0: max@0: template max@0: struct is_u32 max@0: { static const bool value = false; }; max@0: max@0: template<> max@0: struct is_u32 max@0: { static const bool value = true; }; max@0: max@0: max@0: max@0: template max@0: struct is_s32 max@0: { static const bool value = false; }; max@0: max@0: template<> max@0: struct is_s32 max@0: { static const bool value = true; }; max@0: max@0: max@0: max@0: #if defined(ARMA_64BIT_WORD) max@0: template max@0: struct is_u64 max@0: { static const bool value = false; }; max@0: max@0: template<> max@0: struct is_u64 max@0: { static const bool value = true; }; max@0: max@0: max@0: template max@0: struct is_s64 max@0: { static const bool value = false; }; max@0: max@0: template<> max@0: struct is_s64 max@0: { static const bool value = true; }; max@0: #endif max@0: max@0: max@0: max@0: template max@0: struct is_uword max@0: { static const bool value = false; }; max@0: max@0: template<> max@0: struct is_uword max@0: { static const bool value = true; }; max@0: max@0: max@0: max@0: template max@0: struct is_sword max@0: { static const bool value = false; }; max@0: max@0: template<> max@0: struct is_sword max@0: { static const bool value = true; }; max@0: max@0: max@0: max@0: template max@0: struct is_float max@0: { static const bool value = false; }; max@0: max@0: template<> max@0: struct is_float max@0: { static const bool value = true; }; max@0: max@0: max@0: max@0: template max@0: struct is_double max@0: { static const bool value = false; }; max@0: max@0: template<> max@0: struct is_double max@0: { static const bool value = true; }; max@0: max@0: max@0: max@0: template max@0: struct is_complex max@0: { static const bool value = false; }; max@0: max@0: // template<> max@0: template max@0: struct is_complex< std::complex > max@0: { static const bool value = true; }; max@0: max@0: max@0: max@0: template max@0: struct is_complex_float max@0: { static const bool value = false; }; max@0: max@0: template<> max@0: struct is_complex_float< std::complex > max@0: { static const bool value = true; }; max@0: max@0: max@0: max@0: template max@0: struct is_complex_double max@0: { static const bool value = false; }; max@0: max@0: template<> max@0: struct is_complex_double< std::complex > max@0: { static const bool value = true; }; max@0: max@0: max@0: max@0: max@0: //! check for a weird implementation of the std::complex class max@0: template max@0: struct is_supported_complex max@0: { static const bool value = false; }; max@0: max@0: //template<> max@0: template max@0: struct is_supported_complex< std::complex > max@0: { static const bool value = ( sizeof(std::complex) == 2*sizeof(eT) ); }; max@0: max@0: max@0: max@0: template max@0: struct is_supported_complex_float max@0: { static const bool value = false; }; max@0: max@0: template<> max@0: struct is_supported_complex_float< std::complex > max@0: { static const bool value = ( sizeof(std::complex) == 2*sizeof(float) ); }; max@0: max@0: max@0: max@0: template max@0: struct is_supported_complex_double max@0: { static const bool value = false; }; max@0: max@0: template<> max@0: struct is_supported_complex_double< std::complex > max@0: { static const bool value = ( sizeof(std::complex) == 2*sizeof(double) ); }; max@0: max@0: max@0: max@0: template max@0: struct is_supported_elem_type max@0: { max@0: static const bool value = \ max@0: is_u8::value || max@0: is_s8::value || max@0: is_u16::value || max@0: is_s16::value || max@0: is_u32::value || max@0: is_s32::value || max@0: #if defined(ARMA_64BIT_WORD) max@0: is_u64::value || max@0: is_s64::value || max@0: #endif max@0: is_float::value || max@0: is_double::value || max@0: is_supported_complex_float::value || max@0: is_supported_complex_double::value; max@0: }; max@0: max@0: max@0: max@0: template max@0: struct is_supported_blas_type max@0: { max@0: static const bool value = \ max@0: is_float::value || max@0: is_double::value || max@0: is_supported_complex_float::value || max@0: is_supported_complex_double::value; max@0: }; max@0: max@0: max@0: max@0: template max@0: struct is_signed max@0: { max@0: static const bool value = true; max@0: }; max@0: max@0: max@0: template<> struct is_signed { static const bool value = false; }; max@0: template<> struct is_signed { static const bool value = false; }; max@0: template<> struct is_signed { static const bool value = false; }; max@0: #if defined(ARMA_64BIT_WORD) max@0: template<> struct is_signed { static const bool value = false; }; max@0: #endif max@0: max@0: max@0: template max@0: struct is_non_integral max@0: { max@0: static const bool value = false; max@0: }; max@0: max@0: max@0: template<> struct is_non_integral< float > { static const bool value = true; }; max@0: template<> struct is_non_integral< double > { static const bool value = true; }; max@0: template<> struct is_non_integral< std::complex > { static const bool value = true; }; max@0: template<> struct is_non_integral< std::complex > { static const bool value = true; }; max@0: max@0: max@0: max@0: max@0: // max@0: max@0: class arma_junk_class; max@0: max@0: template max@0: struct force_different_type max@0: { max@0: typedef T1 T1_result; max@0: typedef T2 T2_result; max@0: }; max@0: max@0: max@0: template max@0: struct force_different_type max@0: { max@0: typedef T1 T1_result; max@0: typedef arma_junk_class T2_result; max@0: }; max@0: max@0: max@0: max@0: //! @}