Mercurial > hg > segmenter-vamp-plugin
comparison armadillo-2.4.4/include/armadillo_bits/op_median_bones.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) 2009-2010 NICTA (www.nicta.com.au) | |
2 // Copyright (C) 2009-2010 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 op_median | |
15 //! @{ | |
16 | |
17 | |
18 template<typename T> | |
19 struct arma_cx_median_packet | |
20 { | |
21 T val; | |
22 uword index; | |
23 }; | |
24 | |
25 | |
26 | |
27 template<typename T> | |
28 inline | |
29 bool | |
30 operator< (const arma_cx_median_packet<T>& A, const arma_cx_median_packet<T>& B) | |
31 { | |
32 return A.val < B.val; | |
33 } | |
34 | |
35 | |
36 | |
37 //! Class for finding median values of a matrix | |
38 class op_median | |
39 { | |
40 public: | |
41 | |
42 template<typename eT> | |
43 arma_inline static eT robust_mean(const eT A, const eT B); | |
44 | |
45 template<typename eT> | |
46 inline static eT direct_median(std::vector<eT>& X); | |
47 | |
48 template<typename eT> | |
49 inline static eT direct_median(const eT* X, const uword n_elem); | |
50 | |
51 template<typename eT> | |
52 inline static eT direct_median(const subview<eT>& X); | |
53 | |
54 template<typename eT> | |
55 inline static eT direct_median(const diagview<eT>& X); | |
56 | |
57 template<typename T1> | |
58 inline static void apply(Mat<typename T1::elem_type>& out, const Op<T1,op_median>& in); | |
59 | |
60 | |
61 // | |
62 // for complex numbers | |
63 | |
64 template<typename T> | |
65 arma_inline static std::complex<T> robust_mean(const std::complex<T>& A, const std::complex<T>& B); | |
66 | |
67 template<typename T> | |
68 inline static void direct_cx_median_index(uword& out_index1, uword& out_index2, std::vector< arma_cx_median_packet<T> >& X); | |
69 | |
70 template<typename T> | |
71 inline static void direct_cx_median_index(uword& out_index1, uword& out_index2, const std::complex<T>* X, const uword n_elem); | |
72 | |
73 template<typename T> | |
74 inline static void direct_cx_median_index(uword& out_index1, uword& out_index2, const subview< std::complex<T> >& X); | |
75 | |
76 template<typename T> | |
77 inline static void direct_cx_median_index(uword& out_index1, uword& out_index2, const diagview< std::complex<T> >& X); | |
78 | |
79 template<typename T, typename T1> | |
80 inline static void apply(Mat< std::complex<T> >& out, const Op<T1,op_median>& in); | |
81 | |
82 | |
83 }; | |
84 | |
85 //! @} |