SpBase_bones.hpp 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  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 SpBase
  16. //! @{
  17. template<typename elem_type, typename derived>
  18. struct SpBase_eval_SpMat
  19. {
  20. inline const derived& eval() const;
  21. };
  22. template<typename elem_type, typename derived>
  23. struct SpBase_eval_expr
  24. {
  25. inline SpMat<elem_type> eval() const; //!< force the immediate evaluation of a delayed expression
  26. };
  27. template<typename elem_type, typename derived, bool condition>
  28. struct SpBase_eval {};
  29. template<typename elem_type, typename derived>
  30. struct SpBase_eval<elem_type, derived, true> { typedef SpBase_eval_SpMat<elem_type, derived> result; };
  31. template<typename elem_type, typename derived>
  32. struct SpBase_eval<elem_type, derived, false> { typedef SpBase_eval_expr<elem_type, derived> result; };
  33. template<typename elem_type, typename derived>
  34. struct SpBase
  35. : public SpBase_eval<elem_type, derived, is_SpMat<derived>::value>::result
  36. {
  37. arma_inline const derived& get_ref() const;
  38. arma_inline bool is_alias(const SpMat<elem_type>& X) const;
  39. inline const SpOp<derived,spop_htrans> t() const; //!< Hermitian transpose
  40. inline const SpOp<derived,spop_htrans> ht() const; //!< Hermitian transpose
  41. inline const SpOp<derived,spop_strans> st() const; //!< simple transpose
  42. arma_cold inline void print( const std::string extra_text = "") const;
  43. arma_cold inline void print(std::ostream& user_stream, const std::string extra_text = "") const;
  44. arma_cold inline void raw_print( const std::string extra_text = "") const;
  45. arma_cold inline void raw_print(std::ostream& user_stream, const std::string extra_text = "") const;
  46. arma_cold inline void print_dense( const std::string extra_text = "") const;
  47. arma_cold inline void print_dense(std::ostream& user_stream, const std::string extra_text = "") const;
  48. arma_cold inline void raw_print_dense( const std::string extra_text = "") const;
  49. arma_cold inline void raw_print_dense(std::ostream& user_stream, const std::string extra_text = "") const;
  50. inline arma_warn_unused elem_type min() const;
  51. inline arma_warn_unused elem_type max() const;
  52. inline elem_type min(uword& index_of_min_val) const;
  53. inline elem_type max(uword& index_of_max_val) const;
  54. inline elem_type min(uword& row_of_min_val, uword& col_of_min_val) const;
  55. inline elem_type max(uword& row_of_max_val, uword& col_of_max_val) const;
  56. inline arma_warn_unused uword index_min() const;
  57. inline arma_warn_unused uword index_max() const;
  58. inline arma_warn_unused bool is_symmetric() const;
  59. inline arma_warn_unused bool is_symmetric(const typename get_pod_type<elem_type>::result tol) const;
  60. inline arma_warn_unused bool is_hermitian() const;
  61. inline arma_warn_unused bool is_hermitian(const typename get_pod_type<elem_type>::result tol) const;
  62. inline arma_warn_unused bool is_zero(const typename get_pod_type<elem_type>::result tol = 0) const;
  63. inline arma_warn_unused bool is_trimatu() const;
  64. inline arma_warn_unused bool is_trimatl() const;
  65. inline arma_warn_unused bool is_diagmat() const;
  66. inline arma_warn_unused bool is_empty() const;
  67. inline arma_warn_unused bool is_square() const;
  68. inline arma_warn_unused bool is_vec() const;
  69. inline arma_warn_unused bool is_colvec() const;
  70. inline arma_warn_unused bool is_rowvec() const;
  71. inline arma_warn_unused bool is_finite() const;
  72. inline arma_warn_unused bool has_inf() const;
  73. inline arma_warn_unused bool has_nan() const;
  74. inline arma_warn_unused const SpOp<derived,spop_vectorise_col> as_col() const;
  75. inline arma_warn_unused const SpOp<derived,spop_vectorise_row> as_row() const;
  76. };
  77. //! @}