strip.hpp 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164
  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 strip
  16. //! @{
  17. template<typename T1>
  18. struct strip_diagmat
  19. {
  20. typedef T1 stored_type;
  21. inline
  22. strip_diagmat(const T1& X)
  23. : M(X)
  24. {
  25. arma_extra_debug_sigprint();
  26. }
  27. static const bool do_diagmat = false;
  28. const T1& M;
  29. };
  30. template<typename T1>
  31. struct strip_diagmat< Op<T1, op_diagmat> >
  32. {
  33. typedef T1 stored_type;
  34. inline
  35. strip_diagmat(const Op<T1, op_diagmat>& X)
  36. : M(X.m)
  37. {
  38. arma_extra_debug_sigprint();
  39. }
  40. static const bool do_diagmat = true;
  41. const T1& M;
  42. };
  43. template<typename T1>
  44. struct strip_inv
  45. {
  46. typedef T1 stored_type;
  47. inline
  48. strip_inv(const T1& X)
  49. : M(X)
  50. {
  51. arma_extra_debug_sigprint();
  52. }
  53. const T1& M;
  54. static const bool do_inv = false;
  55. static const bool do_inv_sympd = false;
  56. };
  57. template<typename T1>
  58. struct strip_inv< Op<T1, op_inv> >
  59. {
  60. typedef T1 stored_type;
  61. inline
  62. strip_inv(const Op<T1, op_inv>& X)
  63. : M(X.m)
  64. {
  65. arma_extra_debug_sigprint();
  66. }
  67. const T1& M;
  68. static const bool do_inv = true;
  69. static const bool do_inv_sympd = false;
  70. };
  71. template<typename T1>
  72. struct strip_inv< Op<T1, op_inv_sympd> >
  73. {
  74. typedef T1 stored_type;
  75. inline
  76. strip_inv(const Op<T1, op_inv_sympd>& X)
  77. : M(X.m)
  78. {
  79. arma_extra_debug_sigprint();
  80. }
  81. const T1& M;
  82. static const bool do_inv = true;
  83. static const bool do_inv_sympd = true;
  84. };
  85. template<typename T1>
  86. struct strip_trimat
  87. {
  88. typedef T1 stored_type;
  89. const T1& M;
  90. static const bool do_trimat = false;
  91. static const bool do_triu = false;
  92. static const bool do_tril = false;
  93. inline
  94. strip_trimat(const T1& X)
  95. : M(X)
  96. {
  97. arma_extra_debug_sigprint();
  98. }
  99. };
  100. template<typename T1>
  101. struct strip_trimat< Op<T1, op_trimat> >
  102. {
  103. typedef T1 stored_type;
  104. const T1& M;
  105. static const bool do_trimat = true;
  106. const bool do_triu;
  107. const bool do_tril;
  108. inline
  109. strip_trimat(const Op<T1, op_trimat>& X)
  110. : M(X.m)
  111. , do_triu(X.aux_uword_a == 0)
  112. , do_tril(X.aux_uword_a == 1)
  113. {
  114. arma_extra_debug_sigprint();
  115. }
  116. };
  117. //! @}