BaseCube_bones.hpp 2.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  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 BaseCube
  16. //! @{
  17. template<typename elem_type, typename derived>
  18. struct BaseCube_eval_Cube
  19. {
  20. arma_inline const derived& eval() const;
  21. };
  22. template<typename elem_type, typename derived>
  23. struct BaseCube_eval_expr
  24. {
  25. arma_inline Cube<elem_type> eval() const; //!< force the immediate evaluation of a delayed expression
  26. };
  27. template<typename elem_type, typename derived, bool condition>
  28. struct BaseCube_eval {};
  29. template<typename elem_type, typename derived>
  30. struct BaseCube_eval<elem_type, derived, true> { typedef BaseCube_eval_Cube<elem_type, derived> result; };
  31. template<typename elem_type, typename derived>
  32. struct BaseCube_eval<elem_type, derived, false> { typedef BaseCube_eval_expr<elem_type, derived> result; };
  33. //! Analog of the Base class, intended for cubes
  34. template<typename elem_type, typename derived>
  35. struct BaseCube
  36. : public BaseCube_eval<elem_type, derived, is_Cube<derived>::value>::result
  37. {
  38. arma_inline const derived& get_ref() const;
  39. arma_cold inline void print( const std::string extra_text = "") const;
  40. arma_cold inline void print(std::ostream& user_stream, const std::string extra_text = "") const;
  41. arma_cold inline void raw_print( const std::string extra_text = "") const;
  42. arma_cold inline void raw_print(std::ostream& user_stream, const std::string extra_text = "") const;
  43. inline arma_warn_unused elem_type min() const;
  44. inline arma_warn_unused elem_type max() const;
  45. inline arma_warn_unused uword index_min() const;
  46. inline arma_warn_unused uword index_max() const;
  47. inline arma_warn_unused bool is_zero(const typename get_pod_type<elem_type>::result tol = 0) const;
  48. inline arma_warn_unused bool is_empty() const;
  49. inline arma_warn_unused bool is_finite() const;
  50. inline arma_warn_unused bool has_inf() const;
  51. inline arma_warn_unused bool has_nan() const;
  52. };
  53. //! @}