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 diagview
|
max@0
|
15 //! @{
|
max@0
|
16
|
max@0
|
17
|
max@0
|
18 //! Class for storing data required to extract and set the diagonals of a matrix
|
max@0
|
19 template<typename eT>
|
max@0
|
20 class diagview : public Base<eT, diagview<eT> >
|
max@0
|
21 {
|
max@0
|
22 public: arma_aligned const Mat<eT>& m;
|
max@0
|
23 protected: arma_aligned Mat<eT>* m_ptr;
|
max@0
|
24
|
max@0
|
25 public:
|
max@0
|
26
|
max@0
|
27 typedef eT elem_type;
|
max@0
|
28 typedef typename get_pod_type<eT>::result pod_type;
|
max@0
|
29
|
max@0
|
30 const uword row_offset;
|
max@0
|
31 const uword col_offset;
|
max@0
|
32
|
max@0
|
33 const uword n_rows; // equal to n_elem
|
max@0
|
34 const uword n_elem;
|
max@0
|
35
|
max@0
|
36 static const uword n_cols = 1;
|
max@0
|
37
|
max@0
|
38
|
max@0
|
39 protected:
|
max@0
|
40
|
max@0
|
41 arma_inline diagview(const Mat<eT>& in_m, const uword in_row_offset, const uword in_col_offset, const uword len);
|
max@0
|
42 arma_inline diagview( Mat<eT>& in_m, const uword in_row_offset, const uword in_col_offset, const uword len);
|
max@0
|
43
|
max@0
|
44
|
max@0
|
45 public:
|
max@0
|
46
|
max@0
|
47 inline ~diagview();
|
max@0
|
48
|
max@0
|
49 inline void operator=(const diagview& x);
|
max@0
|
50
|
max@0
|
51 inline void operator+=(const eT val);
|
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
|
max@0
|
56 template<typename T1> inline void operator= (const Base<eT,T1>& x);
|
max@0
|
57 template<typename T1> inline void operator+=(const Base<eT,T1>& x);
|
max@0
|
58 template<typename T1> inline void operator-=(const Base<eT,T1>& x);
|
max@0
|
59 template<typename T1> inline void operator%=(const Base<eT,T1>& x);
|
max@0
|
60 template<typename T1> inline void operator/=(const Base<eT,T1>& x);
|
max@0
|
61
|
max@0
|
62
|
max@0
|
63 arma_inline eT& operator[](const uword i);
|
max@0
|
64 arma_inline eT operator[](const uword i) const;
|
max@0
|
65
|
max@0
|
66 arma_inline eT& at(const uword i);
|
max@0
|
67 arma_inline eT at(const uword i) const;
|
max@0
|
68
|
max@0
|
69 arma_inline eT& operator()(const uword i);
|
max@0
|
70 arma_inline eT operator()(const uword i) const;
|
max@0
|
71
|
max@0
|
72 arma_inline eT& at(const uword in_n_row, const uword in_n_col);
|
max@0
|
73 arma_inline eT at(const uword in_n_row, const uword in_n_col) const;
|
max@0
|
74
|
max@0
|
75 arma_inline eT& operator()(const uword in_n_row, const uword in_n_col);
|
max@0
|
76 arma_inline eT operator()(const uword in_n_row, const uword in_n_col) const;
|
max@0
|
77
|
max@0
|
78
|
max@0
|
79 inline void fill(const eT val);
|
max@0
|
80 inline void zeros();
|
max@0
|
81 inline void ones();
|
max@0
|
82
|
max@0
|
83 inline static void extract(Mat<eT>& out, const diagview& in);
|
max@0
|
84
|
max@0
|
85 inline static void plus_inplace(Mat<eT>& out, const diagview& in);
|
max@0
|
86 inline static void minus_inplace(Mat<eT>& out, const diagview& in);
|
max@0
|
87 inline static void schur_inplace(Mat<eT>& out, const diagview& in);
|
max@0
|
88 inline static void div_inplace(Mat<eT>& out, const diagview& in);
|
max@0
|
89
|
max@0
|
90
|
max@0
|
91 private:
|
max@0
|
92
|
max@0
|
93 friend class Mat<eT>;
|
max@0
|
94 friend class subview<eT>;
|
max@0
|
95
|
max@0
|
96 diagview();
|
max@0
|
97 //diagview(const diagview&); // making this private causes an error under gcc 4.1/4.2, but not 4.3
|
max@0
|
98 };
|
max@0
|
99
|
max@0
|
100
|
max@0
|
101 //! @}
|