Op_flip

Classes

class  op_flipud
class  op_fliplr

Functions

template<typename T1 >
static void op_flipud::apply (Mat< typename T1::elem_type > &out, const Op< T1, op_flipud > &in)
template<typename T1 >
static void op_fliplr::apply (Mat< typename T1::elem_type > &out, const Op< T1, op_fliplr > &in)

Function Documentation

template<typename T1 >
void op_flipud::apply ( Mat< typename T1::elem_type > &  out,
const Op< T1, op_flipud > &  in 
) [inline, static, inherited]

Definition at line 25 of file op_flip_meat.hpp.

References Mat< eT >::copy_size(), unwrap< T1 >::M, Op< T1, op_type >::m, Mat< eT >::n_rows, Mat< eT >::row(), and Mat< eT >::swap_rows().

00026   {
00027   arma_extra_debug_sigprint();
00028   
00029   typedef typename T1::elem_type eT;
00030   
00031   const unwrap<T1>  tmp(in.m);
00032   const Mat<eT> X = tmp.M;
00033   
00034   if(&out != &X)
00035     {
00036     out.copy_size(X);
00037     
00038     for(u32 i=0; i<X.n_rows; ++i)
00039       {
00040       out.row(i) = X.row(X.n_rows-1 - i);
00041       }
00042     }
00043   else
00044     {
00045     const u32 N = X.n_rows / 2;
00046     
00047     for(u32 i=0; i<N; ++i)
00048       {
00049       out.swap_rows(i, X.n_rows-1 - i);
00050       }
00051     }
00052   }

template<typename T1 >
void op_fliplr::apply ( Mat< typename T1::elem_type > &  out,
const Op< T1, op_fliplr > &  in 
) [inline, static, inherited]

Definition at line 59 of file op_flip_meat.hpp.

References Mat< eT >::col(), Mat< eT >::copy_size(), unwrap< T1 >::M, Op< T1, op_type >::m, Mat< eT >::n_cols, and Mat< eT >::swap_cols().

00060   {
00061   arma_extra_debug_sigprint();
00062   
00063   typedef typename T1::elem_type eT;
00064   
00065   const unwrap<T1>  tmp(in.m);
00066   const Mat<eT> X = tmp.M;
00067   
00068   if(&out != &X)
00069     {
00070     out.copy_size(X);
00071     
00072     for(u32 i=0; i<X.n_cols; ++i)
00073       {
00074       out.col(i) = X.col(X.n_cols-1 - i);
00075       }
00076     }
00077   else
00078     {
00079     const u32 N = X.n_cols / 2;
00080     
00081     for(u32 i=0; i<N; ++i)
00082       {
00083       out.swap_cols(i, X.n_cols-1 - i);
00084       }
00085     }
00086   }