fn_inplace_trans.hpp 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129
  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 fn_inplace_trans
  16. //! @{
  17. template<typename eT>
  18. inline
  19. typename
  20. enable_if2
  21. <
  22. is_cx<eT>::no,
  23. void
  24. >::result
  25. inplace_htrans
  26. (
  27. Mat<eT>& X,
  28. const char* method = "std"
  29. )
  30. {
  31. arma_extra_debug_sigprint();
  32. inplace_strans(X, method);
  33. }
  34. template<typename eT>
  35. inline
  36. typename
  37. enable_if2
  38. <
  39. is_cx<eT>::yes,
  40. void
  41. >::result
  42. inplace_htrans
  43. (
  44. Mat<eT>& X,
  45. const char* method = "std"
  46. )
  47. {
  48. arma_extra_debug_sigprint();
  49. const char sig = (method != NULL) ? method[0] : char(0);
  50. arma_debug_check( ((sig != 's') && (sig != 'l')), "inplace_htrans(): unknown method specified" );
  51. const bool low_memory = (sig == 'l');
  52. if( (low_memory == false) || (X.n_rows == X.n_cols) )
  53. {
  54. op_htrans::apply_mat_inplace(X);
  55. }
  56. else
  57. {
  58. inplace_strans(X, method);
  59. X = conj(X);
  60. }
  61. }
  62. template<typename eT>
  63. inline
  64. typename
  65. enable_if2
  66. <
  67. is_cx<eT>::no,
  68. void
  69. >::result
  70. inplace_trans
  71. (
  72. Mat<eT>& X,
  73. const char* method = "std"
  74. )
  75. {
  76. arma_extra_debug_sigprint();
  77. const char sig = (method != NULL) ? method[0] : char(0);
  78. arma_debug_check( ((sig != 's') && (sig != 'l')), "inplace_trans(): unknown method specified" );
  79. inplace_strans(X, method);
  80. }
  81. template<typename eT>
  82. inline
  83. typename
  84. enable_if2
  85. <
  86. is_cx<eT>::yes,
  87. void
  88. >::result
  89. inplace_trans
  90. (
  91. Mat<eT>& X,
  92. const char* method = "std"
  93. )
  94. {
  95. arma_extra_debug_sigprint();
  96. const char sig = (method != NULL) ? method[0] : char(0);
  97. arma_debug_check( ((sig != 's') && (sig != 'l')), "inplace_trans(): unknown method specified" );
  98. inplace_htrans(X, method);
  99. }
  100. //! @}