op_flip_meat.hpp
Go to the documentation of this file.
00001 // Copyright (C) 2010 NICTA (www.nicta.com.au)
00002 // Copyright (C) 2010 Conrad Sanderson
00003 // 
00004 // This file is part of the Armadillo C++ library.
00005 // It is provided without any warranty of fitness
00006 // for any purpose. You can redistribute this file
00007 // and/or modify it under the terms of the GNU
00008 // Lesser General Public License (LGPL) as published
00009 // by the Free Software Foundation, either version 3
00010 // of the License or (at your option) any later version.
00011 // (see http://www.opensource.org/licenses for more info)
00012 
00013 
00016 
00017 
00018 
00019 template<typename T1>
00020 inline
00021 void
00022 op_flipud::apply(Mat<typename T1::elem_type>& out, const Op<T1,op_flipud>& in)
00023   {
00024   arma_extra_debug_sigprint();
00025   
00026   typedef typename T1::elem_type eT;
00027   
00028   const unwrap<T1>  tmp(in.m);
00029   const Mat<eT> X = tmp.M;
00030   
00031   if(&out != &X)
00032     {
00033     out.copy_size(X);
00034     
00035     for(uword i=0; i<X.n_rows; ++i)
00036       {
00037       out.row(i) = X.row(X.n_rows-1 - i);
00038       }
00039     }
00040   else
00041     {
00042     const uword N = X.n_rows / 2;
00043     
00044     for(uword i=0; i<N; ++i)
00045       {
00046       out.swap_rows(i, X.n_rows-1 - i);
00047       }
00048     }
00049   }
00050 
00051 
00052 
00053 template<typename T1>
00054 inline
00055 void
00056 op_fliplr::apply(Mat<typename T1::elem_type>& out, const Op<T1,op_fliplr>& in)
00057   {
00058   arma_extra_debug_sigprint();
00059   
00060   typedef typename T1::elem_type eT;
00061   
00062   const unwrap<T1>  tmp(in.m);
00063   const Mat<eT> X = tmp.M;
00064   
00065   if(&out != &X)
00066     {
00067     out.copy_size(X);
00068     
00069     for(uword i=0; i<X.n_cols; ++i)
00070       {
00071       out.col(i) = X.col(X.n_cols-1 - i);
00072       }
00073     }
00074   else
00075     {
00076     const uword N = X.n_cols / 2;
00077     
00078     for(uword i=0; i<N; ++i)
00079       {
00080       out.swap_cols(i, X.n_cols-1 - i);
00081       }
00082     }
00083   }
00084 
00085 
00086 


armadillo_matrix
Author(s): Conrad Sanderson - NICTA (www.nicta.com.au), (Wrapper by Sjoerd van den Dries)
autogenerated on Tue Jan 7 2014 11:42:05