op_strans_bones.hpp 2.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  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 op_strans
  16. //! @{
  17. //! 'matrix transpose' operation (simple transpose, ie. without taking the conjugate of the elements)
  18. class op_strans
  19. {
  20. public:
  21. template<typename T1>
  22. struct traits
  23. {
  24. static const bool is_row = T1::is_col; // deliberately swapped
  25. static const bool is_col = T1::is_row;
  26. static const bool is_xvec = T1::is_xvec;
  27. };
  28. template<const bool do_flip, const uword row, const uword col>
  29. struct pos
  30. {
  31. static const uword n2 = (do_flip == false) ? (row + col*2) : (col + row*2);
  32. static const uword n3 = (do_flip == false) ? (row + col*3) : (col + row*3);
  33. static const uword n4 = (do_flip == false) ? (row + col*4) : (col + row*4);
  34. };
  35. template<typename eT, typename TA>
  36. arma_cold inline static void apply_mat_noalias_tinysq(Mat<eT>& out, const TA& A);
  37. template<typename eT>
  38. arma_hot inline static void block_worker(eT* Y, const eT* X, const uword X_n_rows, const uword Y_n_rows, const uword n_rows, const uword n_cols);
  39. template<typename eT>
  40. arma_hot inline static void apply_mat_noalias_large(Mat<eT>& out, const Mat<eT>& A);
  41. template<typename eT, typename TA>
  42. arma_hot inline static void apply_mat_noalias(Mat<eT>& out, const TA& A);
  43. template<typename eT>
  44. arma_hot inline static void apply_mat_inplace(Mat<eT>& out);
  45. template<typename eT, typename TA>
  46. arma_hot inline static void apply_mat(Mat<eT>& out, const TA& A);
  47. template<typename T1>
  48. arma_hot inline static void apply_proxy(Mat<typename T1::elem_type>& out, const T1& X);
  49. template<typename T1>
  50. arma_hot inline static void apply_direct(Mat<typename T1::elem_type>& out, const T1& X);
  51. template<typename T1>
  52. arma_hot inline static void apply(Mat<typename T1::elem_type>& out, const Op<T1,op_strans>& in);
  53. };
  54. class op_strans_cube
  55. {
  56. public:
  57. template<typename eT>
  58. inline static void apply_noalias(Cube<eT>& out, const Cube<eT>& X);
  59. };
  60. //! @}