Classes | |
class | op_cov |
Functions | |
template<typename eT > | |
static void | op_cov::direct_cov (Mat< eT > &out, const Mat< eT > &X, const u32 norm_type) |
template<typename T > | |
static void | op_cov::direct_cov (Mat< std::complex< T > > &out, const Mat< std::complex< T > > &X, const u32 norm_type) |
template<typename T1 > | |
static void | op_cov::apply (Mat< typename T1::elem_type > &out, const Op< T1, op_cov > &in) |
void op_cov::direct_cov | ( | Mat< eT > & | out, | |
const Mat< eT > & | X, | |||
const u32 | norm_type | |||
) | [inline, static, inherited] |
Definition at line 27 of file op_cov_meat.hpp.
References Mat< eT >::is_vec(), Mat< eT >::n_rows, sum(), trans(), and var().
Referenced by apply().
00028 { 00029 arma_extra_debug_sigprint(); 00030 00031 if(A.is_vec()) 00032 { 00033 if(A.n_rows == 1) 00034 { 00035 out = var(trans(A), norm_type); 00036 } 00037 else 00038 { 00039 out = var(A, norm_type); 00040 } 00041 } 00042 else 00043 { 00044 const u32 N = A.n_rows; 00045 const eT norm_val = (norm_type == 0) ? ( (N > 1) ? eT(N-1) : eT(1) ) : eT(N); 00046 00047 const Row<eT> acc = sum(A); 00048 00049 out = trans(A) * A; 00050 out -= (trans(acc) * acc)/eT(N); 00051 out /= norm_val; 00052 } 00053 }
void op_cov::direct_cov | ( | Mat< std::complex< T > > & | out, | |
const Mat< std::complex< T > > & | X, | |||
const u32 | norm_type | |||
) | [inline, static, inherited] |
Definition at line 60 of file op_cov_meat.hpp.
References conj(), Mat< eT >::n_rows, sum(), trans(), and var().
00061 { 00062 arma_extra_debug_sigprint(); 00063 00064 typedef typename std::complex<T> eT; 00065 00066 if(A.is_vec()) 00067 { 00068 if(A.n_rows == 1) 00069 { 00070 const Mat<T> tmp_mat = var(trans(A), norm_type); 00071 out.set_size(1,1); 00072 out[0] = tmp_mat[0]; 00073 } 00074 else 00075 { 00076 const Mat<T> tmp_mat = var(A, norm_type); 00077 out.set_size(1,1); 00078 out[0] = tmp_mat[0]; 00079 } 00080 } 00081 else 00082 { 00083 const u32 N = A.n_rows; 00084 const eT norm_val = (norm_type == 0) ? ( (N > 1) ? eT(N-1) : eT(1) ) : eT(N); 00085 00086 const Row<eT> acc = sum(A); 00087 00088 out = trans(conj(A)) * A; 00089 out -= (trans(conj(acc)) * acc)/eT(N); 00090 out /= norm_val; 00091 } 00092 }
void op_cov::apply | ( | Mat< typename T1::elem_type > & | out, | |
const Op< T1, op_cov > & | in | |||
) | [inline, static, inherited] |
Definition at line 99 of file op_cov_meat.hpp.
References Op< T1, op_type >::aux_u32_a, direct_cov(), and Op< T1, op_type >::m.
00100 { 00101 arma_extra_debug_sigprint(); 00102 00103 typedef typename T1::elem_type eT; 00104 00105 const unwrap_check<T1> tmp(in.m, out); 00106 const Mat<eT>& A = tmp.M; 00107 00108 const u32 norm_type = in.aux_u32_a; 00109 00110 op_cov::direct_cov(out, A, norm_type); 00111 }