eGlueCube_meat.hpp
Go to the documentation of this file.
1 // Copyright (C) 2010-2011 NICTA (www.nicta.com.au)
2 // Copyright (C) 2010-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 
16 
17 
18 
19 template<typename T1, typename T2, typename eglue_type>
22  {
24  }
25 
26 
27 
28 template<typename T1, typename T2, typename eglue_type>
30 eGlueCube<T1,T2,eglue_type>::eGlueCube(const T1& in_A, const T2& in_B)
31  : P1(in_A)
32  , P2(in_B)
33  {
35 
37  (
38  P1.get_n_rows(), P1.get_n_cols(), P1.get_n_slices(),
39  P2.get_n_rows(), P2.get_n_cols(), P2.get_n_slices(),
40  eglue_type::text()
41  );
42  }
43 
44 
45 
46 template<typename T1, typename T2, typename eglue_type>
48 uword
50  {
51  return P1.get_n_rows();
52  }
53 
54 
55 
56 template<typename T1, typename T2, typename eglue_type>
58 uword
60  {
61  return P1.get_n_cols();
62  }
63 
64 
65 
66 template<typename T1, typename T2, typename eglue_type>
68 uword
70  {
71  return P1.get_n_slices();
72  }
73 
74 
75 
76 template<typename T1, typename T2, typename eglue_type>
78 uword
80  {
81  return P1.get_n_elem_slice();
82  }
83 
84 
85 
86 template<typename T1, typename T2, typename eglue_type>
88 uword
90  {
91  return P1.get_n_elem();
92  }
93 
94 
95 
96 template<typename T1, typename T2, typename eglue_type>
98 typename T1::elem_type
100  {
101  typedef typename T1::elem_type eT;
102 
103  // the optimiser will keep only one return statement
104 
105  if(is_same_type<eglue_type, eglue_plus >::value == true) { return P1[i] + P2[i]; }
106  else if(is_same_type<eglue_type, eglue_minus>::value == true) { return P1[i] - P2[i]; }
107  else if(is_same_type<eglue_type, eglue_div >::value == true) { return P1[i] / P2[i]; }
108  else if(is_same_type<eglue_type, eglue_schur>::value == true) { return P1[i] * P2[i]; }
109  }
110 
111 
112 template<typename T1, typename T2, typename eglue_type>
114 typename T1::elem_type
115 eGlueCube<T1,T2,eglue_type>::at(const uword row, const uword col, const uword slice) const
116  {
117  typedef typename T1::elem_type eT;
118 
119  // the optimiser will keep only one return statement
120 
121  if(is_same_type<eglue_type, eglue_plus >::value == true) { return P1.at(row,col,slice) + P2.at(row,col,slice); }
122  else if(is_same_type<eglue_type, eglue_minus>::value == true) { return P1.at(row,col,slice) - P2.at(row,col,slice); }
123  else if(is_same_type<eglue_type, eglue_div >::value == true) { return P1.at(row,col,slice) / P2.at(row,col,slice); }
124  else if(is_same_type<eglue_type, eglue_schur>::value == true) { return P1.at(row,col,slice) * P2.at(row,col,slice); }
125  }
126 
127 
128 
arma_inline uword get_n_elem() const
arma_inline uword get_n_slices() const
void arma_hot arma_assert_same_size(const uword A_n_rows, const uword A_n_cols, const uword B_n_rows, const uword B_n_cols, const char *x)
Definition: debug.hpp:459
u32 uword
Definition: typedef.hpp:85
arma_inline elem_type operator[](const uword i) const
arma_inline uword get_n_rows() const
arma_inline uword get_n_cols() const
arma_inline ~eGlueCube()
arma_inline eGlueCube(const T1 &in_A, const T2 &in_B)
#define arma_extra_debug_sigprint
Definition: debug.hpp:1116
arma_aligned const ProxyCube< T2 > P2
arma_inline uword get_n_elem_slice() const
#define arma_inline
arma_inline elem_type at(const uword row, const uword col, const uword slice) const
arma_aligned const ProxyCube< T1 > P1


armadillo_matrix
Author(s):
autogenerated on Fri Apr 16 2021 02:31:57