eOp_meat.hpp 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149
  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 eOp
  16. //! @{
  17. template<typename T1, typename eop_type>
  18. inline
  19. eOp<T1, eop_type>::eOp(const T1& in_m)
  20. : P(in_m)
  21. {
  22. arma_extra_debug_sigprint();
  23. }
  24. template<typename T1, typename eop_type>
  25. inline
  26. eOp<T1, eop_type>::eOp(const T1& in_m, const typename T1::elem_type in_aux)
  27. : P(in_m)
  28. , aux(in_aux)
  29. {
  30. arma_extra_debug_sigprint();
  31. }
  32. template<typename T1, typename eop_type>
  33. inline
  34. eOp<T1, eop_type>::eOp(const T1& in_m, const uword in_aux_uword_a, const uword in_aux_uword_b)
  35. : P(in_m)
  36. , aux_uword_a(in_aux_uword_a)
  37. , aux_uword_b(in_aux_uword_b)
  38. {
  39. arma_extra_debug_sigprint();
  40. }
  41. template<typename T1, typename eop_type>
  42. inline
  43. eOp<T1, eop_type>::eOp(const T1& in_m, const typename T1::elem_type in_aux, const uword in_aux_uword_a, const uword in_aux_uword_b)
  44. : P(in_m)
  45. , aux(in_aux)
  46. , aux_uword_a(in_aux_uword_a)
  47. , aux_uword_b(in_aux_uword_b)
  48. {
  49. arma_extra_debug_sigprint();
  50. }
  51. template<typename T1, typename eop_type>
  52. inline
  53. eOp<T1, eop_type>::~eOp()
  54. {
  55. arma_extra_debug_sigprint();
  56. }
  57. template<typename T1, typename eop_type>
  58. arma_inline
  59. uword
  60. eOp<T1, eop_type>::get_n_rows() const
  61. {
  62. return is_row ? 1 : P.get_n_rows();
  63. }
  64. template<typename T1, typename eop_type>
  65. arma_inline
  66. uword
  67. eOp<T1, eop_type>::get_n_cols() const
  68. {
  69. return is_col ? 1 : P.get_n_cols();
  70. }
  71. template<typename T1, typename eop_type>
  72. arma_inline
  73. uword
  74. eOp<T1, eop_type>::get_n_elem() const
  75. {
  76. return P.get_n_elem();
  77. }
  78. template<typename T1, typename eop_type>
  79. arma_inline
  80. typename T1::elem_type
  81. eOp<T1, eop_type>::operator[] (const uword ii) const
  82. {
  83. return eop_core<eop_type>::process(P[ii], aux);
  84. }
  85. template<typename T1, typename eop_type>
  86. arma_inline
  87. typename T1::elem_type
  88. eOp<T1, eop_type>::at(const uword row, const uword col) const
  89. {
  90. if(is_row)
  91. {
  92. return eop_core<eop_type>::process(P.at(0, col), aux);
  93. }
  94. else
  95. if(is_col)
  96. {
  97. return eop_core<eop_type>::process(P.at(row, 0), aux);
  98. }
  99. else
  100. {
  101. return eop_core<eop_type>::process(P.at(row, col), aux);
  102. }
  103. }
  104. template<typename T1, typename eop_type>
  105. arma_inline
  106. typename T1::elem_type
  107. eOp<T1, eop_type>::at_alt(const uword ii) const
  108. {
  109. return eop_core<eop_type>::process(P.at_alt(ii), aux);
  110. }
  111. //! @}