fn_sum.hpp
Go to the documentation of this file.
00001 // Copyright (C) 2008-2010 NICTA (www.nicta.com.au)
00002 // Copyright (C) 2008-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 
00025 
00026 template<typename T1>
00027 arma_inline
00028 const Op<T1, op_sum>
00029 sum(const Base<typename T1::elem_type,T1>& X, const uword dim = 0)
00030   {
00031   arma_extra_debug_sigprint();
00032   
00033   return Op<T1, op_sum>(X.get_ref(), dim, 0);
00034   }
00035 
00036 
00039 template<typename eT>
00040 inline
00041 arma_warn_unused
00042 eT
00043 sum(const Row<eT>& X)
00044   {
00045   arma_extra_debug_sigprint();
00046   
00047   return accu(X);
00048   }
00049 
00050 
00051 
00054 template<typename eT>
00055 inline
00056 arma_warn_unused
00057 eT
00058 sum(const Col<eT>& X)
00059   {
00060   arma_extra_debug_sigprint();
00061   
00062   return accu(X);
00063   }
00064 
00065 
00066 
00070 
00071 template<typename T1>
00072 inline
00073 arma_warn_unused
00074 typename T1::elem_type
00075 sum(const Op<T1, op_sum>& in)
00076   {
00077   arma_extra_debug_sigprint();
00078   arma_extra_debug_print("sum(): two consecutive sum() calls detected");
00079   
00080   return accu(in.m);
00081   }
00082 
00083 
00084 
00085 template<typename T1>
00086 arma_inline
00087 const Op<Op<T1, op_sum>, op_sum>
00088 sum(const Op<T1, op_sum>& in, const uword dim)
00089   {
00090   arma_extra_debug_sigprint();
00091   
00092   return Op<Op<T1, op_sum>, op_sum>(in, dim, 0);
00093   }
00094 
00095 
00096 
00098 template<typename eT>
00099 inline
00100 arma_warn_unused
00101 eT
00102 sum(const subview_row<eT>& X)
00103   {
00104   arma_extra_debug_sigprint();
00105   
00106   return accu(X);
00107   }
00108 
00109 
00110 
00112 template<typename eT>
00113 inline
00114 arma_warn_unused
00115 eT
00116 sum(const subview_col<eT>& X)
00117   {
00118   arma_extra_debug_sigprint();
00119   
00120   return accu(X);
00121   }
00122 
00123 
00124 
00126 template<typename eT>
00127 inline
00128 arma_warn_unused
00129 eT
00130 sum(const diagview<eT>& X)
00131   {
00132   arma_extra_debug_sigprint();
00133   
00134   return accu(X);
00135   }
00136 
00137 
00138 
00139 template<typename eT, typename T1>
00140 inline
00141 arma_warn_unused
00142 eT
00143 sum(const subview_elem1<eT,T1>& A)
00144   {
00145   arma_extra_debug_sigprint();
00146   
00147   return accu(A);
00148   }
00149 
00150 
00151 


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:04