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