max@0
|
1 // Copyright (C) 2008-2011 NICTA (www.nicta.com.au)
|
max@0
|
2 // Copyright (C) 2008-2011 Conrad Sanderson
|
max@0
|
3 //
|
max@0
|
4 // This file is part of the Armadillo C++ library.
|
max@0
|
5 // It is provided without any warranty of fitness
|
max@0
|
6 // for any purpose. You can redistribute this file
|
max@0
|
7 // and/or modify it under the terms of the GNU
|
max@0
|
8 // Lesser General Public License (LGPL) as published
|
max@0
|
9 // by the Free Software Foundation, either version 3
|
max@0
|
10 // of the License or (at your option) any later version.
|
max@0
|
11 // (see http://www.opensource.org/licenses for more info)
|
max@0
|
12
|
max@0
|
13
|
max@0
|
14 //! \addtogroup subview_cube
|
max@0
|
15 //! @{
|
max@0
|
16
|
max@0
|
17
|
max@0
|
18 //! Class for storing data required to construct or apply operations to a subcube
|
max@0
|
19 //! (i.e. where the subcube starts and ends as well as a reference/pointer to the original cube),
|
max@0
|
20 template<typename eT>
|
max@0
|
21 class subview_cube : public BaseCube<eT, subview_cube<eT> >
|
max@0
|
22 {
|
max@0
|
23 public: arma_aligned const Cube<eT>& m;
|
max@0
|
24 protected: arma_aligned Cube<eT>* m_ptr;
|
max@0
|
25
|
max@0
|
26 public:
|
max@0
|
27
|
max@0
|
28 typedef eT elem_type;
|
max@0
|
29 typedef typename get_pod_type<elem_type>::result pod_type;
|
max@0
|
30
|
max@0
|
31 const uword aux_row1;
|
max@0
|
32 const uword aux_col1;
|
max@0
|
33 const uword aux_slice1;
|
max@0
|
34
|
max@0
|
35 const uword n_rows;
|
max@0
|
36 const uword n_cols;
|
max@0
|
37 const uword n_elem_slice;
|
max@0
|
38 const uword n_slices;
|
max@0
|
39 const uword n_elem;
|
max@0
|
40
|
max@0
|
41
|
max@0
|
42 protected:
|
max@0
|
43
|
max@0
|
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);
|
max@0
|
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);
|
max@0
|
46
|
max@0
|
47
|
max@0
|
48 public:
|
max@0
|
49
|
max@0
|
50 inline ~subview_cube();
|
max@0
|
51
|
max@0
|
52 inline void operator+= (const eT val);
|
max@0
|
53 inline void operator-= (const eT val);
|
max@0
|
54 inline void operator*= (const eT val);
|
max@0
|
55 inline void operator/= (const eT val);
|
max@0
|
56
|
max@0
|
57 // deliberately returning void
|
max@0
|
58 template<typename T1> inline void operator= (const BaseCube<eT,T1>& x);
|
max@0
|
59 template<typename T1> inline void operator+= (const BaseCube<eT,T1>& x);
|
max@0
|
60 template<typename T1> inline void operator-= (const BaseCube<eT,T1>& x);
|
max@0
|
61 template<typename T1> inline void operator%= (const BaseCube<eT,T1>& x);
|
max@0
|
62 template<typename T1> inline void operator/= (const BaseCube<eT,T1>& x);
|
max@0
|
63
|
max@0
|
64 inline void operator= (const subview_cube& x);
|
max@0
|
65 inline void operator+= (const subview_cube& x);
|
max@0
|
66 inline void operator-= (const subview_cube& x);
|
max@0
|
67 inline void operator%= (const subview_cube& x);
|
max@0
|
68 inline void operator/= (const subview_cube& x);
|
max@0
|
69
|
max@0
|
70 template<typename T1> inline void operator= (const Base<eT,T1>& x);
|
max@0
|
71 template<typename T1> inline void operator+= (const Base<eT,T1>& x);
|
max@0
|
72 template<typename T1> inline void operator-= (const Base<eT,T1>& x);
|
max@0
|
73 template<typename T1> inline void operator%= (const Base<eT,T1>& x);
|
max@0
|
74 template<typename T1> inline void operator/= (const Base<eT,T1>& x);
|
max@0
|
75
|
max@0
|
76 inline static void extract(Cube<eT>& out, const subview_cube& in);
|
max@0
|
77 inline static void plus_inplace(Cube<eT>& out, const subview_cube& in);
|
max@0
|
78 inline static void minus_inplace(Cube<eT>& out, const subview_cube& in);
|
max@0
|
79 inline static void schur_inplace(Cube<eT>& out, const subview_cube& in);
|
max@0
|
80 inline static void div_inplace(Cube<eT>& out, const subview_cube& in);
|
max@0
|
81
|
max@0
|
82 inline static void extract(Mat<eT>& out, const subview_cube& in);
|
max@0
|
83 inline static void plus_inplace(Mat<eT>& out, const subview_cube& in);
|
max@0
|
84 inline static void minus_inplace(Mat<eT>& out, const subview_cube& in);
|
max@0
|
85 inline static void schur_inplace(Mat<eT>& out, const subview_cube& in);
|
max@0
|
86 inline static void div_inplace(Mat<eT>& out, const subview_cube& in);
|
max@0
|
87
|
max@0
|
88 inline void fill(const eT val);
|
max@0
|
89 inline void zeros();
|
max@0
|
90 inline void ones();
|
max@0
|
91
|
max@0
|
92 inline eT& operator[](const uword i);
|
max@0
|
93 inline eT operator[](const uword i) const;
|
max@0
|
94
|
max@0
|
95 inline eT& operator()(const uword i);
|
max@0
|
96 inline eT operator()(const uword i) const;
|
max@0
|
97
|
max@0
|
98 arma_inline eT& operator()(const uword in_row, const uword in_col, const uword in_slice);
|
max@0
|
99 arma_inline eT operator()(const uword in_row, const uword in_col, const uword in_slice) const;
|
max@0
|
100
|
max@0
|
101 arma_inline eT& at(const uword in_row, const uword in_col, const uword in_slice);
|
max@0
|
102 arma_inline eT at(const uword in_row, const uword in_col, const uword in_slice) const;
|
max@0
|
103
|
max@0
|
104 arma_inline eT* slice_colptr(const uword in_slice, const uword in_col);
|
max@0
|
105 arma_inline const eT* slice_colptr(const uword in_slice, const uword in_col) const;
|
max@0
|
106
|
max@0
|
107 inline bool check_overlap(const subview_cube& x) const;
|
max@0
|
108 inline bool check_overlap(const Mat<eT>& x) const;
|
max@0
|
109
|
max@0
|
110
|
max@0
|
111 private:
|
max@0
|
112
|
max@0
|
113 friend class Mat<eT>;
|
max@0
|
114 friend class Cube<eT>;
|
max@0
|
115
|
max@0
|
116 subview_cube();
|
max@0
|
117 };
|
max@0
|
118
|
max@0
|
119
|
max@0
|
120
|
max@0
|
121 //! @}
|