1 | // Copyright (C) 2010-2013 Conrad Sanderson |
---|
2 | // Copyright (C) 2010-2013 NICTA (www.nicta.com.au) |
---|
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 subview_elem1 |
---|
10 | //! @{ |
---|
11 | |
---|
12 | |
---|
13 | |
---|
14 | template<typename eT, typename T1> |
---|
15 | class subview_elem1 : public Base<eT, subview_elem1<eT,T1> > |
---|
16 | { |
---|
17 | public: |
---|
18 | |
---|
19 | typedef eT elem_type; |
---|
20 | typedef typename get_pod_type<elem_type>::result pod_type; |
---|
21 | |
---|
22 | static const bool is_row = false; |
---|
23 | static const bool is_col = true; |
---|
24 | |
---|
25 | arma_aligned const Mat<eT> fake_m; |
---|
26 | arma_aligned const Mat<eT>& m; |
---|
27 | arma_aligned const Base<uword,T1>& a; |
---|
28 | |
---|
29 | |
---|
30 | protected: |
---|
31 | |
---|
32 | arma_inline subview_elem1(const Mat<eT>& in_m, const Base<uword,T1>& in_a); |
---|
33 | arma_inline subview_elem1(const Cube<eT>& in_q, const Base<uword,T1>& in_a); |
---|
34 | |
---|
35 | |
---|
36 | public: |
---|
37 | |
---|
38 | inline ~subview_elem1(); |
---|
39 | |
---|
40 | template<typename op_type> inline void inplace_op(const eT val); |
---|
41 | template<typename op_type, typename T2> inline void inplace_op(const subview_elem1<eT,T2>& x ); |
---|
42 | template<typename op_type, typename T2> inline void inplace_op(const Base<eT,T2>& x ); |
---|
43 | |
---|
44 | arma_inline const Op<subview_elem1<eT,T1>,op_htrans> t() const; |
---|
45 | arma_inline const Op<subview_elem1<eT,T1>,op_htrans> ht() const; |
---|
46 | arma_inline const Op<subview_elem1<eT,T1>,op_strans> st() const; |
---|
47 | |
---|
48 | inline void fill(const eT val); |
---|
49 | inline void zeros(); |
---|
50 | inline void ones(); |
---|
51 | inline void randu(); |
---|
52 | inline void randn(); |
---|
53 | |
---|
54 | inline void operator+= (const eT val); |
---|
55 | inline void operator-= (const eT val); |
---|
56 | inline void operator*= (const eT val); |
---|
57 | inline void operator/= (const eT val); |
---|
58 | |
---|
59 | |
---|
60 | // deliberately returning void |
---|
61 | template<typename T2> inline void operator_equ(const subview_elem1<eT,T2>& x); |
---|
62 | template<typename T2> inline void operator= (const subview_elem1<eT,T2>& x); |
---|
63 | inline void operator= (const subview_elem1<eT,T1>& x); |
---|
64 | template<typename T2> inline void operator+= (const subview_elem1<eT,T2>& x); |
---|
65 | template<typename T2> inline void operator-= (const subview_elem1<eT,T2>& x); |
---|
66 | template<typename T2> inline void operator%= (const subview_elem1<eT,T2>& x); |
---|
67 | template<typename T2> inline void operator/= (const subview_elem1<eT,T2>& x); |
---|
68 | |
---|
69 | template<typename T2> inline void operator= (const Base<eT,T2>& x); |
---|
70 | template<typename T2> inline void operator+= (const Base<eT,T2>& x); |
---|
71 | template<typename T2> inline void operator-= (const Base<eT,T2>& x); |
---|
72 | template<typename T2> inline void operator%= (const Base<eT,T2>& x); |
---|
73 | template<typename T2> inline void operator/= (const Base<eT,T2>& x); |
---|
74 | |
---|
75 | inline static void extract(Mat<eT>& out, const subview_elem1& in); |
---|
76 | |
---|
77 | template<typename op_type> inline static void mat_inplace_op(Mat<eT>& out, const subview_elem1& in); |
---|
78 | |
---|
79 | inline static void plus_inplace(Mat<eT>& out, const subview_elem1& in); |
---|
80 | inline static void minus_inplace(Mat<eT>& out, const subview_elem1& in); |
---|
81 | inline static void schur_inplace(Mat<eT>& out, const subview_elem1& in); |
---|
82 | inline static void div_inplace(Mat<eT>& out, const subview_elem1& in); |
---|
83 | |
---|
84 | |
---|
85 | |
---|
86 | private: |
---|
87 | |
---|
88 | friend class Mat<eT>; |
---|
89 | friend class Cube<eT>; |
---|
90 | |
---|
91 | subview_elem1(); |
---|
92 | }; |
---|
93 | |
---|
94 | |
---|
95 | |
---|
96 | //! @} |
---|