Mercurial > hg > segmenter-vamp-plugin
comparison armadillo-3.900.4/include/armadillo_bits/fn_mean.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) 2009-2012 NICTA (www.nicta.com.au) | |
2 // Copyright (C) 2009-2012 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 fn_mean | |
10 //! @{ | |
11 | |
12 | |
13 | |
14 template<typename T1> | |
15 arma_inline | |
16 const Op<T1, op_mean> | |
17 mean | |
18 ( | |
19 const T1& X, | |
20 const uword dim = 0, | |
21 const typename enable_if< is_arma_type<T1>::value == true >::result* junk1 = 0, | |
22 const typename enable_if< resolves_to_vector<T1>::value == false >::result* junk2 = 0 | |
23 ) | |
24 { | |
25 arma_extra_debug_sigprint(); | |
26 arma_ignore(junk1); | |
27 arma_ignore(junk2); | |
28 | |
29 return Op<T1, op_mean>(X, dim, 0); | |
30 } | |
31 | |
32 | |
33 | |
34 template<typename T1> | |
35 arma_inline | |
36 const Op<T1, op_mean> | |
37 mean | |
38 ( | |
39 const T1& X, | |
40 const uword dim, | |
41 const typename enable_if<resolves_to_vector<T1>::value == true>::result* junk = 0 | |
42 ) | |
43 { | |
44 arma_extra_debug_sigprint(); | |
45 arma_ignore(junk); | |
46 | |
47 return Op<T1, op_mean>(X, dim, 0); | |
48 } | |
49 | |
50 | |
51 | |
52 template<typename T1> | |
53 inline | |
54 arma_warn_unused | |
55 typename T1::elem_type | |
56 mean | |
57 ( | |
58 const T1& X, | |
59 const arma_empty_class junk1 = arma_empty_class(), | |
60 const typename enable_if<resolves_to_vector<T1>::value == true>::result* junk2 = 0 | |
61 ) | |
62 { | |
63 arma_extra_debug_sigprint(); | |
64 arma_ignore(junk1); | |
65 arma_ignore(junk2); | |
66 | |
67 return op_mean::mean_all(X); | |
68 } | |
69 | |
70 | |
71 | |
72 //! \brief | |
73 //! Immediate 'find mean value' operation, | |
74 //! invoked, for example, by: mean(mean(A)) | |
75 template<typename T1> | |
76 inline | |
77 arma_warn_unused | |
78 typename T1::elem_type | |
79 mean(const Op<T1, op_mean>& in) | |
80 { | |
81 arma_extra_debug_sigprint(); | |
82 arma_extra_debug_print("mean(): two consecutive mean() calls detected"); | |
83 | |
84 return op_mean::mean_all(in.m); | |
85 } | |
86 | |
87 | |
88 | |
89 template<typename T1> | |
90 arma_inline | |
91 const Op< Op<T1, op_mean>, op_mean> | |
92 mean(const Op<T1, op_mean>& in, const uword dim) | |
93 { | |
94 arma_extra_debug_sigprint(); | |
95 | |
96 return Op< Op<T1, op_mean>, op_mean>(in, dim, 0); | |
97 } | |
98 | |
99 | |
100 | |
101 template<typename T> | |
102 arma_inline | |
103 arma_warn_unused | |
104 const typename arma_scalar_only<T>::result & | |
105 mean(const T& x) | |
106 { | |
107 return x; | |
108 } | |
109 | |
110 | |
111 | |
112 template<typename T1> | |
113 inline | |
114 arma_warn_unused | |
115 const SpOp<T1, spop_mean> | |
116 mean | |
117 ( | |
118 const T1& X, | |
119 const uword dim = 0, | |
120 const typename enable_if< is_arma_sparse_type<T1>::value == true >::result* junk1 = 0, | |
121 const typename enable_if< resolves_to_sparse_vector<T1>::value == false >::result* junk2 = 0 | |
122 ) | |
123 { | |
124 arma_extra_debug_sigprint(); | |
125 | |
126 arma_ignore(junk1); | |
127 arma_ignore(junk2); | |
128 | |
129 return SpOp<T1, spop_mean>(X, dim, 0); | |
130 } | |
131 | |
132 | |
133 | |
134 template<typename T1> | |
135 inline | |
136 arma_warn_unused | |
137 const SpOp<T1, spop_mean> | |
138 mean | |
139 ( | |
140 const T1& X, | |
141 const uword dim, | |
142 const typename enable_if< resolves_to_sparse_vector<T1>::value == true >::result* junk1 = 0 | |
143 ) | |
144 { | |
145 arma_extra_debug_sigprint(); | |
146 arma_ignore(junk1); | |
147 | |
148 return SpOp<T1, spop_mean>(X, dim, 0); | |
149 } | |
150 | |
151 | |
152 | |
153 template<typename T1> | |
154 inline | |
155 arma_warn_unused | |
156 typename T1::elem_type | |
157 mean | |
158 ( | |
159 const T1& X, | |
160 const arma_empty_class junk1 = arma_empty_class(), | |
161 const typename enable_if< resolves_to_sparse_vector<T1>::value == true >::result* junk2 = 0 | |
162 ) | |
163 { | |
164 arma_extra_debug_sigprint(); | |
165 | |
166 arma_ignore(junk1); | |
167 arma_ignore(junk2); | |
168 | |
169 return spop_mean::mean_all(X); | |
170 } | |
171 | |
172 | |
173 | |
174 template<typename T1> | |
175 inline | |
176 arma_warn_unused | |
177 typename T1::elem_type | |
178 mean(const SpOp<T1, spop_mean>& in) | |
179 { | |
180 arma_extra_debug_sigprint(); | |
181 arma_extra_debug_print("mean(): two consecutive mean() calls detected"); | |
182 | |
183 return spop_mean::mean_all(in.m); | |
184 } | |
185 | |
186 | |
187 | |
188 //! @} |