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 00018 00019 struct podarray_prealloc_n_elem 00020 { 00021 static const uword val = 16; 00022 }; 00023 00024 00025 00027 00028 template<typename eT> 00029 class podarray 00030 { 00031 public: 00032 00033 arma_aligned const uword n_elem; 00034 arma_aligned const eT* const mem; 00035 00036 00037 protected: 00039 arma_aligned eT mem_local[ podarray_prealloc_n_elem::val ]; 00040 00041 00042 public: 00043 00044 inline ~podarray(); 00045 inline podarray(); 00046 00047 inline podarray (const podarray& x); 00048 inline const podarray& operator=(const podarray& x); 00049 00050 arma_inline explicit podarray(const uword new_N); 00051 00052 arma_inline explicit podarray(const eT* X, const uword new_N); 00053 00054 arma_inline eT& operator[] (const uword i); 00055 arma_inline eT operator[] (const uword i) const; 00056 00057 arma_inline eT& operator() (const uword i); 00058 arma_inline eT operator() (const uword i) const; 00059 00060 inline void set_size(const uword new_n_elem); 00061 inline void reset(); 00062 00063 inline void fill(const eT val); 00064 00065 inline void zeros(); 00066 inline void zeros(const uword new_n_elem); 00067 00068 arma_inline eT* memptr(); 00069 arma_inline const eT* memptr() const; 00070 00071 arma_hot inline void copy_row(const Mat<eT>& A, const uword row); 00072 00073 protected: 00074 00075 inline void init(const uword new_n_elem); 00076 00077 }; 00078 00079 00080