Mercurial > hg > segmenter-vamp-plugin
comparison armadillo-2.4.4/include/armadillo_bits/restrictors.hpp @ 0:8b6102e2a9b0
Armadillo Library
author | maxzanoni76 <max.zanoni@eecs.qmul.ac.uk> |
---|---|
date | Wed, 11 Apr 2012 09:27:06 +0100 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:8b6102e2a9b0 |
---|---|
1 // Copyright (C) 2010-2011 NICTA (www.nicta.com.au) | |
2 // Copyright (C) 2010-2011 Conrad Sanderson | |
3 // | |
4 // This file is part of the Armadillo C++ library. | |
5 // It is provided without any warranty of fitness | |
6 // for any purpose. You can redistribute this file | |
7 // and/or modify it under the terms of the GNU | |
8 // Lesser General Public License (LGPL) as published | |
9 // by the Free Software Foundation, either version 3 | |
10 // of the License or (at your option) any later version. | |
11 // (see http://www.opensource.org/licenses for more info) | |
12 | |
13 | |
14 //! \addtogroup restrictors | |
15 //! @{ | |
16 | |
17 | |
18 | |
19 // structures for template based restrictions of input/output arguments | |
20 // (part of the SFINAE approach) | |
21 // http://en.wikipedia.org/wiki/SFINAE | |
22 | |
23 | |
24 template<typename T> struct arma_scalar_only { }; | |
25 | |
26 template<> struct arma_scalar_only<u8> { typedef u8 result; }; | |
27 template<> struct arma_scalar_only<s8> { typedef s8 result; }; | |
28 template<> struct arma_scalar_only<u16> { typedef u16 result; }; | |
29 template<> struct arma_scalar_only<s16> { typedef s16 result; }; | |
30 template<> struct arma_scalar_only<u32> { typedef u32 result; }; | |
31 template<> struct arma_scalar_only<s32> { typedef s32 result; }; | |
32 #if defined(ARMA_64BIT_WORD) | |
33 template<> struct arma_scalar_only<u64> { typedef u64 result; }; | |
34 template<> struct arma_scalar_only<s64> { typedef s64 result; }; | |
35 #endif | |
36 template<> struct arma_scalar_only<float> { typedef float result; }; | |
37 template<> struct arma_scalar_only<double> { typedef double result; }; | |
38 | |
39 | |
40 template<typename T> | |
41 struct arma_scalar_only< std::complex<T> > { typedef std::complex<T> result; }; | |
42 | |
43 | |
44 | |
45 template<typename T> struct arma_integral_only { }; | |
46 | |
47 template<> struct arma_integral_only<u8> { typedef u8 result; }; | |
48 template<> struct arma_integral_only<s8> { typedef s8 result; }; | |
49 template<> struct arma_integral_only<u16> { typedef u16 result; }; | |
50 template<> struct arma_integral_only<s16> { typedef s16 result; }; | |
51 template<> struct arma_integral_only<u32> { typedef u32 result; }; | |
52 template<> struct arma_integral_only<s32> { typedef s32 result; }; | |
53 #if defined(ARMA_64BIT_WORD) | |
54 template<> struct arma_integral_only<u64> { typedef u64 result; }; | |
55 template<> struct arma_integral_only<s64> { typedef s64 result; }; | |
56 #endif | |
57 | |
58 | |
59 | |
60 template<typename T> struct arma_unsigned_integral_only { }; | |
61 | |
62 template<> struct arma_unsigned_integral_only<u8> { typedef u8 result; }; | |
63 template<> struct arma_unsigned_integral_only<u16> { typedef u16 result; }; | |
64 template<> struct arma_unsigned_integral_only<u32> { typedef u32 result; }; | |
65 #if defined(ARMA_64BIT_WORD) | |
66 template<> struct arma_unsigned_integral_only<u64> { typedef u64 result; }; | |
67 #endif | |
68 | |
69 | |
70 | |
71 template<typename T> struct arma_signed_integral_only { }; | |
72 | |
73 template<> struct arma_signed_integral_only<s8> { typedef s8 result; }; | |
74 template<> struct arma_signed_integral_only<s16> { typedef s16 result; }; | |
75 template<> struct arma_signed_integral_only<s32> { typedef s32 result; }; | |
76 #if defined(ARMA_64BIT_WORD) | |
77 template<> struct arma_signed_integral_only<s64> { typedef s64 result; }; | |
78 #endif | |
79 | |
80 | |
81 | |
82 template<typename T> struct arma_signed_only { }; | |
83 | |
84 template<> struct arma_signed_only<s8> { typedef s8 result; }; | |
85 template<> struct arma_signed_only<s16> { typedef s16 result; }; | |
86 template<> struct arma_signed_only<s32> { typedef s32 result; }; | |
87 #if defined(ARMA_64BIT_WORD) | |
88 template<> struct arma_signed_only<s64> { typedef s64 result; }; | |
89 #endif | |
90 template<> struct arma_signed_only<float> { typedef float result; }; | |
91 template<> struct arma_signed_only<double> { typedef double result; }; | |
92 | |
93 template<typename T> struct arma_signed_only< std::complex<T> > { typedef std::complex<T> result; }; | |
94 | |
95 | |
96 | |
97 template<typename T> struct arma_float_only { }; | |
98 | |
99 template<> struct arma_float_only<float> { typedef float result; }; | |
100 template<> struct arma_float_only<double> { typedef double result; }; | |
101 | |
102 | |
103 | |
104 template<typename T> struct arma_float_or_cx_only { }; | |
105 | |
106 template<> struct arma_float_or_cx_only< float > { typedef float result; }; | |
107 template<> struct arma_float_or_cx_only< double > { typedef double result; }; | |
108 template<> struct arma_float_or_cx_only< std::complex<float> > { typedef std::complex<float> result; }; | |
109 template<> struct arma_float_or_cx_only< std::complex<double> > { typedef std::complex<double> result; }; | |
110 | |
111 | |
112 | |
113 template<typename T> struct arma_cx_only { }; | |
114 | |
115 template<> struct arma_cx_only< std::complex<float> > { typedef std::complex<float> result; }; | |
116 template<> struct arma_cx_only< std::complex<double> > { typedef std::complex<double> result; }; | |
117 | |
118 | |
119 | |
120 template<typename T> struct arma_not_cx { typedef T result; }; | |
121 template<typename T> struct arma_not_cx< std::complex<T> > { }; | |
122 | |
123 | |
124 | |
125 template<typename T> struct arma_blas_type_only { }; | |
126 | |
127 template<> struct arma_blas_type_only< float > { typedef float result; }; | |
128 template<> struct arma_blas_type_only< double > { typedef double result; }; | |
129 template<> struct arma_blas_type_only< std::complex<float> > { typedef std::complex<float> result; }; | |
130 template<> struct arma_blas_type_only< std::complex<double> > { typedef std::complex<double> result; }; | |
131 | |
132 | |
133 | |
134 template<typename T> struct arma_op_rel_only { }; | |
135 | |
136 template<> struct arma_op_rel_only< op_rel_lt_pre > { typedef int result; }; | |
137 template<> struct arma_op_rel_only< op_rel_lt_post > { typedef int result; }; | |
138 template<> struct arma_op_rel_only< op_rel_gt_pre > { typedef int result; }; | |
139 template<> struct arma_op_rel_only< op_rel_gt_post > { typedef int result; }; | |
140 template<> struct arma_op_rel_only< op_rel_lteq_pre > { typedef int result; }; | |
141 template<> struct arma_op_rel_only< op_rel_lteq_post > { typedef int result; }; | |
142 template<> struct arma_op_rel_only< op_rel_gteq_pre > { typedef int result; }; | |
143 template<> struct arma_op_rel_only< op_rel_gteq_post > { typedef int result; }; | |
144 template<> struct arma_op_rel_only< op_rel_eq > { typedef int result; }; | |
145 template<> struct arma_op_rel_only< op_rel_noteq > { typedef int result; }; | |
146 | |
147 | |
148 | |
149 template<typename T> struct arma_not_op_rel { typedef int result; }; | |
150 | |
151 template<> struct arma_not_op_rel< op_rel_lt_pre > { }; | |
152 template<> struct arma_not_op_rel< op_rel_lt_post > { }; | |
153 template<> struct arma_not_op_rel< op_rel_gt_pre > { }; | |
154 template<> struct arma_not_op_rel< op_rel_gt_post > { }; | |
155 template<> struct arma_not_op_rel< op_rel_lteq_pre > { }; | |
156 template<> struct arma_not_op_rel< op_rel_lteq_post > { }; | |
157 template<> struct arma_not_op_rel< op_rel_gteq_pre > { }; | |
158 template<> struct arma_not_op_rel< op_rel_gteq_post > { }; | |
159 template<> struct arma_not_op_rel< op_rel_eq > { }; | |
160 template<> struct arma_not_op_rel< op_rel_noteq > { }; | |
161 | |
162 | |
163 | |
164 template<typename T> struct arma_glue_rel_only { }; | |
165 | |
166 template<> struct arma_glue_rel_only< glue_rel_lt > { typedef int result; }; | |
167 template<> struct arma_glue_rel_only< glue_rel_gt > { typedef int result; }; | |
168 template<> struct arma_glue_rel_only< glue_rel_lteq > { typedef int result; }; | |
169 template<> struct arma_glue_rel_only< glue_rel_gteq > { typedef int result; }; | |
170 template<> struct arma_glue_rel_only< glue_rel_eq > { typedef int result; }; | |
171 template<> struct arma_glue_rel_only< glue_rel_noteq > { typedef int result; }; | |
172 | |
173 | |
174 | |
175 template<typename T> struct arma_Mat_Col_Row_only { }; | |
176 | |
177 template<typename eT> struct arma_Mat_Col_Row_only< Mat<eT> > { typedef Mat<eT> result; }; | |
178 template<typename eT> struct arma_Mat_Col_Row_only< Col<eT> > { typedef Col<eT> result; }; | |
179 template<typename eT> struct arma_Mat_Col_Row_only< Row<eT> > { typedef Row<eT> result; }; | |
180 | |
181 | |
182 | |
183 template<typename T> struct arma_Cube_only { }; | |
184 template<typename eT> struct arma_Cube_only< Cube<eT> > { typedef Cube<eT> result; }; | |
185 | |
186 | |
187 | |
188 //! @} |