annotate armadillo-3.900.4/include/armadillo_bits/restrictors.hpp @ 84:55a047986812 tip

Update library URI so as not to be document-local
author Chris Cannam
date Wed, 22 Apr 2020 14:21:57 +0100
parents 1ec0e2823891
children
rev   line source
Chris@49 1 // Copyright (C) 2010-2013 NICTA (www.nicta.com.au)
Chris@49 2 // Copyright (C) 2010-2013 Conrad Sanderson
Chris@49 3 //
Chris@49 4 // This Source Code Form is subject to the terms of the Mozilla Public
Chris@49 5 // License, v. 2.0. If a copy of the MPL was not distributed with this
Chris@49 6 // file, You can obtain one at http://mozilla.org/MPL/2.0/.
Chris@49 7
Chris@49 8
Chris@49 9 //! \addtogroup restrictors
Chris@49 10 //! @{
Chris@49 11
Chris@49 12
Chris@49 13
Chris@49 14 // structures for template based restrictions of input/output arguments
Chris@49 15 // (part of the SFINAE approach)
Chris@49 16 // http://en.wikipedia.org/wiki/SFINAE
Chris@49 17
Chris@49 18
Chris@49 19 template<typename T> struct arma_scalar_only { };
Chris@49 20
Chris@49 21 template<> struct arma_scalar_only<u8> { typedef u8 result; };
Chris@49 22 template<> struct arma_scalar_only<s8> { typedef s8 result; };
Chris@49 23 template<> struct arma_scalar_only<u16> { typedef u16 result; };
Chris@49 24 template<> struct arma_scalar_only<s16> { typedef s16 result; };
Chris@49 25 template<> struct arma_scalar_only<u32> { typedef u32 result; };
Chris@49 26 template<> struct arma_scalar_only<s32> { typedef s32 result; };
Chris@49 27 #if defined(ARMA_USE_U64S64)
Chris@49 28 template<> struct arma_scalar_only<u64> { typedef u64 result; };
Chris@49 29 template<> struct arma_scalar_only<s64> { typedef s64 result; };
Chris@49 30 #endif
Chris@49 31 template<> struct arma_scalar_only<float> { typedef float result; };
Chris@49 32 template<> struct arma_scalar_only<double> { typedef double result; };
Chris@49 33 #if defined(ARMA_ALLOW_LONG)
Chris@49 34 template<> struct arma_scalar_only<ulng_t> { typedef ulng_t result; };
Chris@49 35 template<> struct arma_scalar_only<slng_t> { typedef slng_t result; };
Chris@49 36 #endif
Chris@49 37
Chris@49 38 template<typename T>
Chris@49 39 struct arma_scalar_only< std::complex<T> > { typedef std::complex<T> result; };
Chris@49 40
Chris@49 41
Chris@49 42
Chris@49 43 template<typename T> struct arma_integral_only { };
Chris@49 44
Chris@49 45 template<> struct arma_integral_only<u8> { typedef u8 result; };
Chris@49 46 template<> struct arma_integral_only<s8> { typedef s8 result; };
Chris@49 47 template<> struct arma_integral_only<u16> { typedef u16 result; };
Chris@49 48 template<> struct arma_integral_only<s16> { typedef s16 result; };
Chris@49 49 template<> struct arma_integral_only<u32> { typedef u32 result; };
Chris@49 50 template<> struct arma_integral_only<s32> { typedef s32 result; };
Chris@49 51 #if defined(ARMA_USE_U64S64)
Chris@49 52 template<> struct arma_integral_only<u64> { typedef u64 result; };
Chris@49 53 template<> struct arma_integral_only<s64> { typedef s64 result; };
Chris@49 54 #endif
Chris@49 55 #if defined(ARMA_ALLOW_LONG)
Chris@49 56 template<> struct arma_integral_only<ulng_t> { typedef ulng_t result; };
Chris@49 57 template<> struct arma_integral_only<slng_t> { typedef slng_t result; };
Chris@49 58 #endif
Chris@49 59
Chris@49 60
Chris@49 61
Chris@49 62 template<typename T> struct arma_unsigned_integral_only { };
Chris@49 63
Chris@49 64 template<> struct arma_unsigned_integral_only<u8> { typedef u8 result; };
Chris@49 65 template<> struct arma_unsigned_integral_only<u16> { typedef u16 result; };
Chris@49 66 template<> struct arma_unsigned_integral_only<u32> { typedef u32 result; };
Chris@49 67 #if defined(ARMA_USE_U64S64)
Chris@49 68 template<> struct arma_unsigned_integral_only<u64> { typedef u64 result; };
Chris@49 69 #endif
Chris@49 70 #if defined(ARMA_ALLOW_LONG)
Chris@49 71 template<> struct arma_unsigned_integral_only<ulng_t> { typedef ulng_t result; };
Chris@49 72 #endif
Chris@49 73
Chris@49 74
Chris@49 75
Chris@49 76 template<typename T> struct arma_signed_integral_only { };
Chris@49 77
Chris@49 78 template<> struct arma_signed_integral_only<s8> { typedef s8 result; };
Chris@49 79 template<> struct arma_signed_integral_only<s16> { typedef s16 result; };
Chris@49 80 template<> struct arma_signed_integral_only<s32> { typedef s32 result; };
Chris@49 81 #if defined(ARMA_USE_U64S64)
Chris@49 82 template<> struct arma_signed_integral_only<s64> { typedef s64 result; };
Chris@49 83 #endif
Chris@49 84 #if defined(ARMA_ALLOW_LONG)
Chris@49 85 template<> struct arma_signed_integral_only<slng_t> { typedef slng_t result; };
Chris@49 86 #endif
Chris@49 87
Chris@49 88
Chris@49 89
Chris@49 90 template<typename T> struct arma_signed_only { };
Chris@49 91
Chris@49 92 template<> struct arma_signed_only<s8> { typedef s8 result; };
Chris@49 93 template<> struct arma_signed_only<s16> { typedef s16 result; };
Chris@49 94 template<> struct arma_signed_only<s32> { typedef s32 result; };
Chris@49 95 #if defined(ARMA_USE_U64S64)
Chris@49 96 template<> struct arma_signed_only<s64> { typedef s64 result; };
Chris@49 97 #endif
Chris@49 98 template<> struct arma_signed_only<float> { typedef float result; };
Chris@49 99 template<> struct arma_signed_only<double> { typedef double result; };
Chris@49 100 #if defined(ARMA_ALLOW_LONG)
Chris@49 101 template<> struct arma_signed_only<slng_t> { typedef slng_t result; };
Chris@49 102 #endif
Chris@49 103
Chris@49 104 template<typename T> struct arma_signed_only< std::complex<T> > { typedef std::complex<T> result; };
Chris@49 105
Chris@49 106
Chris@49 107
Chris@49 108 template<typename T> struct arma_real_only { };
Chris@49 109
Chris@49 110 template<> struct arma_real_only<float> { typedef float result; };
Chris@49 111 template<> struct arma_real_only<double> { typedef double result; };
Chris@49 112
Chris@49 113
Chris@49 114 template<typename T> struct arma_real_or_cx_only { };
Chris@49 115
Chris@49 116 template<> struct arma_real_or_cx_only< float > { typedef float result; };
Chris@49 117 template<> struct arma_real_or_cx_only< double > { typedef double result; };
Chris@49 118 template<> struct arma_real_or_cx_only< std::complex<float> > { typedef std::complex<float> result; };
Chris@49 119 template<> struct arma_real_or_cx_only< std::complex<double> > { typedef std::complex<double> result; };
Chris@49 120
Chris@49 121
Chris@49 122
Chris@49 123 template<typename T> struct arma_cx_only { };
Chris@49 124
Chris@49 125 template<> struct arma_cx_only< std::complex<float> > { typedef std::complex<float> result; };
Chris@49 126 template<> struct arma_cx_only< std::complex<double> > { typedef std::complex<double> result; };
Chris@49 127
Chris@49 128
Chris@49 129
Chris@49 130 template<typename T> struct arma_not_cx { typedef T result; };
Chris@49 131 template<typename T> struct arma_not_cx< std::complex<T> > { };
Chris@49 132
Chris@49 133
Chris@49 134
Chris@49 135 template<typename T> struct arma_blas_type_only { };
Chris@49 136
Chris@49 137 template<> struct arma_blas_type_only< float > { typedef float result; };
Chris@49 138 template<> struct arma_blas_type_only< double > { typedef double result; };
Chris@49 139 template<> struct arma_blas_type_only< std::complex<float> > { typedef std::complex<float> result; };
Chris@49 140 template<> struct arma_blas_type_only< std::complex<double> > { typedef std::complex<double> result; };
Chris@49 141
Chris@49 142
Chris@49 143
Chris@49 144 template<typename T> struct arma_not_blas_type { typedef T result; };
Chris@49 145
Chris@49 146 template<> struct arma_not_blas_type< float > { };
Chris@49 147 template<> struct arma_not_blas_type< double > { };
Chris@49 148 template<> struct arma_not_blas_type< std::complex<float> > { };
Chris@49 149 template<> struct arma_not_blas_type< std::complex<double> > { };
Chris@49 150
Chris@49 151
Chris@49 152
Chris@49 153 template<typename T> struct arma_op_rel_only { };
Chris@49 154
Chris@49 155 template<> struct arma_op_rel_only< op_rel_lt_pre > { typedef int result; };
Chris@49 156 template<> struct arma_op_rel_only< op_rel_lt_post > { typedef int result; };
Chris@49 157 template<> struct arma_op_rel_only< op_rel_gt_pre > { typedef int result; };
Chris@49 158 template<> struct arma_op_rel_only< op_rel_gt_post > { typedef int result; };
Chris@49 159 template<> struct arma_op_rel_only< op_rel_lteq_pre > { typedef int result; };
Chris@49 160 template<> struct arma_op_rel_only< op_rel_lteq_post > { typedef int result; };
Chris@49 161 template<> struct arma_op_rel_only< op_rel_gteq_pre > { typedef int result; };
Chris@49 162 template<> struct arma_op_rel_only< op_rel_gteq_post > { typedef int result; };
Chris@49 163 template<> struct arma_op_rel_only< op_rel_eq > { typedef int result; };
Chris@49 164 template<> struct arma_op_rel_only< op_rel_noteq > { typedef int result; };
Chris@49 165
Chris@49 166
Chris@49 167
Chris@49 168 template<typename T> struct arma_not_op_rel { typedef int result; };
Chris@49 169
Chris@49 170 template<> struct arma_not_op_rel< op_rel_lt_pre > { };
Chris@49 171 template<> struct arma_not_op_rel< op_rel_lt_post > { };
Chris@49 172 template<> struct arma_not_op_rel< op_rel_gt_pre > { };
Chris@49 173 template<> struct arma_not_op_rel< op_rel_gt_post > { };
Chris@49 174 template<> struct arma_not_op_rel< op_rel_lteq_pre > { };
Chris@49 175 template<> struct arma_not_op_rel< op_rel_lteq_post > { };
Chris@49 176 template<> struct arma_not_op_rel< op_rel_gteq_pre > { };
Chris@49 177 template<> struct arma_not_op_rel< op_rel_gteq_post > { };
Chris@49 178 template<> struct arma_not_op_rel< op_rel_eq > { };
Chris@49 179 template<> struct arma_not_op_rel< op_rel_noteq > { };
Chris@49 180
Chris@49 181
Chris@49 182
Chris@49 183 template<typename T> struct arma_glue_rel_only { };
Chris@49 184
Chris@49 185 template<> struct arma_glue_rel_only< glue_rel_lt > { typedef int result; };
Chris@49 186 template<> struct arma_glue_rel_only< glue_rel_gt > { typedef int result; };
Chris@49 187 template<> struct arma_glue_rel_only< glue_rel_lteq > { typedef int result; };
Chris@49 188 template<> struct arma_glue_rel_only< glue_rel_gteq > { typedef int result; };
Chris@49 189 template<> struct arma_glue_rel_only< glue_rel_eq > { typedef int result; };
Chris@49 190 template<> struct arma_glue_rel_only< glue_rel_noteq > { typedef int result; };
Chris@49 191
Chris@49 192
Chris@49 193
Chris@49 194 template<typename T> struct arma_Mat_Col_Row_only { };
Chris@49 195
Chris@49 196 template<typename eT> struct arma_Mat_Col_Row_only< Mat<eT> > { typedef Mat<eT> result; };
Chris@49 197 template<typename eT> struct arma_Mat_Col_Row_only< Col<eT> > { typedef Col<eT> result; };
Chris@49 198 template<typename eT> struct arma_Mat_Col_Row_only< Row<eT> > { typedef Row<eT> result; };
Chris@49 199
Chris@49 200
Chris@49 201
Chris@49 202 template<typename T> struct arma_Cube_only { };
Chris@49 203 template<typename eT> struct arma_Cube_only< Cube<eT> > { typedef Cube<eT> result; };
Chris@49 204
Chris@49 205
Chris@49 206 template<typename T> struct arma_SpMat_SpCol_SpRow_only { };
Chris@49 207
Chris@49 208 template<typename eT> struct arma_SpMat_SpCol_SpRow_only< SpMat<eT> > { typedef SpMat<eT> result; };
Chris@49 209 template<typename eT> struct arma_SpMat_SpCol_SpRow_only< SpCol<eT> > { typedef SpCol<eT> result; };
Chris@49 210 template<typename eT> struct arma_SpMat_SpCol_SpRow_only< SpRow<eT> > { typedef SpRow<eT> result; };
Chris@49 211
Chris@49 212
Chris@49 213
Chris@49 214 template<bool> struct enable_if { };
Chris@49 215 template<> struct enable_if<true> { typedef int result; };
Chris@49 216
Chris@49 217
Chris@49 218 template<bool, typename result_type > struct enable_if2 { };
Chris@49 219 template< typename result_type > struct enable_if2<true, result_type> { typedef result_type result; };
Chris@49 220
Chris@49 221
Chris@49 222
Chris@49 223 //! @}