Chris@49: // Copyright (C) 2008-2013 NICTA (www.nicta.com.au) Chris@49: // Copyright (C) 2008-2013 Conrad Sanderson Chris@49: // Chris@49: // This Source Code Form is subject to the terms of the Mozilla Public Chris@49: // License, v. 2.0. If a copy of the MPL was not distributed with this Chris@49: // file, You can obtain one at http://mozilla.org/MPL/2.0/. Chris@49: Chris@49: Chris@49: //! \addtogroup traits Chris@49: //! @{ Chris@49: Chris@49: Chris@49: template Chris@49: struct get_pod_type Chris@49: { typedef T1 result; }; Chris@49: Chris@49: template Chris@49: struct get_pod_type< std::complex > Chris@49: { typedef T2 result; }; Chris@49: Chris@49: Chris@49: Chris@49: template Chris@49: struct is_Mat_fixed_only Chris@49: { Chris@49: typedef char yes[1]; Chris@49: typedef char no[2]; Chris@49: Chris@49: template static yes& check(typename X::Mat_fixed_type*); Chris@49: template static no& check(...); Chris@49: Chris@49: static const bool value = ( sizeof(check(0)) == sizeof(yes) ); Chris@49: }; Chris@49: Chris@49: Chris@49: Chris@49: template Chris@49: struct is_Row_fixed_only Chris@49: { Chris@49: typedef char yes[1]; Chris@49: typedef char no[2]; Chris@49: Chris@49: template static yes& check(typename X::Row_fixed_type*); Chris@49: template static no& check(...); Chris@49: Chris@49: static const bool value = ( sizeof(check(0)) == sizeof(yes) ); Chris@49: }; Chris@49: Chris@49: Chris@49: Chris@49: template Chris@49: struct is_Col_fixed_only Chris@49: { Chris@49: typedef char yes[1]; Chris@49: typedef char no[2]; Chris@49: Chris@49: template static yes& check(typename X::Col_fixed_type*); Chris@49: template static no& check(...); Chris@49: Chris@49: static const bool value = ( sizeof(check(0)) == sizeof(yes) ); Chris@49: }; Chris@49: Chris@49: Chris@49: Chris@49: template Chris@49: struct is_Mat_fixed Chris@49: { static const bool value = ( is_Mat_fixed_only::value || is_Row_fixed_only::value || is_Col_fixed_only::value ); }; Chris@49: Chris@49: Chris@49: Chris@49: template Chris@49: struct is_Mat_only Chris@49: { static const bool value = is_Mat_fixed_only::value; }; Chris@49: Chris@49: template Chris@49: struct is_Mat_only< Mat > Chris@49: { static const bool value = true; }; Chris@49: Chris@49: template Chris@49: struct is_Mat_only< const Mat > Chris@49: { static const bool value = true; }; Chris@49: Chris@49: Chris@49: Chris@49: template Chris@49: struct is_Mat Chris@49: { static const bool value = ( is_Mat_fixed_only::value || is_Row_fixed_only::value || is_Col_fixed_only::value ); }; Chris@49: Chris@49: template Chris@49: struct is_Mat< Mat > Chris@49: { static const bool value = true; }; Chris@49: Chris@49: template Chris@49: struct is_Mat< const Mat > Chris@49: { static const bool value = true; }; Chris@49: Chris@49: template Chris@49: struct is_Mat< Row > Chris@49: { static const bool value = true; }; Chris@49: Chris@49: template Chris@49: struct is_Mat< const Row > Chris@49: { static const bool value = true; }; Chris@49: Chris@49: template Chris@49: struct is_Mat< Col > Chris@49: { static const bool value = true; }; Chris@49: Chris@49: template Chris@49: struct is_Mat< const Col > Chris@49: { static const bool value = true; }; Chris@49: Chris@49: Chris@49: Chris@49: template Chris@49: struct is_Row Chris@49: { static const bool value = is_Row_fixed_only::value; }; Chris@49: Chris@49: template Chris@49: struct is_Row< Row > Chris@49: { static const bool value = true; }; Chris@49: Chris@49: template Chris@49: struct is_Row< const Row > Chris@49: { static const bool value = true; }; Chris@49: Chris@49: Chris@49: Chris@49: template Chris@49: struct is_Col Chris@49: { static const bool value = is_Col_fixed_only::value; }; Chris@49: Chris@49: template Chris@49: struct is_Col< Col > Chris@49: { static const bool value = true; }; Chris@49: Chris@49: template Chris@49: struct is_Col< const Col > Chris@49: { static const bool value = true; }; Chris@49: Chris@49: Chris@49: Chris@49: template Chris@49: struct is_diagview Chris@49: { static const bool value = false; }; Chris@49: Chris@49: template Chris@49: struct is_diagview< diagview > Chris@49: { static const bool value = true; }; Chris@49: Chris@49: template Chris@49: struct is_diagview< const diagview > Chris@49: { static const bool value = true; }; Chris@49: Chris@49: Chris@49: template Chris@49: struct is_subview Chris@49: { static const bool value = false; }; Chris@49: Chris@49: template Chris@49: struct is_subview< subview > Chris@49: { static const bool value = true; }; Chris@49: Chris@49: template Chris@49: struct is_subview< const subview > Chris@49: { static const bool value = true; }; Chris@49: Chris@49: Chris@49: template Chris@49: struct is_subview_row Chris@49: { static const bool value = false; }; Chris@49: Chris@49: template Chris@49: struct is_subview_row< subview_row > Chris@49: { static const bool value = true; }; Chris@49: Chris@49: template Chris@49: struct is_subview_row< const subview_row > Chris@49: { static const bool value = true; }; Chris@49: Chris@49: Chris@49: template Chris@49: struct is_subview_col Chris@49: { static const bool value = false; }; Chris@49: Chris@49: template Chris@49: struct is_subview_col< subview_col > Chris@49: { static const bool value = true; }; Chris@49: Chris@49: template Chris@49: struct is_subview_col< const subview_col > Chris@49: { static const bool value = true; }; Chris@49: Chris@49: Chris@49: template Chris@49: struct is_subview_elem1 Chris@49: { static const bool value = false; }; Chris@49: Chris@49: template Chris@49: struct is_subview_elem1< subview_elem1 > Chris@49: { static const bool value = true; }; Chris@49: Chris@49: template Chris@49: struct is_subview_elem1< const subview_elem1 > Chris@49: { static const bool value = true; }; Chris@49: Chris@49: Chris@49: template Chris@49: struct is_subview_elem2 Chris@49: { static const bool value = false; }; Chris@49: Chris@49: template Chris@49: struct is_subview_elem2< subview_elem2 > Chris@49: { static const bool value = true; }; Chris@49: Chris@49: template Chris@49: struct is_subview_elem2< const subview_elem2 > Chris@49: { static const bool value = true; }; Chris@49: Chris@49: Chris@49: Chris@49: // Chris@49: // Chris@49: // Chris@49: Chris@49: Chris@49: Chris@49: template Chris@49: struct is_Cube Chris@49: { static const bool value = false; }; Chris@49: Chris@49: template Chris@49: struct is_Cube< Cube > Chris@49: { static const bool value = true; }; Chris@49: Chris@49: template Chris@49: struct is_subview_cube Chris@49: { static const bool value = false; }; Chris@49: Chris@49: template Chris@49: struct is_subview_cube< subview_cube > Chris@49: { static const bool value = true; }; Chris@49: Chris@49: Chris@49: Chris@49: // Chris@49: // Chris@49: // Chris@49: Chris@49: Chris@49: template Chris@49: struct is_Gen Chris@49: { static const bool value = false; }; Chris@49: Chris@49: template Chris@49: struct is_Gen< Gen > Chris@49: { static const bool value = true; }; Chris@49: Chris@49: template Chris@49: struct is_Gen< const Gen > Chris@49: { static const bool value = true; }; Chris@49: Chris@49: Chris@49: template Chris@49: struct is_Op Chris@49: { static const bool value = false; }; Chris@49: Chris@49: template Chris@49: struct is_Op< Op > Chris@49: { static const bool value = true; }; Chris@49: Chris@49: template Chris@49: struct is_Op< const Op > Chris@49: { static const bool value = true; }; Chris@49: Chris@49: template Chris@49: struct is_eOp Chris@49: { static const bool value = false; }; Chris@49: Chris@49: template Chris@49: struct is_eOp< eOp > Chris@49: { static const bool value = true; }; Chris@49: Chris@49: template Chris@49: struct is_eOp< const eOp > Chris@49: { static const bool value = true; }; Chris@49: Chris@49: Chris@49: template Chris@49: struct is_mtOp Chris@49: { static const bool value = false; }; Chris@49: Chris@49: template Chris@49: struct is_mtOp< mtOp > Chris@49: { static const bool value = true; }; Chris@49: Chris@49: template Chris@49: struct is_mtOp< const mtOp > Chris@49: { static const bool value = true; }; Chris@49: Chris@49: Chris@49: template Chris@49: struct is_Glue Chris@49: { static const bool value = false; }; Chris@49: Chris@49: template Chris@49: struct is_Glue< Glue > Chris@49: { static const bool value = true; }; Chris@49: Chris@49: template Chris@49: struct is_Glue< const Glue > Chris@49: { static const bool value = true; }; Chris@49: Chris@49: Chris@49: template Chris@49: struct is_eGlue Chris@49: { static const bool value = false; }; Chris@49: Chris@49: template Chris@49: struct is_eGlue< eGlue > Chris@49: { static const bool value = true; }; Chris@49: Chris@49: template Chris@49: struct is_eGlue< const eGlue > Chris@49: { static const bool value = true; }; Chris@49: Chris@49: Chris@49: template Chris@49: struct is_mtGlue Chris@49: { static const bool value = false; }; Chris@49: Chris@49: template Chris@49: struct is_mtGlue< mtGlue > Chris@49: { static const bool value = true; }; Chris@49: Chris@49: template Chris@49: struct is_mtGlue< const mtGlue > Chris@49: { static const bool value = true; }; Chris@49: Chris@49: Chris@49: // Chris@49: // Chris@49: Chris@49: Chris@49: template Chris@49: struct is_glue_times Chris@49: { static const bool value = false; }; Chris@49: Chris@49: template Chris@49: struct is_glue_times< Glue > Chris@49: { static const bool value = true; }; Chris@49: Chris@49: template Chris@49: struct is_glue_times< const Glue > Chris@49: { static const bool value = true; }; Chris@49: Chris@49: Chris@49: template Chris@49: struct is_glue_times_diag Chris@49: { static const bool value = false; }; Chris@49: Chris@49: template Chris@49: struct is_glue_times_diag< Glue > Chris@49: { static const bool value = true; }; Chris@49: Chris@49: template Chris@49: struct is_glue_times_diag< const Glue > Chris@49: { static const bool value = true; }; Chris@49: Chris@49: Chris@49: template Chris@49: struct is_op_diagmat Chris@49: { static const bool value = false; }; Chris@49: Chris@49: template Chris@49: struct is_op_diagmat< Op > Chris@49: { static const bool value = true; }; Chris@49: Chris@49: template Chris@49: struct is_op_diagmat< const Op > Chris@49: { static const bool value = true; }; Chris@49: Chris@49: Chris@49: template Chris@49: struct is_op_htrans2 Chris@49: { static const bool value = false; }; Chris@49: Chris@49: template Chris@49: struct is_op_htrans2< Op > Chris@49: { static const bool value = true; }; Chris@49: Chris@49: template Chris@49: struct is_op_htrans2< const Op > Chris@49: { static const bool value = true; }; Chris@49: Chris@49: Chris@49: // Chris@49: // Chris@49: Chris@49: Chris@49: template Chris@49: struct is_GenCube Chris@49: { static const bool value = false; }; Chris@49: Chris@49: template Chris@49: struct is_GenCube< GenCube > Chris@49: { static const bool value = true; }; Chris@49: Chris@49: Chris@49: template Chris@49: struct is_OpCube Chris@49: { static const bool value = false; }; Chris@49: Chris@49: template Chris@49: struct is_OpCube< OpCube > Chris@49: { static const bool value = true; }; Chris@49: Chris@49: Chris@49: template Chris@49: struct is_eOpCube Chris@49: { static const bool value = false; }; Chris@49: Chris@49: template Chris@49: struct is_eOpCube< eOpCube > Chris@49: { static const bool value = true; }; Chris@49: Chris@49: Chris@49: template Chris@49: struct is_mtOpCube Chris@49: { static const bool value = false; }; Chris@49: Chris@49: template Chris@49: struct is_mtOpCube< mtOpCube > Chris@49: { static const bool value = true; }; Chris@49: Chris@49: Chris@49: template Chris@49: struct is_GlueCube Chris@49: { static const bool value = false; }; Chris@49: Chris@49: template Chris@49: struct is_GlueCube< GlueCube > Chris@49: { static const bool value = true; }; Chris@49: Chris@49: Chris@49: template Chris@49: struct is_eGlueCube Chris@49: { static const bool value = false; }; Chris@49: Chris@49: template Chris@49: struct is_eGlueCube< eGlueCube > Chris@49: { static const bool value = true; }; Chris@49: Chris@49: Chris@49: template Chris@49: struct is_mtGlueCube Chris@49: { static const bool value = false; }; Chris@49: Chris@49: template Chris@49: struct is_mtGlueCube< mtGlueCube > Chris@49: { static const bool value = true; }; Chris@49: Chris@49: Chris@49: // Chris@49: // Chris@49: // Chris@49: Chris@49: Chris@49: template Chris@49: struct is_op_rel Chris@49: { static const bool value = false; }; Chris@49: Chris@49: template Chris@49: struct is_op_rel< mtOp > Chris@49: { static const bool value = true; }; Chris@49: Chris@49: template Chris@49: struct is_op_rel< mtOp > Chris@49: { static const bool value = true; }; Chris@49: Chris@49: template Chris@49: struct is_op_rel< mtOp > Chris@49: { static const bool value = true; }; Chris@49: Chris@49: template Chris@49: struct is_op_rel< mtOp > Chris@49: { static const bool value = true; }; Chris@49: Chris@49: template Chris@49: struct is_op_rel< mtOp > Chris@49: { static const bool value = true; }; Chris@49: Chris@49: template Chris@49: struct is_op_rel< mtOp > Chris@49: { static const bool value = true; }; Chris@49: Chris@49: template Chris@49: struct is_op_rel< mtOp > Chris@49: { static const bool value = true; }; Chris@49: Chris@49: template Chris@49: struct is_op_rel< mtOp > Chris@49: { static const bool value = true; }; Chris@49: Chris@49: template Chris@49: struct is_op_rel< mtOp > Chris@49: { static const bool value = true; }; Chris@49: Chris@49: template Chris@49: struct is_op_rel< mtOp > Chris@49: { static const bool value = true; }; Chris@49: Chris@49: Chris@49: Chris@49: // Chris@49: // Chris@49: // Chris@49: Chris@49: Chris@49: Chris@49: template Chris@49: struct is_basevec Chris@49: { static const bool value = ( is_Row_fixed_only::value || is_Col_fixed_only::value ); }; Chris@49: Chris@49: template Chris@49: struct is_basevec< Row > Chris@49: { static const bool value = true; }; Chris@49: Chris@49: template Chris@49: struct is_basevec< const Row > Chris@49: { static const bool value = true; }; Chris@49: Chris@49: template Chris@49: struct is_basevec< Col > Chris@49: { static const bool value = true; }; Chris@49: Chris@49: template Chris@49: struct is_basevec< const Col > Chris@49: { static const bool value = true; }; Chris@49: Chris@49: template Chris@49: struct is_basevec< subview_row > Chris@49: { static const bool value = true; }; Chris@49: Chris@49: template Chris@49: struct is_basevec< const subview_row > Chris@49: { static const bool value = true; }; Chris@49: Chris@49: template Chris@49: struct is_basevec< subview_col > Chris@49: { static const bool value = true; }; Chris@49: Chris@49: template Chris@49: struct is_basevec< const subview_col > Chris@49: { static const bool value = true; }; Chris@49: Chris@49: template Chris@49: struct is_basevec< diagview > Chris@49: { static const bool value = true; }; Chris@49: Chris@49: template Chris@49: struct is_basevec< const diagview > Chris@49: { static const bool value = true; }; Chris@49: Chris@49: template Chris@49: struct is_basevec< subview_elem1 > Chris@49: { static const bool value = true; }; Chris@49: Chris@49: template Chris@49: struct is_basevec< const subview_elem1 > Chris@49: { static const bool value = true; }; Chris@49: Chris@49: Chris@49: // Chris@49: // Chris@49: // Chris@49: Chris@49: Chris@49: Chris@49: template Chris@49: struct is_arma_type Chris@49: { Chris@49: static const bool value Chris@49: = is_Mat::value Chris@49: || is_Gen::value Chris@49: || is_Op::value Chris@49: || is_Glue::value Chris@49: || is_eOp::value Chris@49: || is_eGlue::value Chris@49: || is_mtOp::value Chris@49: || is_mtGlue::value Chris@49: || is_diagview::value Chris@49: || is_subview::value Chris@49: || is_subview_row::value Chris@49: || is_subview_col::value Chris@49: || is_subview_elem1::value Chris@49: || is_subview_elem2::value Chris@49: ; Chris@49: }; Chris@49: Chris@49: Chris@49: Chris@49: template Chris@49: struct is_arma_cube_type Chris@49: { Chris@49: static const bool value Chris@49: = is_Cube::value Chris@49: || is_GenCube::value Chris@49: || is_OpCube::value Chris@49: || is_eOpCube::value Chris@49: || is_mtOpCube::value Chris@49: || is_GlueCube::value Chris@49: || is_eGlueCube::value Chris@49: || is_mtGlueCube::value Chris@49: || is_subview_cube::value Chris@49: ; Chris@49: }; Chris@49: Chris@49: Chris@49: Chris@49: // Chris@49: // Chris@49: // Chris@49: Chris@49: Chris@49: Chris@49: template Chris@49: struct is_SpMat Chris@49: { static const bool value = false; }; Chris@49: Chris@49: template Chris@49: struct is_SpMat< SpMat > Chris@49: { static const bool value = true; }; Chris@49: Chris@49: template Chris@49: struct is_SpMat< SpCol > Chris@49: { static const bool value = true; }; Chris@49: Chris@49: template Chris@49: struct is_SpMat< SpRow > Chris@49: { static const bool value = true; }; Chris@49: Chris@49: Chris@49: Chris@49: template Chris@49: struct is_SpRow Chris@49: { static const bool value = false; }; Chris@49: Chris@49: template Chris@49: struct is_SpRow< SpRow > Chris@49: { static const bool value = true; }; Chris@49: Chris@49: Chris@49: Chris@49: template Chris@49: struct is_SpCol Chris@49: { static const bool value = false; }; Chris@49: Chris@49: template Chris@49: struct is_SpCol< SpCol > Chris@49: { static const bool value = true; }; Chris@49: Chris@49: Chris@49: Chris@49: template Chris@49: struct is_SpSubview Chris@49: { static const bool value = false; }; Chris@49: Chris@49: template Chris@49: struct is_SpSubview< SpSubview > Chris@49: { static const bool value = true; }; Chris@49: Chris@49: Chris@49: template Chris@49: struct is_SpOp Chris@49: { static const bool value = false; }; Chris@49: Chris@49: template Chris@49: struct is_SpOp< SpOp > Chris@49: { static const bool value = true; }; Chris@49: Chris@49: Chris@49: template Chris@49: struct is_SpGlue Chris@49: { static const bool value = false; }; Chris@49: Chris@49: template Chris@49: struct is_SpGlue< SpGlue > Chris@49: { static const bool value = true; }; Chris@49: Chris@49: Chris@49: template Chris@49: struct is_mtSpOp Chris@49: { static const bool value = false; }; Chris@49: Chris@49: template Chris@49: struct is_mtSpOp< mtSpOp > Chris@49: { static const bool value = true; }; Chris@49: Chris@49: Chris@49: Chris@49: template Chris@49: struct is_arma_sparse_type Chris@49: { Chris@49: static const bool value Chris@49: = is_SpMat::value Chris@49: || is_SpSubview::value Chris@49: || is_SpOp::value Chris@49: || is_SpGlue::value Chris@49: || is_mtSpOp::value Chris@49: ; Chris@49: }; Chris@49: Chris@49: Chris@49: Chris@49: // Chris@49: // Chris@49: // Chris@49: Chris@49: Chris@49: template Chris@49: struct is_same_type Chris@49: { static const bool value = false; }; Chris@49: Chris@49: Chris@49: template Chris@49: struct is_same_type Chris@49: { static const bool value = true; }; Chris@49: Chris@49: Chris@49: Chris@49: // Chris@49: // Chris@49: // Chris@49: Chris@49: Chris@49: template Chris@49: struct is_u8 Chris@49: { static const bool value = false; }; Chris@49: Chris@49: template<> Chris@49: struct is_u8 Chris@49: { static const bool value = true; }; Chris@49: Chris@49: Chris@49: Chris@49: template Chris@49: struct is_s8 Chris@49: { static const bool value = false; }; Chris@49: Chris@49: template<> Chris@49: struct is_s8 Chris@49: { static const bool value = true; }; Chris@49: Chris@49: Chris@49: Chris@49: template Chris@49: struct is_u16 Chris@49: { static const bool value = false; }; Chris@49: Chris@49: template<> Chris@49: struct is_u16 Chris@49: { static const bool value = true; }; Chris@49: Chris@49: Chris@49: Chris@49: template Chris@49: struct is_s16 Chris@49: { static const bool value = false; }; Chris@49: Chris@49: template<> Chris@49: struct is_s16 Chris@49: { static const bool value = true; }; Chris@49: Chris@49: Chris@49: Chris@49: template Chris@49: struct is_u32 Chris@49: { static const bool value = false; }; Chris@49: Chris@49: template<> Chris@49: struct is_u32 Chris@49: { static const bool value = true; }; Chris@49: Chris@49: Chris@49: Chris@49: template Chris@49: struct is_s32 Chris@49: { static const bool value = false; }; Chris@49: Chris@49: template<> Chris@49: struct is_s32 Chris@49: { static const bool value = true; }; Chris@49: Chris@49: Chris@49: Chris@49: #if defined(ARMA_USE_U64S64) Chris@49: template Chris@49: struct is_u64 Chris@49: { static const bool value = false; }; Chris@49: Chris@49: template<> Chris@49: struct is_u64 Chris@49: { static const bool value = true; }; Chris@49: Chris@49: Chris@49: template Chris@49: struct is_s64 Chris@49: { static const bool value = false; }; Chris@49: Chris@49: template<> Chris@49: struct is_s64 Chris@49: { static const bool value = true; }; Chris@49: #endif Chris@49: Chris@49: Chris@49: Chris@49: template Chris@49: struct is_ulng_t Chris@49: { static const bool value = false; }; Chris@49: Chris@49: template<> Chris@49: struct is_ulng_t Chris@49: { static const bool value = true; }; Chris@49: Chris@49: Chris@49: Chris@49: template Chris@49: struct is_slng_t Chris@49: { static const bool value = false; }; Chris@49: Chris@49: template<> Chris@49: struct is_slng_t Chris@49: { static const bool value = true; }; Chris@49: Chris@49: Chris@49: Chris@49: template Chris@49: struct is_ulng_t_32 Chris@49: { static const bool value = false; }; Chris@49: Chris@49: template<> Chris@49: struct is_ulng_t_32 Chris@49: { static const bool value = (sizeof(ulng_t) == 4); }; Chris@49: Chris@49: Chris@49: Chris@49: template Chris@49: struct is_slng_t_32 Chris@49: { static const bool value = false; }; Chris@49: Chris@49: template<> Chris@49: struct is_slng_t_32 Chris@49: { static const bool value = (sizeof(slng_t) == 4); }; Chris@49: Chris@49: Chris@49: Chris@49: template Chris@49: struct is_ulng_t_64 Chris@49: { static const bool value = false; }; Chris@49: Chris@49: template<> Chris@49: struct is_ulng_t_64 Chris@49: { static const bool value = (sizeof(ulng_t) == 8); }; Chris@49: Chris@49: Chris@49: Chris@49: template Chris@49: struct is_slng_t_64 Chris@49: { static const bool value = false; }; Chris@49: Chris@49: template<> Chris@49: struct is_slng_t_64 Chris@49: { static const bool value = (sizeof(slng_t) == 8); }; Chris@49: Chris@49: Chris@49: Chris@49: template Chris@49: struct is_uword Chris@49: { static const bool value = false; }; Chris@49: Chris@49: template<> Chris@49: struct is_uword Chris@49: { static const bool value = true; }; Chris@49: Chris@49: Chris@49: Chris@49: template Chris@49: struct is_sword Chris@49: { static const bool value = false; }; Chris@49: Chris@49: template<> Chris@49: struct is_sword Chris@49: { static const bool value = true; }; Chris@49: Chris@49: Chris@49: Chris@49: template Chris@49: struct is_float Chris@49: { static const bool value = false; }; Chris@49: Chris@49: template<> Chris@49: struct is_float Chris@49: { static const bool value = true; }; Chris@49: Chris@49: Chris@49: Chris@49: template Chris@49: struct is_double Chris@49: { static const bool value = false; }; Chris@49: Chris@49: template<> Chris@49: struct is_double Chris@49: { static const bool value = true; }; Chris@49: Chris@49: Chris@49: Chris@49: template Chris@49: struct is_real Chris@49: { static const bool value = false; }; Chris@49: Chris@49: template<> Chris@49: struct is_real Chris@49: { static const bool value = true; }; Chris@49: Chris@49: template<> Chris@49: struct is_real Chris@49: { static const bool value = true; }; Chris@49: Chris@49: Chris@49: Chris@49: Chris@49: template Chris@49: struct is_not_complex Chris@49: { static const bool value = true; }; Chris@49: Chris@49: template Chris@49: struct is_not_complex< std::complex > Chris@49: { static const bool value = false; }; Chris@49: Chris@49: Chris@49: Chris@49: template Chris@49: struct is_complex Chris@49: { static const bool value = false; }; Chris@49: Chris@49: // template<> Chris@49: template Chris@49: struct is_complex< std::complex > Chris@49: { static const bool value = true; }; Chris@49: Chris@49: Chris@49: Chris@49: template Chris@49: struct is_complex_float Chris@49: { static const bool value = false; }; Chris@49: Chris@49: template<> Chris@49: struct is_complex_float< std::complex > Chris@49: { static const bool value = true; }; Chris@49: Chris@49: Chris@49: Chris@49: template Chris@49: struct is_complex_double Chris@49: { static const bool value = false; }; Chris@49: Chris@49: template<> Chris@49: struct is_complex_double< std::complex > Chris@49: { static const bool value = true; }; Chris@49: Chris@49: Chris@49: Chris@49: template Chris@49: struct is_complex_strict Chris@49: { static const bool value = false; }; Chris@49: Chris@49: template<> Chris@49: struct is_complex_strict< std::complex > Chris@49: { static const bool value = true; }; Chris@49: Chris@49: template<> Chris@49: struct is_complex_strict< std::complex > Chris@49: { static const bool value = true; }; Chris@49: Chris@49: Chris@49: Chris@49: //! check for a weird implementation of the std::complex class Chris@49: template Chris@49: struct is_supported_complex Chris@49: { static const bool value = false; }; Chris@49: Chris@49: //template<> Chris@49: template Chris@49: struct is_supported_complex< std::complex > Chris@49: { static const bool value = ( sizeof(std::complex) == 2*sizeof(eT) ); }; Chris@49: Chris@49: Chris@49: Chris@49: template Chris@49: struct is_supported_complex_float Chris@49: { static const bool value = false; }; Chris@49: Chris@49: template<> Chris@49: struct is_supported_complex_float< std::complex > Chris@49: { static const bool value = ( sizeof(std::complex) == 2*sizeof(float) ); }; Chris@49: Chris@49: Chris@49: Chris@49: template Chris@49: struct is_supported_complex_double Chris@49: { static const bool value = false; }; Chris@49: Chris@49: template<> Chris@49: struct is_supported_complex_double< std::complex > Chris@49: { static const bool value = ( sizeof(std::complex) == 2*sizeof(double) ); }; Chris@49: Chris@49: Chris@49: Chris@49: template Chris@49: struct is_supported_elem_type Chris@49: { Chris@49: static const bool value = \ Chris@49: is_u8::value || Chris@49: is_s8::value || Chris@49: is_u16::value || Chris@49: is_s16::value || Chris@49: is_u32::value || Chris@49: is_s32::value || Chris@49: #if defined(ARMA_USE_U64S64) Chris@49: is_u64::value || Chris@49: is_s64::value || Chris@49: #endif Chris@49: #if defined(ARMA_ALLOW_LONG) Chris@49: is_ulng_t::value || Chris@49: is_slng_t::value || Chris@49: #endif Chris@49: is_float::value || Chris@49: is_double::value || Chris@49: is_supported_complex_float::value || Chris@49: is_supported_complex_double::value; Chris@49: }; Chris@49: Chris@49: Chris@49: Chris@49: template Chris@49: struct is_supported_blas_type Chris@49: { Chris@49: static const bool value = \ Chris@49: is_float::value || Chris@49: is_double::value || Chris@49: is_supported_complex_float::value || Chris@49: is_supported_complex_double::value; Chris@49: }; Chris@49: Chris@49: Chris@49: Chris@49: template Chris@49: struct is_signed Chris@49: { Chris@49: static const bool value = true; Chris@49: }; Chris@49: Chris@49: Chris@49: template<> struct is_signed { static const bool value = false; }; Chris@49: template<> struct is_signed { static const bool value = false; }; Chris@49: template<> struct is_signed { static const bool value = false; }; Chris@49: #if defined(ARMA_USE_U64S64) Chris@49: template<> struct is_signed { static const bool value = false; }; Chris@49: #endif Chris@49: #if defined(ARMA_ALLOW_LONG) Chris@49: template<> struct is_signed { static const bool value = false; }; Chris@49: #endif Chris@49: Chris@49: Chris@49: template Chris@49: struct is_non_integral Chris@49: { Chris@49: static const bool value = false; Chris@49: }; Chris@49: Chris@49: Chris@49: template<> struct is_non_integral< float > { static const bool value = true; }; Chris@49: template<> struct is_non_integral< double > { static const bool value = true; }; Chris@49: template<> struct is_non_integral< std::complex > { static const bool value = true; }; Chris@49: template<> struct is_non_integral< std::complex > { static const bool value = true; }; Chris@49: Chris@49: Chris@49: Chris@49: Chris@49: // Chris@49: Chris@49: class arma_junk_class; Chris@49: Chris@49: template Chris@49: struct force_different_type Chris@49: { Chris@49: typedef T1 T1_result; Chris@49: typedef T2 T2_result; Chris@49: }; Chris@49: Chris@49: Chris@49: template Chris@49: struct force_different_type Chris@49: { Chris@49: typedef T1 T1_result; Chris@49: typedef arma_junk_class T2_result; Chris@49: }; Chris@49: Chris@49: Chris@49: Chris@49: // Chris@49: Chris@49: Chris@49: template Chris@49: struct resolves_to_vector_default { static const bool value = false; }; Chris@49: Chris@49: template Chris@49: struct resolves_to_vector_test { static const bool value = T1::is_col || T1::is_row; }; Chris@49: Chris@49: Chris@49: template Chris@49: struct resolves_to_vector_redirect {}; Chris@49: Chris@49: template Chris@49: struct resolves_to_vector_redirect { typedef resolves_to_vector_default result; }; Chris@49: Chris@49: template Chris@49: struct resolves_to_vector_redirect { typedef resolves_to_vector_test result; }; Chris@49: Chris@49: Chris@49: template Chris@49: struct resolves_to_vector : public resolves_to_vector_redirect::value>::result {}; Chris@49: Chris@49: template Chris@49: struct resolves_to_sparse_vector : public resolves_to_vector_redirect::value>::result {}; Chris@49: Chris@49: Chris@49: Chris@49: template struct is_glue_mixed_times { static const bool value = false; }; Chris@49: template<> struct is_glue_mixed_times { static const bool value = true; }; Chris@49: Chris@49: Chris@49: Chris@49: template struct is_glue_mixed_elem { static const bool value = false; }; Chris@49: Chris@49: template<> struct is_glue_mixed_elem { static const bool value = true; }; Chris@49: template<> struct is_glue_mixed_elem { static const bool value = true; }; Chris@49: template<> struct is_glue_mixed_elem { static const bool value = true; }; Chris@49: template<> struct is_glue_mixed_elem { static const bool value = true; }; Chris@49: Chris@49: template<> struct is_glue_mixed_elem { static const bool value = true; }; Chris@49: template<> struct is_glue_mixed_elem { static const bool value = true; }; Chris@49: template<> struct is_glue_mixed_elem { static const bool value = true; }; Chris@49: template<> struct is_glue_mixed_elem { static const bool value = true; }; Chris@49: template<> struct is_glue_mixed_elem { static const bool value = true; }; Chris@49: template<> struct is_glue_mixed_elem { static const bool value = true; }; Chris@49: Chris@49: Chris@49: Chris@49: template struct is_op_mixed_elem { static const bool value = false; }; Chris@49: Chris@49: template<> struct is_op_mixed_elem { static const bool value = true; }; Chris@49: template<> struct is_op_mixed_elem { static const bool value = true; }; Chris@49: template<> struct is_op_mixed_elem { static const bool value = true; }; Chris@49: template<> struct is_op_mixed_elem { static const bool value = true; }; Chris@49: template<> struct is_op_mixed_elem { static const bool value = true; }; Chris@49: template<> struct is_op_mixed_elem { static const bool value = true; }; Chris@49: Chris@49: template<> struct is_op_mixed_elem { static const bool value = true; }; Chris@49: template<> struct is_op_mixed_elem { static const bool value = true; }; Chris@49: template<> struct is_op_mixed_elem { static const bool value = true; }; Chris@49: template<> struct is_op_mixed_elem { static const bool value = true; }; Chris@49: template<> struct is_op_mixed_elem { static const bool value = true; }; Chris@49: template<> struct is_op_mixed_elem { static const bool value = true; }; Chris@49: template<> struct is_op_mixed_elem { static const bool value = true; }; Chris@49: template<> struct is_op_mixed_elem { static const bool value = true; }; Chris@49: template<> struct is_op_mixed_elem { static const bool value = true; }; Chris@49: template<> struct is_op_mixed_elem { static const bool value = true; }; Chris@49: Chris@49: Chris@49: Chris@49: template struct is_spop_elem { static const bool value = false; }; Chris@49: template<> struct is_spop_elem { static const bool value = true; }; Chris@49: Chris@49: Chris@49: template struct is_spglue_elem { static const bool value = false; }; Chris@49: template<> struct is_spglue_elem { static const bool value = true; }; Chris@49: template<> struct is_spglue_elem { static const bool value = true; }; Chris@49: template<> struct is_spglue_elem { static const bool value = true; }; Chris@49: template<> struct is_spglue_elem { static const bool value = true; }; Chris@49: Chris@49: Chris@49: template struct is_spglue_times { static const bool value = false; }; Chris@49: template<> struct is_spglue_times { static const bool value = true; }; Chris@49: Chris@49: Chris@49: template struct is_spglue_times2 { static const bool value = false; }; Chris@49: template<> struct is_spglue_times { static const bool value = true; }; Chris@49: Chris@49: Chris@49: Chris@49: //! @}