Classes | |
class | op_htrans |
'hermitian transpose' operation (only valid for complex number matrices) More... | |
Functions | |
template<typename T > | |
static void | op_htrans::apply_noalias (Mat< std::complex< T > > &out, const Mat< std::complex< T > > &A) |
Immediate transpose of a complex matrix. | |
template<typename T > | |
static void | op_htrans::apply (Mat< std::complex< T > > &out, const Mat< std::complex< T > > &A) |
Immediate transpose of a complex matrix. | |
template<typename T , typename T1 > | |
static void | op_htrans::apply (Mat< std::complex< T > > &out, const Op< T1, op_htrans > &in) |
void op_htrans::apply_noalias | ( | Mat< std::complex< T > > & | out, | |
const Mat< std::complex< T > > & | A | |||
) | [inline, static, inherited] |
Immediate transpose of a complex matrix.
Definition at line 24 of file op_htrans_meat.hpp.
References conj().
Referenced by apply().
00025 { 00026 arma_extra_debug_sigprint(); 00027 00028 out.set_size(A.n_cols, A.n_rows); 00029 00030 for(u32 in_row = 0; in_row<A.n_rows; ++in_row) 00031 { 00032 const u32 out_col = in_row; 00033 00034 for(u32 in_col = 0; in_col<A.n_cols; ++in_col) 00035 { 00036 const u32 out_row = in_col; 00037 out.at(out_row, out_col) = std::conj( A.at(in_row, in_col) ); 00038 } 00039 } 00040 00041 }
void op_htrans::apply | ( | Mat< std::complex< T > > & | out, | |
const Mat< std::complex< T > > & | A | |||
) | [inline, static, inherited] |
Immediate transpose of a complex matrix.
Definition at line 51 of file op_htrans_meat.hpp.
References apply_noalias(), and conj().
Referenced by auxlib::svd().
00052 { 00053 arma_extra_debug_sigprint(); 00054 00055 typedef typename std::complex<T> eT; 00056 00057 if(&out != &A) 00058 { 00059 op_htrans::apply_noalias(out, A); 00060 } 00061 else 00062 { 00063 if(out.n_rows == out.n_cols) 00064 { 00065 arma_extra_debug_print("doing in-place hermitian transpose of a square matrix"); 00066 00067 const u32 n_rows = out.n_rows; 00068 const u32 n_cols = out.n_cols; 00069 00070 for(u32 col=0; col<n_cols; ++col) 00071 { 00072 eT* coldata = out.colptr(col); 00073 00074 for(u32 row=(col+1); row<n_rows; ++row) 00075 { 00076 eT val1 = std::conj(coldata[row]); 00077 eT val2 = std::conj(out.at(col,row)); 00078 00079 out.at(col,row) = val1; 00080 coldata[row] = val2; 00081 } 00082 } 00083 } 00084 else 00085 { 00086 const Mat<eT> A_copy = A; 00087 op_trans::apply_noalias(out, A_copy); 00088 } 00089 } 00090 00091 }
void op_htrans::apply | ( | Mat< std::complex< T > > & | out, | |
const Op< T1, op_htrans > & | in | |||
) | [inline, static, inherited] |
Definition at line 98 of file op_htrans_meat.hpp.
References apply_noalias(), conj(), and Op< T1, op_type >::m.
00099 { 00100 arma_extra_debug_sigprint(); 00101 00102 typedef typename std::complex<T> eT; 00103 00104 isnt_same_type<eT,typename T1::elem_type>::check(); 00105 00106 const unwrap<T1> tmp(in.m); 00107 const Mat<eT>& A = tmp.M; 00108 00109 if(&out != &A) 00110 { 00111 op_htrans::apply_noalias(out, A); 00112 } 00113 else 00114 { 00115 if(out.n_rows == out.n_cols) 00116 { 00117 arma_extra_debug_print("doing in-place hermitian transpose of a square matrix"); 00118 00119 const u32 n_rows = out.n_rows; 00120 const u32 n_cols = out.n_cols; 00121 00122 for(u32 col=0; col<n_cols; ++col) 00123 { 00124 eT* coldata = out.colptr(col); 00125 00126 for(u32 row=(col+1); row<n_rows; ++row) 00127 { 00128 eT val1 = std::conj(coldata[row]); 00129 eT val2 = std::conj(out.at(col,row)); 00130 00131 out.at(col,row) = val1; 00132 coldata[row] = val2; 00133 } 00134 } 00135 } 00136 else 00137 { 00138 const Mat<eT> A_copy = A; 00139 op_trans::apply_noalias(out, A_copy); 00140 } 00141 } 00142 00143 00144 }