operator_ostream.hpp 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184
  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 operator_ostream
  16. //! @{
  17. template<typename eT, typename T1>
  18. inline
  19. std::ostream&
  20. operator<< (std::ostream& o, const Base<eT,T1>& X)
  21. {
  22. arma_extra_debug_sigprint();
  23. const unwrap<T1> tmp(X.get_ref());
  24. arma_ostream::print(o, tmp.M, true);
  25. return o;
  26. }
  27. template<typename eT, typename T1>
  28. inline
  29. std::ostream&
  30. operator<< (std::ostream& o, const SpBase<eT,T1>& X)
  31. {
  32. arma_extra_debug_sigprint();
  33. const unwrap_spmat<T1> tmp(X.get_ref());
  34. arma_ostream::print(o, tmp.M, true);
  35. return o;
  36. }
  37. template<typename T1>
  38. inline
  39. std::ostream&
  40. operator<< (std::ostream& o, const SpValProxy<T1>& X)
  41. {
  42. arma_extra_debug_sigprint();
  43. typedef typename T1::elem_type eT;
  44. o << eT(X);
  45. return o;
  46. }
  47. template<typename eT>
  48. inline
  49. std::ostream&
  50. operator<< (std::ostream& o, const MapMat_val<eT>& X)
  51. {
  52. arma_extra_debug_sigprint();
  53. o << eT(X);
  54. return o;
  55. }
  56. template<typename eT>
  57. inline
  58. std::ostream&
  59. operator<< (std::ostream& o, const SpMat_MapMat_val<eT>& X)
  60. {
  61. arma_extra_debug_sigprint();
  62. o << eT(X);
  63. return o;
  64. }
  65. template<typename eT>
  66. inline
  67. std::ostream&
  68. operator<< (std::ostream& o, const SpSubview_MapMat_val<eT>& X)
  69. {
  70. arma_extra_debug_sigprint();
  71. o << eT(X);
  72. return o;
  73. }
  74. template<typename T1>
  75. inline
  76. std::ostream&
  77. operator<< (std::ostream& o, const BaseCube<typename T1::elem_type,T1>& X)
  78. {
  79. arma_extra_debug_sigprint();
  80. const unwrap_cube<T1> tmp(X.get_ref());
  81. arma_ostream::print(o, tmp.M, true);
  82. return o;
  83. }
  84. //! Print the contents of a field to the specified stream.
  85. template<typename T1>
  86. inline
  87. std::ostream&
  88. operator<< (std::ostream& o, const field<T1>& X)
  89. {
  90. arma_extra_debug_sigprint();
  91. arma_ostream::print(o, X);
  92. return o;
  93. }
  94. //! Print the contents of a subfield to the specified stream
  95. template<typename T1>
  96. inline
  97. std::ostream&
  98. operator<< (std::ostream& o, const subview_field<T1>& X)
  99. {
  100. arma_extra_debug_sigprint();
  101. arma_ostream::print(o, X);
  102. return o;
  103. }
  104. inline
  105. std::ostream&
  106. operator<< (std::ostream& o, const SizeMat& S)
  107. {
  108. arma_extra_debug_sigprint();
  109. arma_ostream::print(o, S);
  110. return o;
  111. }
  112. inline
  113. std::ostream&
  114. operator<< (std::ostream& o, const SizeCube& S)
  115. {
  116. arma_extra_debug_sigprint();
  117. arma_ostream::print(o, S);
  118. return o;
  119. }
  120. //! @}