comparison armadillo-3.900.4/include/armadillo_bits/spop_misc_meat.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) 2012 Conrad Sanderson
2 //
3 // This Source Code Form is subject to the terms of the Mozilla Public
4 // License, v. 2.0. If a copy of the MPL was not distributed with this
5 // file, You can obtain one at http://mozilla.org/MPL/2.0/.
6
7
8 //! \addtogroup spop_misc
9 //! @{
10
11
12
13 namespace priv
14 {
15 template<typename eT>
16 struct functor_scalar_times
17 {
18 const eT k;
19
20 functor_scalar_times(const eT in_k) : k(in_k) {}
21
22 arma_inline eT operator()(const eT val) const { return val * k; }
23 };
24 }
25
26
27
28 template<typename T1>
29 inline
30 void
31 spop_scalar_times::apply(SpMat<typename T1::elem_type>& out, const SpOp<T1,spop_scalar_times>& in)
32 {
33 arma_extra_debug_sigprint();
34
35 typedef typename T1::elem_type eT;
36
37 out.init_xform(in.m, priv::functor_scalar_times<eT>(in.aux));
38 }
39
40
41
42 namespace priv
43 {
44 struct functor_square
45 {
46 template<typename eT>
47 arma_inline eT operator()(const eT val) const { return val*val; }
48 };
49 }
50
51
52
53 template<typename T1>
54 inline
55 void
56 spop_square::apply(SpMat<typename T1::elem_type>& out, const SpOp<T1,spop_square>& in)
57 {
58 arma_extra_debug_sigprint();
59
60 out.init_xform(in.m, priv::functor_square());
61 }
62
63
64
65 namespace priv
66 {
67 struct functor_sqrt
68 {
69 template<typename eT>
70 arma_inline eT operator()(const eT val) const { return eop_aux::sqrt(val); }
71 };
72 }
73
74
75
76 template<typename T1>
77 inline
78 void
79 spop_sqrt::apply(SpMat<typename T1::elem_type>& out, const SpOp<T1,spop_sqrt>& in)
80 {
81 arma_extra_debug_sigprint();
82
83 out.init_xform(in.m, priv::functor_sqrt());
84 }
85
86
87
88 namespace priv
89 {
90 struct functor_abs
91 {
92 template<typename eT>
93 arma_inline eT operator()(const eT val) const { return eop_aux::arma_abs(val); }
94 };
95 }
96
97
98
99 template<typename T1>
100 inline
101 void
102 spop_abs::apply(SpMat<typename T1::elem_type>& out, const SpOp<T1,spop_abs>& in)
103 {
104 arma_extra_debug_sigprint();
105
106 out.init_xform(in.m, priv::functor_abs());
107 }
108
109
110
111 namespace priv
112 {
113 struct functor_cx_abs
114 {
115 template<typename T>
116 arma_inline T operator()(const std::complex<T>& val) const { return std::abs(val); }
117 };
118 }
119
120
121
122 template<typename T1>
123 inline
124 void
125 spop_cx_abs::apply(SpMat<typename T1::pod_type>& out, const mtSpOp<typename T1::pod_type, T1, spop_cx_abs>& in)
126 {
127 arma_extra_debug_sigprint();
128
129 out.init_xform_mt(in.m, priv::functor_cx_abs());
130 }
131
132
133
134 //! @}