Mercurial > hg > segmenter-vamp-plugin
comparison armadillo-3.900.4/include/armadillo_bits/fn_eps.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-2010 NICTA (www.nicta.com.au) | |
2 // Copyright (C) 2009-2010 Conrad Sanderson | |
3 // Copyright (C) 2009-2010 Dimitrios Bouzas | |
4 // | |
5 // This Source Code Form is subject to the terms of the Mozilla Public | |
6 // License, v. 2.0. If a copy of the MPL was not distributed with this | |
7 // file, You can obtain one at http://mozilla.org/MPL/2.0/. | |
8 | |
9 | |
10 | |
11 //! \addtogroup fn_eps | |
12 //! @{ | |
13 | |
14 | |
15 | |
16 //! \brief | |
17 //! eps version for non-complex matrices and vectors | |
18 template<typename T1> | |
19 inline | |
20 const eOp<T1, eop_eps> | |
21 eps(const Base<typename T1::elem_type, T1>& X, const typename arma_not_cx<typename T1::elem_type>::result* junk = 0) | |
22 { | |
23 arma_extra_debug_sigprint(); | |
24 arma_ignore(junk); | |
25 | |
26 return eOp<T1, eop_eps>(X.get_ref()); | |
27 } | |
28 | |
29 | |
30 | |
31 //! \brief | |
32 //! eps version for complex matrices and vectors | |
33 template<typename T1> | |
34 inline | |
35 Mat< typename T1::pod_type > | |
36 eps(const Base< std::complex<typename T1::pod_type>, T1>& X, const typename arma_cx_only<typename T1::elem_type>::result* junk = 0) | |
37 { | |
38 arma_extra_debug_sigprint(); | |
39 | |
40 arma_ignore(junk); | |
41 | |
42 typedef typename T1::pod_type T; | |
43 typedef typename T1::elem_type eT; | |
44 | |
45 const unwrap<T1> tmp(X.get_ref()); | |
46 const Mat<eT>& A = tmp.M; | |
47 | |
48 Mat<T> out(A.n_rows, A.n_cols); | |
49 | |
50 T* out_mem = out.memptr(); | |
51 const eT* A_mem = A.memptr(); | |
52 const uword n_elem = A.n_elem; | |
53 | |
54 for(uword i=0; i<n_elem; ++i) | |
55 { | |
56 out_mem[i] = eop_aux::direct_eps( A_mem[i] ); | |
57 } | |
58 | |
59 | |
60 return out; | |
61 } | |
62 | |
63 | |
64 | |
65 template<typename eT> | |
66 arma_inline | |
67 arma_warn_unused | |
68 typename arma_integral_only<eT>::result | |
69 eps(const eT& x) | |
70 { | |
71 arma_ignore(x); | |
72 | |
73 return eT(0); | |
74 } | |
75 | |
76 | |
77 | |
78 template<typename eT> | |
79 arma_inline | |
80 arma_warn_unused | |
81 typename arma_real_only<eT>::result | |
82 eps(const eT& x) | |
83 { | |
84 return eop_aux::direct_eps(x); | |
85 } | |
86 | |
87 | |
88 | |
89 template<typename T> | |
90 arma_inline | |
91 arma_warn_unused | |
92 typename arma_real_only<T>::result | |
93 eps(const std::complex<T>& x) | |
94 { | |
95 return eop_aux::direct_eps(x); | |
96 } | |
97 | |
98 | |
99 | |
100 //! @} |