fn_var.hpp
Go to the documentation of this file.
00001 // Copyright (C) 2009-2011 NICTA (www.nicta.com.au)
00002 // Copyright (C) 2009-2011 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 const mtOp<typename T1::pod_type, T1, op_var>
00022 var(const Base<typename T1::elem_type,T1>& X, const uword norm_type = 0, const uword dim = 0)
00023   {
00024   arma_extra_debug_sigprint();
00025   
00026   return mtOp<typename T1::pod_type, T1, op_var>(X.get_ref(), norm_type, dim);
00027   }
00028 
00029 
00030 
00032 template<typename eT>
00033 inline
00034 arma_warn_unused
00035 typename get_pod_type<eT>::result
00036 var(const Row<eT>& A, const uword norm_type = 0)
00037   {
00038   arma_extra_debug_sigprint();
00039   
00040   const uword A_n_elem = A.n_elem;
00041   
00042   arma_debug_check( (A_n_elem == 0), "var(): given object has no elements" );
00043   
00044   return op_var::direct_var(A.mem, A_n_elem, norm_type);
00045   }
00046 
00047 
00048 
00050 template<typename eT>
00051 inline
00052 arma_warn_unused
00053 typename get_pod_type<eT>::result
00054 var(const Col<eT>& A, const uword norm_type = 0)
00055   {
00056   arma_extra_debug_sigprint();
00057   
00058   const uword A_n_elem = A.n_elem;
00059   
00060   arma_debug_check( (A_n_elem == 0), "var(): given object has no elements" );
00061   
00062   return op_var::direct_var(A.mem, A_n_elem, norm_type);
00063   }
00064 
00065 
00066 
00067 template<typename eT>
00068 inline
00069 arma_warn_unused
00070 typename get_pod_type<eT>::result
00071 var(const subview_row<eT>& A, const uword norm_type = 0)
00072   {
00073   arma_extra_debug_sigprint();
00074   
00075   arma_debug_check( (A.n_elem == 0), "var(): given object has no elements" );
00076   
00077   return op_var::direct_var(A, norm_type);
00078   }
00079 
00080 
00081 
00082 template<typename eT>
00083 inline
00084 arma_warn_unused
00085 typename get_pod_type<eT>::result
00086 var(const subview_col<eT>& A, const uword norm_type = 0)
00087   {
00088   arma_extra_debug_sigprint();
00089   
00090   arma_debug_check( (A.n_elem == 0), "var(): given object has no elements" );
00091   
00092   return op_var::direct_var(A.colptr(0), A.n_rows, norm_type);
00093   }
00094 
00095 
00096 
00097 template<typename eT>
00098 inline
00099 arma_warn_unused
00100 typename get_pod_type<eT>::result
00101 var(const diagview<eT>& A, const uword norm_type = 0)
00102   {
00103   arma_extra_debug_sigprint();
00104   
00105   arma_debug_check( (A.n_elem == 0), "var(): given object has no elements" );
00106   
00107   return op_var::direct_var(A, norm_type);
00108   }
00109 
00110 
00111 
00112 template<typename eT, typename T1>
00113 inline
00114 arma_warn_unused
00115 typename get_pod_type<eT>::result
00116 var(const subview_elem1<eT,T1>& A, const uword norm_type = 0)
00117   {
00118   arma_extra_debug_sigprint();
00119   
00120   const Col<eT> X(A);
00121   
00122   return var(X, norm_type);
00123   }
00124 
00125 
00126 


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