subview_elem1_bones.hpp 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  1. // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au)
  2. // Copyright 2008-2016 National ICT Australia (NICTA)
  3. //
  4. // Licensed under the Apache License, Version 2.0 (the "License");
  5. // you may not use this file except in compliance with the License.
  6. // You may obtain a copy of the License at
  7. // http://www.apache.org/licenses/LICENSE-2.0
  8. //
  9. // Unless required by applicable law or agreed to in writing, software
  10. // distributed under the License is distributed on an "AS IS" BASIS,
  11. // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. // See the License for the specific language governing permissions and
  13. // limitations under the License.
  14. // ------------------------------------------------------------------------
  15. //! \addtogroup subview_elem1
  16. //! @{
  17. template<typename eT, typename T1>
  18. class subview_elem1 : public Base<eT, subview_elem1<eT,T1> >
  19. {
  20. public:
  21. typedef eT elem_type;
  22. typedef typename get_pod_type<elem_type>::result pod_type;
  23. static const bool is_row = false;
  24. static const bool is_col = true;
  25. static const bool is_xvec = false;
  26. arma_aligned const Mat<eT> fake_m;
  27. arma_aligned const Mat<eT>& m;
  28. arma_aligned const Base<uword,T1>& a;
  29. protected:
  30. arma_inline subview_elem1(const Mat<eT>& in_m, const Base<uword,T1>& in_a);
  31. arma_inline subview_elem1(const Cube<eT>& in_q, const Base<uword,T1>& in_a);
  32. public:
  33. inline ~subview_elem1();
  34. template<typename op_type> inline void inplace_op(const eT val);
  35. template<typename op_type, typename T2> inline void inplace_op(const subview_elem1<eT,T2>& x );
  36. template<typename op_type, typename T2> inline void inplace_op(const Base<eT,T2>& x );
  37. arma_inline const Op<subview_elem1<eT,T1>,op_htrans> t() const;
  38. arma_inline const Op<subview_elem1<eT,T1>,op_htrans> ht() const;
  39. arma_inline const Op<subview_elem1<eT,T1>,op_strans> st() const;
  40. inline void replace(const eT old_val, const eT new_val);
  41. inline void fill(const eT val);
  42. inline void zeros();
  43. inline void ones();
  44. inline void randu();
  45. inline void randn();
  46. inline void operator+= (const eT val);
  47. inline void operator-= (const eT val);
  48. inline void operator*= (const eT val);
  49. inline void operator/= (const eT val);
  50. // deliberately returning void
  51. template<typename T2> inline void operator_equ(const subview_elem1<eT,T2>& x);
  52. template<typename T2> inline void operator= (const subview_elem1<eT,T2>& x);
  53. inline void operator= (const subview_elem1<eT,T1>& x);
  54. template<typename T2> inline void operator+= (const subview_elem1<eT,T2>& x);
  55. template<typename T2> inline void operator-= (const subview_elem1<eT,T2>& x);
  56. template<typename T2> inline void operator%= (const subview_elem1<eT,T2>& x);
  57. template<typename T2> inline void operator/= (const subview_elem1<eT,T2>& x);
  58. template<typename T2> inline void operator= (const Base<eT,T2>& x);
  59. template<typename T2> inline void operator+= (const Base<eT,T2>& x);
  60. template<typename T2> inline void operator-= (const Base<eT,T2>& x);
  61. template<typename T2> inline void operator%= (const Base<eT,T2>& x);
  62. template<typename T2> inline void operator/= (const Base<eT,T2>& x);
  63. inline static void extract(Mat<eT>& out, const subview_elem1& in);
  64. template<typename op_type> inline static void mat_inplace_op(Mat<eT>& out, const subview_elem1& in);
  65. inline static void plus_inplace(Mat<eT>& out, const subview_elem1& in);
  66. inline static void minus_inplace(Mat<eT>& out, const subview_elem1& in);
  67. inline static void schur_inplace(Mat<eT>& out, const subview_elem1& in);
  68. inline static void div_inplace(Mat<eT>& out, const subview_elem1& in);
  69. private:
  70. friend class Mat<eT>;
  71. friend class Cube<eT>;
  72. subview_elem1();
  73. };
  74. //! @}