source: mmcs/armadillo_bits/subview_each_bones.hpp @ 8ad4484

matrices
Last change on this file since 8ad4484 was 9dd61b1, checked in by rboet <rboet@…>, 9 years ago

Avance del proyecto 60%

  • Property mode set to 100644
File size: 2.7 KB
Line 
1// Copyright (C) 2012 Conrad Sanderson
2//
3// This Source Code Form is subject to the terms of the Mozilla Public
4// License, v. 2.0. If a copy of the MPL was not distributed with this
5// file, You can obtain one at http://mozilla.org/MPL/2.0/.
6
7
8//! \addtogroup subview_each
9//! @{
10
11
12
13template<typename parent, unsigned int mode>
14class subview_each_common
15  {
16  public:
17 
18  typedef typename parent::elem_type eT;
19 
20 
21  protected:
22 
23  parent& p;
24 
25  arma_inline subview_each_common(parent& in_p);
26 
27  arma_inline const Mat<typename parent::elem_type>& get_mat_ref_helper(const Mat    <typename parent::elem_type>& X) const;
28  arma_inline const Mat<typename parent::elem_type>& get_mat_ref_helper(const subview<typename parent::elem_type>& X) const;
29 
30  arma_inline const Mat<typename parent::elem_type>& get_mat_ref() const;
31 
32  inline void check_size(const Mat<typename parent::elem_type>& A) const;
33 
34  arma_cold inline const std::string incompat_size_string(const Mat<typename parent::elem_type>& A) const;
35 
36 
37  private:
38 
39  subview_each_common();
40  };
41
42
43
44
45template<typename parent, unsigned int mode>
46class subview_each1 : public subview_each_common<parent, mode>
47  {
48  protected:
49 
50  arma_inline subview_each1(parent& in_p);
51 
52 
53  public:
54 
55  typedef typename parent::elem_type eT;
56 
57  inline ~subview_each1();
58 
59  // deliberately returning void
60  template<typename T1> inline void operator=  (const Base<eT,T1>& x);
61  template<typename T1> inline void operator+= (const Base<eT,T1>& x);
62  template<typename T1> inline void operator-= (const Base<eT,T1>& x);
63  template<typename T1> inline void operator%= (const Base<eT,T1>& x);
64  template<typename T1> inline void operator/= (const Base<eT,T1>& x);
65 
66 
67  private:
68 
69  friend class Mat<eT>;
70  friend class subview<eT>;
71 
72  subview_each1();
73  };
74
75
76
77template<typename parent, unsigned int mode, typename TB>
78class subview_each2 : public subview_each_common<parent, mode>
79  {
80  protected:
81 
82  const Base<uword, TB>& base_indices;
83 
84  inline subview_each2(parent& in_p, const Base<uword, TB>& in_indices);
85 
86  inline void check_indices(const Mat<uword>& indices) const;
87 
88 
89  public:
90 
91  typedef typename parent::elem_type eT;
92 
93  inline ~subview_each2();
94 
95  // deliberately returning void
96  template<typename T1> inline void operator=  (const Base<eT,T1>& x);
97  template<typename T1> inline void operator+= (const Base<eT,T1>& x);
98  template<typename T1> inline void operator-= (const Base<eT,T1>& x);
99  template<typename T1> inline void operator%= (const Base<eT,T1>& x);
100  template<typename T1> inline void operator/= (const Base<eT,T1>& x);
101 
102  // TODO: add handling of scalars
103 
104 
105  private:
106 
107  friend class Mat<eT>;
108  friend class subview<eT>;
109 
110  subview_each2();
111  };
112
113
114
115//! @}
Note: See TracBrowser for help on using the repository browser.