1 // SPDX-License-Identifier: Apache-2.0
2 //
3 // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au)
4 // Copyright 2008-2016 National ICT Australia (NICTA)
5 //
6 // Licensed under the Apache License, Version 2.0 (the "License");
7 // you may not use this file except in compliance with the License.
8 // You may obtain a copy of the License at
9 // http://www.apache.org/licenses/LICENSE-2.0
10 //
11 // Unless required by applicable law or agreed to in writing, software
12 // distributed under the License is distributed on an "AS IS" BASIS,
13 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 // See the License for the specific language governing permissions and
15 // limitations under the License.
16 // ------------------------------------------------------------------------
17 
18 
19 //! \addtogroup xtrans_mat
20 //! @{
21 
22 
23 template<typename eT, bool do_conj>
24 inline
xtrans_mat(const Mat<eT> & in_X)25 xtrans_mat<eT,do_conj>::xtrans_mat(const Mat<eT>& in_X)
26   : X     (in_X       )
27   , n_rows(in_X.n_cols)  // deliberately swapped
28   , n_cols(in_X.n_rows)
29   , n_elem(in_X.n_elem)
30   {
31   arma_extra_debug_sigprint();
32   }
33 
34 
35 
36 template<typename eT, bool do_conj>
37 inline
38 void
extract(Mat<eT> & out) const39 xtrans_mat<eT,do_conj>::extract(Mat<eT>& out) const
40   {
41   arma_extra_debug_sigprint();
42 
43   really_do_conj ? op_htrans::apply_mat(out, X) : op_strans::apply_mat(out, X);
44   }
45 
46 
47 
48 template<typename eT, bool do_conj>
49 inline
50 eT
operator [](const uword ii) const51 xtrans_mat<eT,do_conj>::operator[](const uword ii) const
52   {
53   if(Y.n_elem > 0)
54     {
55     return Y[ii];
56     }
57   else
58     {
59     really_do_conj ? op_htrans::apply_mat(Y, X) : op_strans::apply_mat(Y, X);
60     return Y[ii];
61     }
62   }
63 
64 
65 
66 template<typename eT, bool do_conj>
67 inline
68 eT
at_alt(const uword ii) const69 xtrans_mat<eT,do_conj>::at_alt(const uword ii) const
70   {
71   return (*this).operator[](ii);
72   }
73 
74 
75 
76 template<typename eT, bool do_conj>
77 arma_inline
78 eT
at(const uword in_row,const uword in_col) const79 xtrans_mat<eT,do_conj>::at(const uword in_row, const uword in_col) const
80   {
81   return really_do_conj ? eT(access::alt_conj(X.at(in_col, in_row))) : eT(X.at(in_col, in_row));
82   // in_row and in_col deliberately swapped above
83   }
84 
85 
86 
87 //! @}
88