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