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