GenCube_bones.hpp 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  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 GenCube
  16. //! @{
  17. //! support class for generator functions (eg. zeros, randu, randn, ...)
  18. template<typename eT, typename gen_type>
  19. class GenCube
  20. : public BaseCube<eT, GenCube<eT, gen_type> >
  21. , public GenSpecialiser<eT, is_same_type<gen_type, gen_zeros>::yes, is_same_type<gen_type, gen_ones>::yes, is_same_type<gen_type, gen_randu>::yes, is_same_type<gen_type, gen_randn>::yes>
  22. {
  23. public:
  24. typedef eT elem_type;
  25. typedef typename get_pod_type<elem_type>::result pod_type;
  26. static const bool use_at = false;
  27. static const bool is_simple = (is_same_type<gen_type, gen_ones>::value) || (is_same_type<gen_type, gen_zeros>::value);
  28. arma_aligned const uword n_rows;
  29. arma_aligned const uword n_cols;
  30. arma_aligned const uword n_slices;
  31. arma_inline GenCube(const uword in_n_rows, const uword in_n_cols, const uword in_n_slices);
  32. arma_inline ~GenCube();
  33. arma_inline eT operator[] (const uword i) const;
  34. arma_inline eT at (const uword row, const uword col, const uword slice) const;
  35. arma_inline eT at_alt (const uword i) const;
  36. inline void apply (Cube<eT>& out) const;
  37. inline void apply_inplace_plus (Cube<eT>& out) const;
  38. inline void apply_inplace_minus(Cube<eT>& out) const;
  39. inline void apply_inplace_schur(Cube<eT>& out) const;
  40. inline void apply_inplace_div (Cube<eT>& out) const;
  41. inline void apply(subview_cube<elem_type>& out) const;
  42. };
  43. //! @}