comparison armadillo-3.900.4/include/armadillo_bits/restrictors.hpp @ 49:1ec0e2823891

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