comparison armadillo-3.900.4/include/armadillo_bits/unwrap_cube.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) 2008-2010 NICTA (www.nicta.com.au)
2 // Copyright (C) 2008-2010 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 unwrap_cube
10 //! @{
11
12
13
14 template<typename T1>
15 class unwrap_cube
16 {
17 public:
18
19 typedef typename T1::elem_type eT;
20
21 inline
22 unwrap_cube(const T1& A)
23 : M(A)
24 {
25 arma_extra_debug_sigprint();
26 }
27
28 const Cube<eT> M;
29 };
30
31
32
33 template<typename eT>
34 class unwrap_cube< Cube<eT> >
35 {
36 public:
37
38 inline
39 unwrap_cube(const Cube<eT>& A)
40 : M(A)
41 {
42 arma_extra_debug_sigprint();
43 }
44
45 const Cube<eT>& M;
46 };
47
48
49
50 //
51 //
52 //
53
54
55
56 template<typename T1>
57 class unwrap_cube_check
58 {
59 typedef typename T1::elem_type eT;
60
61 inline
62 unwrap_cube_check(const T1& A, const Cube<eT>&)
63 : M(A)
64 {
65 arma_extra_debug_sigprint();
66
67 arma_type_check(( is_arma_cube_type<T1>::value == false ));
68 }
69
70 const Cube<eT> M;
71 };
72
73
74
75 template<typename eT>
76 class unwrap_cube_check< Cube<eT> >
77 {
78 public:
79
80 inline
81 unwrap_cube_check(const Cube<eT>& A, const Cube<eT>& B)
82 : M_local( (&A == &B) ? new Cube<eT>(A) : 0 )
83 , M ( (&A == &B) ? (*M_local) : A )
84 {
85 arma_extra_debug_sigprint();
86 }
87
88
89 inline
90 ~unwrap_cube_check()
91 {
92 arma_extra_debug_sigprint();
93
94 if(M_local)
95 {
96 delete M_local;
97 }
98 }
99
100
101 // the order below is important
102 const Cube<eT>* M_local;
103 const Cube<eT>& M;
104
105 };
106
107
108
109 //! @}