//! More...
Classes | |
class | op_trans |
'matrix transpose' operation More... | |
class | op_trans2 |
Functions | |
template<typename eT > | |
static void | op_trans::apply_noalias (Mat< eT > &out, const Mat< eT > &A) |
Immediate transpose of a dense matrix. | |
template<typename eT > | |
static void | op_trans::apply (Mat< eT > &out, const Mat< eT > &A) |
template<typename T1 > | |
static void | op_trans::apply (Mat< typename T1::elem_type > &out, const Op< T1, op_trans > &in) |
template<typename T1 > | |
static void | op_trans2::apply (Mat< typename T1::elem_type > &out, const Op< T1, op_trans2 > &in) |
//!
void op_trans::apply_noalias | ( | Mat< eT > & | out, | |
const Mat< eT > & | A | |||
) | [inline, static, inherited] |
Immediate transpose of a dense matrix.
Definition at line 26 of file op_trans_meat.hpp.
References Mat< eT >::at(), syslib::copy_elem(), Mat< eT >::mem, Mat< eT >::memptr(), Mat< eT >::n_cols, Mat< eT >::n_elem, Mat< eT >::n_rows, and Mat< eT >::set_size().
Referenced by apply(), Mat< eT >::print_trans(), and Mat< eT >::raw_print_trans().
{ arma_extra_debug_sigprint(); const u32 A_n_cols = A.n_cols; const u32 A_n_rows = A.n_rows; out.set_size(A_n_cols, A_n_rows); if( (A_n_cols == 1) || (A_n_rows == 1) ) { syslib::copy_elem( out.memptr(), A.mem, A.n_elem ); } else { for(u32 in_row = 0; in_row<A_n_rows; ++in_row) { const u32 out_col = in_row; for(u32 in_col = 0; in_col<A_n_cols; ++in_col) { const u32 out_row = in_col; out.at(out_row, out_col) = A.at(in_row, in_col); } } } }
void op_trans::apply | ( | Mat< eT > & | out, | |
const Mat< eT > & | A | |||
) | [inline, static, inherited] |
Definition at line 60 of file op_trans_meat.hpp.
References apply_noalias(), Mat< eT >::at(), Mat< eT >::colptr(), Mat< eT >::n_cols, and Mat< eT >::n_rows.
Referenced by apply(), and auxlib::svd().
{ arma_extra_debug_sigprint(); if(&out != &A) { op_trans::apply_noalias(out, A); } else { if(out.n_rows == out.n_cols) { arma_extra_debug_print("op_trans::apply(): doing in-place transpose of a square matrix"); const u32 n_rows = out.n_rows; const u32 n_cols = out.n_cols; for(u32 col=0; col<n_cols; ++col) { eT* coldata = out.colptr(col); for(u32 row=(col+1); row<n_rows; ++row) { std::swap( out.at(col,row), coldata[row] ); } } } else { const Mat<eT> A_copy = A; op_trans::apply_noalias(out, A_copy); } } }
void op_trans::apply | ( | Mat< typename T1::elem_type > & | out, | |
const Op< T1, op_trans > & | in | |||
) | [inline, static, inherited] |
Definition at line 100 of file op_trans_meat.hpp.
References apply(), unwrap< T1 >::M, and Op< T1, op_type >::m.
{ arma_extra_debug_sigprint(); typedef typename T1::elem_type eT; const unwrap<T1> tmp(in.m); const Mat<eT>& A = tmp.M; op_trans::apply(out, A); }
void op_trans2::apply | ( | Mat< typename T1::elem_type > & | out, | |
const Op< T1, op_trans2 > & | in | |||
) | [inline, static, inherited] |
Definition at line 161 of file op_trans_meat.hpp.
References Op< T1, op_type >::aux, unwrap< T1 >::M, Op< T1, op_type >::m, Mat< eT >::memptr(), and Mat< eT >::n_elem.
{ arma_extra_debug_sigprint(); typedef typename T1::elem_type eT; const unwrap<T1> tmp(in.m); op_trans::apply(out, tmp.M); eT* out_mem = out.memptr(); const u32 n_elem = out.n_elem; const eT k = in.aux; for(u32 i=0; i<n_elem; ++i) { out_mem[i] *= k; } }