Classes | Functions

Op_flip

//! More...

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)

Detailed Description

//!


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().

  {
  arma_extra_debug_sigprint();
  
  typedef typename T1::elem_type eT;
  
  const unwrap<T1>  tmp(in.m);
  const Mat<eT> X = tmp.M;
  
  if(&out != &X)
    {
    out.copy_size(X);
    
    for(u32 i=0; i<X.n_rows; ++i)
      {
      out.row(i) = X.row(X.n_rows-1 - i);
      }
    }
  else
    {
    const u32 N = X.n_rows / 2;
    
    for(u32 i=0; i<N; ++i)
      {
      out.swap_rows(i, X.n_rows-1 - i);
      }
    }
  }

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().

  {
  arma_extra_debug_sigprint();
  
  typedef typename T1::elem_type eT;
  
  const unwrap<T1>  tmp(in.m);
  const Mat<eT> X = tmp.M;
  
  if(&out != &X)
    {
    out.copy_size(X);
    
    for(u32 i=0; i<X.n_cols; ++i)
      {
      out.col(i) = X.col(X.n_cols-1 - i);
      }
    }
  else
    {
    const u32 N = X.n_cols / 2;
    
    for(u32 i=0; i<N; ++i)
      {
      out.swap_cols(i, X.n_cols-1 - i);
      }
    }
  }