$search
00001 // Copyright (C) 2011 NICTA (www.nicta.com.au) 00002 // Copyright (C) 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 class arrayops 00019 { 00020 public: 00021 00022 template<typename eT> 00023 arma_hot arma_inline static void 00024 copy(eT* dest, const eT* src, const uword n_elem); 00025 00026 00027 template<typename eT> 00028 static inline void 00029 copy_big(eT* dest, const eT* src, const uword n_elem); 00030 00031 00032 // 00033 // array = convert(array) 00034 00035 template<typename out_eT, typename in_eT> 00036 arma_hot arma_inline static void 00037 convert_cx_scalar(out_eT& out, const in_eT& in, const typename arma_not_cx<out_eT>::result* junk1 = 0, const typename arma_not_cx< in_eT>::result* junk2 = 0); 00038 00039 template<typename out_eT, typename in_T> 00040 arma_hot arma_inline static void 00041 convert_cx_scalar(out_eT& out, const std::complex<in_T>& in, const typename arma_not_cx<out_eT>::result* junk = 0); 00042 00043 template<typename out_T, typename in_T> 00044 arma_hot arma_inline static void 00045 convert_cx_scalar(std::complex<out_T>& out, const std::complex< in_T>& in); 00046 00047 template<typename out_eT, typename in_eT> 00048 arma_hot inline static void 00049 convert(out_eT* dest, const in_eT* src, const uword n_elem); 00050 00051 template<typename out_eT, typename in_eT> 00052 arma_hot inline static void 00053 convert_cx(out_eT* dest, const in_eT* src, const uword n_elem); 00054 00055 00056 // 00057 // array op= array 00058 00059 template<typename eT> 00060 arma_hot inline static 00061 void 00062 inplace_plus(eT* dest, const eT* src, const uword n_elem); 00063 00064 template<typename eT> 00065 arma_hot inline static 00066 void 00067 inplace_minus(eT* dest, const eT* src, const uword n_elem); 00068 00069 template<typename eT> 00070 arma_hot inline static 00071 void 00072 inplace_mul(eT* dest, const eT* src, const uword n_elem); 00073 00074 template<typename eT> 00075 arma_hot inline static 00076 void 00077 inplace_div(eT* dest, const eT* src, const uword n_elem); 00078 00079 00080 // 00081 // array op= scalar 00082 00083 template<typename eT> 00084 arma_hot inline static 00085 void 00086 inplace_set(eT* dest, const eT val, const uword n_elem); 00087 00088 template<typename eT> 00089 arma_hot inline static 00090 void 00091 inplace_plus(eT* dest, const eT val, const uword n_elem); 00092 00093 template<typename eT> 00094 arma_hot inline static 00095 void 00096 inplace_minus(eT* dest, const eT val, const uword n_elem); 00097 00098 template<typename eT> 00099 arma_hot inline static void 00100 inplace_mul(eT* dest, const eT val, const uword n_elem); 00101 00102 template<typename eT> 00103 arma_hot inline static 00104 void 00105 inplace_div(eT* dest, const eT val, const uword n_elem); 00106 00107 00108 // 00109 // scalar = op(array) 00110 00111 template<typename eT> 00112 arma_hot arma_pure inline static 00113 eT 00114 accumulate(const eT* src, const uword n_elem); 00115 00116 template<typename eT> 00117 arma_hot arma_pure inline static 00118 eT 00119 product(const eT* src, const uword n_elem); 00120 00121 template<typename eT> 00122 arma_hot arma_pure inline static 00123 bool 00124 is_finite(const eT* src, const uword n_elem); 00125 00126 template<typename eT> 00127 arma_hot arma_pure inline static 00128 typename get_pod_type<eT>::result 00129 norm_1(const eT* src, const uword n_elem); 00130 00131 template<typename eT> 00132 arma_hot arma_pure inline static 00133 eT 00134 norm_2(const eT* src, const uword n_elem, const typename arma_not_cx<eT>::result* junk = 0); 00135 00136 template<typename T> 00137 arma_hot arma_pure inline static 00138 T 00139 norm_2(const std::complex<T>* src, const uword n_elem); 00140 00141 template<typename eT> 00142 arma_hot arma_pure inline static 00143 typename get_pod_type<eT>::result 00144 norm_k(const eT* src, const uword n_elem, const int k); 00145 00146 template<typename eT> 00147 arma_hot arma_pure inline static 00148 typename get_pod_type<eT>::result 00149 norm_max(const eT* src, const uword n_elem); 00150 00151 template<typename eT> 00152 arma_hot arma_pure inline static 00153 typename get_pod_type<eT>::result 00154 norm_min(const eT* src, const uword n_elem); 00155 00156 }; 00157 00158 00159