Mercurial > hg > segmenter-vamp-plugin
comparison armadillo-2.4.4/include/armadillo_bits/subview_cube_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) 2008-2011 NICTA (www.nicta.com.au) | |
2 // Copyright (C) 2008-2011 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 subview_cube | |
15 //! @{ | |
16 | |
17 | |
18 //! Class for storing data required to construct or apply operations to a subcube | |
19 //! (i.e. where the subcube starts and ends as well as a reference/pointer to the original cube), | |
20 template<typename eT> | |
21 class subview_cube : public BaseCube<eT, subview_cube<eT> > | |
22 { | |
23 public: arma_aligned const Cube<eT>& m; | |
24 protected: arma_aligned Cube<eT>* m_ptr; | |
25 | |
26 public: | |
27 | |
28 typedef eT elem_type; | |
29 typedef typename get_pod_type<elem_type>::result pod_type; | |
30 | |
31 const uword aux_row1; | |
32 const uword aux_col1; | |
33 const uword aux_slice1; | |
34 | |
35 const uword n_rows; | |
36 const uword n_cols; | |
37 const uword n_elem_slice; | |
38 const uword n_slices; | |
39 const uword n_elem; | |
40 | |
41 | |
42 protected: | |
43 | |
44 arma_inline subview_cube(const Cube<eT>& in_m, const uword in_row1, const uword in_col1, const uword in_slice1, const uword in_n_rows, const uword in_n_cols, const uword in_n_slices); | |
45 arma_inline subview_cube( Cube<eT>& in_m, const uword in_row1, const uword in_col1, const uword in_slice1, const uword in_n_rows, const uword in_n_cols, const uword in_n_slices); | |
46 | |
47 | |
48 public: | |
49 | |
50 inline ~subview_cube(); | |
51 | |
52 inline void operator+= (const eT val); | |
53 inline void operator-= (const eT val); | |
54 inline void operator*= (const eT val); | |
55 inline void operator/= (const eT val); | |
56 | |
57 // deliberately returning void | |
58 template<typename T1> inline void operator= (const BaseCube<eT,T1>& x); | |
59 template<typename T1> inline void operator+= (const BaseCube<eT,T1>& x); | |
60 template<typename T1> inline void operator-= (const BaseCube<eT,T1>& x); | |
61 template<typename T1> inline void operator%= (const BaseCube<eT,T1>& x); | |
62 template<typename T1> inline void operator/= (const BaseCube<eT,T1>& x); | |
63 | |
64 inline void operator= (const subview_cube& x); | |
65 inline void operator+= (const subview_cube& x); | |
66 inline void operator-= (const subview_cube& x); | |
67 inline void operator%= (const subview_cube& x); | |
68 inline void operator/= (const subview_cube& x); | |
69 | |
70 template<typename T1> inline void operator= (const Base<eT,T1>& x); | |
71 template<typename T1> inline void operator+= (const Base<eT,T1>& x); | |
72 template<typename T1> inline void operator-= (const Base<eT,T1>& x); | |
73 template<typename T1> inline void operator%= (const Base<eT,T1>& x); | |
74 template<typename T1> inline void operator/= (const Base<eT,T1>& x); | |
75 | |
76 inline static void extract(Cube<eT>& out, const subview_cube& in); | |
77 inline static void plus_inplace(Cube<eT>& out, const subview_cube& in); | |
78 inline static void minus_inplace(Cube<eT>& out, const subview_cube& in); | |
79 inline static void schur_inplace(Cube<eT>& out, const subview_cube& in); | |
80 inline static void div_inplace(Cube<eT>& out, const subview_cube& in); | |
81 | |
82 inline static void extract(Mat<eT>& out, const subview_cube& in); | |
83 inline static void plus_inplace(Mat<eT>& out, const subview_cube& in); | |
84 inline static void minus_inplace(Mat<eT>& out, const subview_cube& in); | |
85 inline static void schur_inplace(Mat<eT>& out, const subview_cube& in); | |
86 inline static void div_inplace(Mat<eT>& out, const subview_cube& in); | |
87 | |
88 inline void fill(const eT val); | |
89 inline void zeros(); | |
90 inline void ones(); | |
91 | |
92 inline eT& operator[](const uword i); | |
93 inline eT operator[](const uword i) const; | |
94 | |
95 inline eT& operator()(const uword i); | |
96 inline eT operator()(const uword i) const; | |
97 | |
98 arma_inline eT& operator()(const uword in_row, const uword in_col, const uword in_slice); | |
99 arma_inline eT operator()(const uword in_row, const uword in_col, const uword in_slice) const; | |
100 | |
101 arma_inline eT& at(const uword in_row, const uword in_col, const uword in_slice); | |
102 arma_inline eT at(const uword in_row, const uword in_col, const uword in_slice) const; | |
103 | |
104 arma_inline eT* slice_colptr(const uword in_slice, const uword in_col); | |
105 arma_inline const eT* slice_colptr(const uword in_slice, const uword in_col) const; | |
106 | |
107 inline bool check_overlap(const subview_cube& x) const; | |
108 inline bool check_overlap(const Mat<eT>& x) const; | |
109 | |
110 | |
111 private: | |
112 | |
113 friend class Mat<eT>; | |
114 friend class Cube<eT>; | |
115 | |
116 subview_cube(); | |
117 }; | |
118 | |
119 | |
120 | |
121 //! @} |