$search
00001 // Copyright (C) 2008-2011 NICTA (www.nicta.com.au) 00002 // Copyright (C) 2008-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 00024 00025 template<typename T1> 00026 arma_inline 00027 const Op<T1, op_max> 00028 max(const Base<typename T1::elem_type,T1>& X, const uword dim = 0) 00029 { 00030 arma_extra_debug_sigprint(); 00031 00032 return Op<T1, op_max>(X.get_ref(), dim, 0); 00033 } 00034 00035 00037 template<typename eT> 00038 inline 00039 arma_warn_unused 00040 eT 00041 max(const Row<eT>& A) 00042 { 00043 arma_extra_debug_sigprint(); 00044 00045 const uword A_n_elem = A.n_elem; 00046 00047 arma_debug_check( (A_n_elem == 0), "max(): given object has no elements" ); 00048 00049 return op_max::direct_max(A.mem, A_n_elem); 00050 } 00051 00052 00053 00055 template<typename eT> 00056 inline 00057 arma_warn_unused 00058 eT 00059 max(const Col<eT>& A) 00060 { 00061 arma_extra_debug_sigprint(); 00062 00063 const uword A_n_elem = A.n_elem; 00064 00065 arma_debug_check( (A_n_elem == 0), "max(): given object has no elements" ); 00066 00067 return op_max::direct_max(A.mem, A_n_elem); 00068 } 00069 00070 00071 00075 template<typename T1> 00076 inline 00077 arma_warn_unused 00078 typename T1::elem_type 00079 max(const Op<T1, op_max>& in) 00080 { 00081 arma_extra_debug_sigprint(); 00082 arma_extra_debug_print("max(): two consecutive max() calls detected"); 00083 00084 typedef typename T1::elem_type eT; 00085 00086 const unwrap<T1> tmp1(in.m); 00087 const Mat<eT>& X = tmp1.M; 00088 00089 const uword X_n_elem = X.n_elem; 00090 00091 arma_debug_check( (X_n_elem == 0), "max(): given object has no elements" ); 00092 00093 return op_max::direct_max(X.mem, X_n_elem); 00094 } 00095 00096 00097 00098 template<typename T1> 00099 arma_inline 00100 const Op< Op<T1, op_max>, op_max> 00101 max(const Op<T1, op_max>& in, const uword dim) 00102 { 00103 arma_extra_debug_sigprint(); 00104 00105 return Op< Op<T1, op_max>, op_max>(in, dim, 0); 00106 } 00107 00108 00109 00110 template<typename eT> 00111 inline 00112 arma_warn_unused 00113 eT 00114 max(const subview_row<eT>& A) 00115 { 00116 arma_extra_debug_sigprint(); 00117 00118 arma_debug_check( (A.n_elem == 0), "max(): given object has no elements" ); 00119 00120 return op_max::direct_max(A); 00121 } 00122 00123 00124 00125 template<typename eT> 00126 inline 00127 arma_warn_unused 00128 eT 00129 max(const subview_col<eT>& A) 00130 { 00131 arma_extra_debug_sigprint(); 00132 00133 arma_debug_check( (A.n_elem == 0), "max(): given object has no elements" ); 00134 00135 return op_max::direct_max(A.colptr(0), A.n_rows); 00136 } 00137 00138 00139 00140 template<typename eT> 00141 inline 00142 arma_warn_unused 00143 eT 00144 max(const Op<subview<eT>, op_max>& in) 00145 { 00146 arma_extra_debug_sigprint(); 00147 arma_extra_debug_print("max(): two consecutive max() calls detected"); 00148 00149 const subview<eT>& X = in.m; 00150 00151 arma_debug_check( (X.n_elem == 0), "max(): given object has no elements" ); 00152 00153 return op_max::direct_max(X); 00154 } 00155 00156 00157 00158 template<typename eT> 00159 inline 00160 arma_warn_unused 00161 eT 00162 max(const diagview<eT>& A) 00163 { 00164 arma_extra_debug_sigprint(); 00165 00166 arma_debug_check( (A.n_elem == 0), "max(): given object has no elements" ); 00167 00168 return op_max::direct_max(A); 00169 } 00170 00171 00172 00173 template<typename eT, typename T1> 00174 inline 00175 arma_warn_unused 00176 eT 00177 max(const subview_elem1<eT,T1>& A) 00178 { 00179 arma_extra_debug_sigprint(); 00180 00181 const Mat<eT> X(A); 00182 00183 const uword X_n_elem = X.n_elem; 00184 00185 arma_debug_check( (X_n_elem == 0), "max(): given object has no elements" ); 00186 00187 return op_max::direct_max(X.mem, X_n_elem); 00188 } 00189 00190 00191