comparison armadillo-3.900.4/include/armadillo_bits/podarray_bones.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-2012 NICTA (www.nicta.com.au)
2 // Copyright (C) 2008-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 podarray
10 //! @{
11
12
13
14 struct podarray_prealloc_n_elem
15 {
16 static const uword val = 16;
17 };
18
19
20
21 //! A lightweight array for POD types. For internal use only!
22 template<typename eT>
23 class podarray
24 {
25 public:
26
27 arma_aligned const uword n_elem; //!< number of elements held
28 arma_aligned eT* mem; //!< pointer to memory used by the object
29
30
31 protected:
32 //! internal memory, to avoid calling the 'new' operator for small amounts of memory.
33 arma_align_mem eT mem_local[ podarray_prealloc_n_elem::val ];
34
35
36 public:
37
38 inline ~podarray();
39 inline podarray();
40
41 inline podarray (const podarray& x);
42 inline const podarray& operator=(const podarray& x);
43
44 arma_inline explicit podarray(const uword new_N);
45
46 arma_inline explicit podarray(const eT* X, const uword new_N);
47
48 template<typename T1>
49 inline explicit podarray(const Proxy<T1>& P);
50
51 arma_inline eT& operator[] (const uword i);
52 arma_inline eT operator[] (const uword i) const;
53
54 arma_inline eT& operator() (const uword i);
55 arma_inline eT operator() (const uword i) const;
56
57 inline void set_min_size(const uword min_n_elem);
58
59 inline void set_size(const uword new_n_elem);
60 inline void reset();
61
62
63 inline void fill(const eT val);
64
65 inline void zeros();
66 inline void zeros(const uword new_n_elem);
67
68 arma_inline eT* memptr();
69 arma_inline const eT* memptr() const;
70
71 arma_hot inline void copy_row(const Mat<eT>& A, const uword row);
72
73
74 protected:
75
76 inline void init_cold(const uword new_n_elem);
77 inline void init_warm(const uword new_n_elem);
78 };
79
80
81
82 //! @}