op_mean_bones.hpp 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  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 op_mean
  16. //! @{
  17. //! Class for finding mean values of a matrix
  18. class op_mean
  19. : public traits_op_xvec
  20. {
  21. public:
  22. // dense matrices
  23. template<typename T1>
  24. inline static void apply(Mat<typename T1::elem_type>& out, const Op<T1,op_mean>& in);
  25. template<typename T1>
  26. inline static void apply_noalias(Mat<typename T1::elem_type>& out, const Proxy<T1>& P, const uword dim);
  27. template<typename T1>
  28. inline static void apply_noalias_unwrap(Mat<typename T1::elem_type>& out, const Proxy<T1>& P, const uword dim);
  29. template<typename T1>
  30. inline static void apply_noalias_proxy(Mat<typename T1::elem_type>& out, const Proxy<T1>& P, const uword dim);
  31. // cubes
  32. template<typename T1>
  33. inline static void apply(Cube<typename T1::elem_type>& out, const OpCube<T1,op_mean>& in);
  34. template<typename T1>
  35. inline static void apply_noalias(Cube<typename T1::elem_type>& out, const ProxyCube<T1>& P, const uword dim);
  36. template<typename T1>
  37. inline static void apply_noalias_unwrap(Cube<typename T1::elem_type>& out, const ProxyCube<T1>& P, const uword dim);
  38. template<typename T1>
  39. inline static void apply_noalias_proxy(Cube<typename T1::elem_type>& out, const ProxyCube<T1>& P, const uword dim);
  40. //
  41. template<typename eT>
  42. inline static eT direct_mean(const eT* const X, const uword N);
  43. template<typename eT>
  44. inline static eT direct_mean_robust(const eT* const X, const uword N);
  45. //
  46. template<typename eT>
  47. inline static eT direct_mean(const Mat<eT>& X, const uword row);
  48. template<typename eT>
  49. inline static eT direct_mean_robust(const Mat<eT>& X, const uword row);
  50. //
  51. template<typename eT>
  52. inline static eT mean_all(const subview<eT>& X);
  53. template<typename eT>
  54. inline static eT mean_all_robust(const subview<eT>& X);
  55. //
  56. template<typename eT>
  57. inline static eT mean_all(const diagview<eT>& X);
  58. template<typename eT>
  59. inline static eT mean_all_robust(const diagview<eT>& X);
  60. //
  61. template<typename T1>
  62. inline static typename T1::elem_type mean_all(const Op<T1,op_vectorise_col>& X);
  63. template<typename T1>
  64. inline static typename T1::elem_type mean_all(const Base<typename T1::elem_type, T1>& X);
  65. //
  66. template<typename eT>
  67. arma_inline static eT robust_mean(const eT A, const eT B);
  68. template<typename T>
  69. arma_inline static std::complex<T> robust_mean(const std::complex<T>& A, const std::complex<T>& B);
  70. };
  71. //! @}