fn_trans.hpp

Go to the documentation of this file.
00001 // Copyright (C) 2009 NICTA
00002 // 
00003 // Authors:
00004 // - Conrad Sanderson (conradsand at ieee dot org)
00005 // 
00006 // This file is part of the Armadillo C++ library.
00007 // It is provided without any warranty of fitness
00008 // for any purpose. You can redistribute this file
00009 // and/or modify it under the terms of the GNU
00010 // Lesser General Public License (LGPL) as published
00011 // by the Free Software Foundation, either version 3
00012 // of the License or (at your option) any later version.
00013 // (see http://www.opensource.org/licenses for more info)
00014 
00015 
00016 //! \addtogroup fn_trans
00017 //! @{
00018 
00019 
00020 template<typename T1>
00021 inline
00022 const Op<T1, op_trans>
00023 trans(const Base<typename T1::elem_type,T1>& X)
00024   {
00025   arma_extra_debug_sigprint();
00026   
00027   return Op<T1, op_trans>(X.get_ref());
00028   }
00029 
00030 
00031 
00032 template<typename eT>
00033 inline
00034 const Op<Row<eT>, op_trans>
00035 trans(const Row<eT>& X)
00036   {
00037   arma_extra_debug_sigprint();
00038   
00039   return Op<Row<eT>, op_trans>(X);
00040   }
00041 
00042 
00043 
00044 template<typename eT>
00045 inline
00046 const Op<Col<eT>, op_trans>
00047 trans(const Col<eT>& X)
00048   {
00049   arma_extra_debug_sigprint();
00050   
00051   return Op<Col<eT>, op_trans>(X);
00052   }
00053 
00054 
00055 
00056 //! two consecutive transpose operations cancel each other
00057 template<typename T1>
00058 inline
00059 const T1&
00060 trans(const Op<T1, op_trans>& X)
00061   {
00062   arma_extra_debug_sigprint();
00063   arma_extra_debug_print("trans(): removing op_trans");
00064   
00065   return X.m;
00066   }
00067 
00068 
00069 
00070 //! transpose of a diagonal matrix gives you the original matrix back
00071 template<typename T1>
00072 inline
00073 const Op<T1, op_diagmat>
00074 trans(const Op<T1, op_diagmat>& X)
00075   {
00076   arma_extra_debug_sigprint();
00077   arma_extra_debug_print("trans(): not applying op_trans to diagonal matrix");
00078   
00079   return X;
00080   }
00081 
00082 
00083 
00084 //! the transpose of the conjugate of a complex matrix is equivalent to the hermitian transpose
00085 template<typename T1>
00086 inline
00087 const Op<T1, op_htrans>
00088 trans(const Op<T1, op_conj>& X)
00089   {
00090   arma_extra_debug_sigprint();
00091 
00092   arma_type_check< is_complex<typename T1::elem_type>::value == false >::apply();
00093 
00094   return Op<T1, op_htrans>(X.m);
00095   }
00096 
00097 
00098 
00099 //! @}