arrayops_bones.hpp 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233
  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 arrayops
  16. //! @{
  17. class arrayops
  18. {
  19. public:
  20. template<typename eT>
  21. arma_hot arma_inline static void
  22. copy(eT* dest, const eT* src, const uword n_elem);
  23. template<typename eT>
  24. arma_cold inline static void
  25. copy_small(eT* dest, const eT* src, const uword n_elem);
  26. template<typename eT>
  27. inline static void
  28. fill_zeros(eT* dest, const uword n_elem);
  29. template<typename eT>
  30. arma_hot inline static void
  31. replace(eT* mem, const uword n_elem, const eT old_val, const eT new_val);
  32. template<typename eT>
  33. arma_hot inline static void
  34. clean(eT* mem, const uword n_elem, const eT abs_limit, const typename arma_not_cx<eT>::result* junk = 0);
  35. template<typename T>
  36. arma_hot inline static void
  37. clean(std::complex<T>* mem, const uword n_elem, const T abs_limit);
  38. //
  39. // array = convert(array)
  40. template<typename out_eT, typename in_eT>
  41. arma_hot arma_inline static void
  42. convert_cx_scalar(out_eT& out, const in_eT& in, const typename arma_not_cx<out_eT>::result* junk1 = 0, const typename arma_not_cx< in_eT>::result* junk2 = 0);
  43. template<typename out_eT, typename in_T>
  44. arma_hot arma_inline static void
  45. convert_cx_scalar(out_eT& out, const std::complex<in_T>& in, const typename arma_not_cx<out_eT>::result* junk = 0);
  46. template<typename out_T, typename in_T>
  47. arma_hot arma_inline static void
  48. convert_cx_scalar(std::complex<out_T>& out, const std::complex< in_T>& in);
  49. template<typename out_eT, typename in_eT>
  50. arma_hot inline static void
  51. convert(out_eT* dest, const in_eT* src, const uword n_elem);
  52. template<typename out_eT, typename in_eT>
  53. arma_hot inline static void
  54. convert_cx(out_eT* dest, const in_eT* src, const uword n_elem);
  55. //
  56. // array op= array
  57. template<typename eT>
  58. arma_hot inline static
  59. void
  60. inplace_plus(eT* dest, const eT* src, const uword n_elem);
  61. template<typename eT>
  62. arma_hot inline static
  63. void
  64. inplace_minus(eT* dest, const eT* src, const uword n_elem);
  65. template<typename eT>
  66. arma_hot inline static
  67. void
  68. inplace_mul(eT* dest, const eT* src, const uword n_elem);
  69. template<typename eT>
  70. arma_hot inline static
  71. void
  72. inplace_div(eT* dest, const eT* src, const uword n_elem);
  73. template<typename eT>
  74. arma_hot inline static
  75. void
  76. inplace_plus_base(eT* dest, const eT* src, const uword n_elem);
  77. template<typename eT>
  78. arma_hot inline static
  79. void
  80. inplace_minus_base(eT* dest, const eT* src, const uword n_elem);
  81. template<typename eT>
  82. arma_hot inline static
  83. void
  84. inplace_mul_base(eT* dest, const eT* src, const uword n_elem);
  85. template<typename eT>
  86. arma_hot inline static
  87. void
  88. inplace_div_base(eT* dest, const eT* src, const uword n_elem);
  89. //
  90. // array op= scalar
  91. template<typename eT>
  92. arma_hot inline static
  93. void
  94. inplace_set(eT* dest, const eT val, const uword n_elem);
  95. template<typename eT>
  96. arma_hot inline static
  97. void
  98. inplace_set_simple(eT* dest, const eT val, const uword n_elem);
  99. template<typename eT>
  100. arma_hot inline static
  101. void
  102. inplace_set_base(eT* dest, const eT val, const uword n_elem);
  103. template<typename eT>
  104. arma_cold inline static
  105. void
  106. inplace_set_small(eT* dest, const eT val, const uword n_elem);
  107. template<typename eT, const uword n_elem>
  108. arma_hot inline static
  109. void
  110. inplace_set_fixed(eT* dest, const eT val);
  111. template<typename eT>
  112. arma_hot inline static
  113. void
  114. inplace_plus(eT* dest, const eT val, const uword n_elem);
  115. template<typename eT>
  116. arma_hot inline static
  117. void
  118. inplace_minus(eT* dest, const eT val, const uword n_elem);
  119. template<typename eT>
  120. arma_hot inline static void
  121. inplace_mul(eT* dest, const eT val, const uword n_elem);
  122. template<typename eT>
  123. arma_hot inline static
  124. void
  125. inplace_div(eT* dest, const eT val, const uword n_elem);
  126. template<typename eT>
  127. arma_hot inline static
  128. void
  129. inplace_plus_base(eT* dest, const eT val, const uword n_elem);
  130. template<typename eT>
  131. arma_hot inline static
  132. void
  133. inplace_minus_base(eT* dest, const eT val, const uword n_elem);
  134. template<typename eT>
  135. arma_hot inline static void
  136. inplace_mul_base(eT* dest, const eT val, const uword n_elem);
  137. template<typename eT>
  138. arma_hot inline static
  139. void
  140. inplace_div_base(eT* dest, const eT val, const uword n_elem);
  141. //
  142. // scalar = op(array)
  143. template<typename eT>
  144. arma_hot inline static
  145. eT
  146. accumulate(const eT* src, const uword n_elem);
  147. template<typename eT>
  148. arma_hot inline static
  149. eT
  150. product(const eT* src, const uword n_elem);
  151. template<typename eT>
  152. arma_hot inline static
  153. bool
  154. is_zero(const eT* mem, const uword n_elem, const eT abs_limit, const typename arma_not_cx<eT>::result* junk = 0);
  155. template<typename T>
  156. arma_hot inline static
  157. bool
  158. is_zero(const std::complex<T>* mem, const uword n_elem, const T abs_limit);
  159. template<typename eT>
  160. arma_hot inline static
  161. bool
  162. is_finite(const eT* src, const uword n_elem);
  163. template<typename eT>
  164. arma_hot inline static
  165. bool
  166. has_inf(const eT* src, const uword n_elem);
  167. template<typename eT>
  168. arma_hot inline static
  169. bool
  170. has_nan(const eT* src, const uword n_elem);
  171. };
  172. //! @}