Podarray


Classes

class  podarray< T1 >
 A lightweight array for POD types. If the amount of memory requested is small, the stack is used. More...

Functions

 podarray::~podarray ()
 podarray::podarray ()
 podarray::podarray (const podarray &x)
const podarraypodarray::operator= (const podarray &x)
arma_inline podarray::podarray (const u32 new_N)
arma_inline T1 podarray::operator[] (const u32 i) const
arma_inline T1 & podarray::operator[] (const u32 i)
arma_inline T1 podarray::operator() (const u32 i) const
arma_inline T1 & podarray::operator() (const u32 i)
void podarray::set_size (const u32 new_n_elem)
void podarray::fill (const T1 val)
void podarray::zeros ()
void podarray::zeros (const u32 new_n_elem)
arma_inline T1 * podarray::memptr ()
arma_inline const T1 * podarray::memptr () const
void podarray::init (const u32 new_n_elem)

Function Documentation

template<typename T1 >
podarray< T1 >::~podarray (  )  [inline, inherited]

Definition at line 22 of file podarray_meat.hpp.

References arma_config::debug, podarray< T1 >::mem, podarray< T1 >::mem_local, podarray< T1 >::n_elem, and access::rw().

00023   {
00024   arma_extra_debug_sigprint_this(this);
00025   
00026   if(n_elem > sizeof(mem_local)/sizeof(T1) )
00027     {
00028     delete [] mem;
00029     }
00030 
00031   if(arma_config::debug == true)
00032     {
00033     access::rw(mem) = 0;
00034     }
00035   }

template<typename T1 >
podarray< T1 >::podarray (  )  [inline, inherited]

Definition at line 41 of file podarray_meat.hpp.

00042   : n_elem(0)
00043   , mem(0)
00044   {
00045   arma_extra_debug_sigprint_this(this);
00046   }

template<typename T1 >
podarray< T1 >::podarray ( const podarray< T1 > &  x  )  [inline, inherited]

Definition at line 52 of file podarray_meat.hpp.

References podarray< T1 >::operator=().

00053   : n_elem(0)
00054   , mem(0)
00055   {
00056   arma_extra_debug_sigprint();
00057   
00058   this->operator=(x);
00059   }

template<typename T1 >
const podarray< T1 > & podarray< T1 >::operator= ( const podarray< T1 > &  x  )  [inline, inherited]

Definition at line 66 of file podarray_meat.hpp.

References podarray< T1 >::init(), podarray< T1 >::mem, podarray< T1 >::n_elem, and access::rw().

Referenced by podarray< T1 >::podarray().

00067   {
00068   arma_extra_debug_sigprint();
00069   
00070   if(this != &x)
00071     {
00072     init(x.n_elem);
00073     
00074     for(u32 i=0; i<n_elem; ++i)
00075       {
00076       access::rw(mem[i]) = x.mem[i];
00077       }
00078     }
00079         
00080   return *this;
00081   }

template<typename T1 >
arma_inline podarray< T1 >::podarray ( const u32  new_N  )  [inline, explicit, inherited]

Definition at line 87 of file podarray_meat.hpp.

References podarray< T1 >::init().

00088   : n_elem(0)
00089   , mem(0)
00090   {
00091   arma_extra_debug_sigprint_this(this);
00092   
00093   init(new_n_elem);
00094   }

template<typename T1 >
arma_inline T1 podarray< T1 >::operator[] ( const u32  i  )  const [inline, inherited]

Definition at line 100 of file podarray_meat.hpp.

References podarray< T1 >::mem.

00101   {
00102   return mem[i];
00103   }

template<typename T1 >
arma_inline T1 & podarray< T1 >::operator[] ( const u32  i  )  [inline, inherited]

Definition at line 110 of file podarray_meat.hpp.

References podarray< T1 >::mem, and access::rw().

00111   {
00112   return access::rw(mem[i]);
00113   }

template<typename T1 >
arma_inline T1 podarray< T1 >::operator() ( const u32  i  )  const [inline, inherited]

Definition at line 120 of file podarray_meat.hpp.

References podarray< T1 >::mem, and podarray< T1 >::n_elem.

00121   {
00122   arma_debug_check( (i >= n_elem), "podarray::operator(): index out of bounds");
00123   return mem[i];
00124   }

template<typename T1 >
arma_inline T1 & podarray< T1 >::operator() ( const u32  i  )  [inline, inherited]

Definition at line 131 of file podarray_meat.hpp.

References podarray< T1 >::mem, podarray< T1 >::n_elem, and access::rw().

00132   {
00133   arma_debug_check( (i >= n_elem), "podarray::operator(): index out of bounds");
00134   return access::rw(mem[i]);
00135   }

template<typename T1 >
void podarray< T1 >::set_size ( const u32  new_n_elem  )  [inline, inherited]

Definition at line 142 of file podarray_meat.hpp.

References podarray< T1 >::init().

Referenced by auxlib::inv_inplace(), auxlib::inv_noalias(), auxlib::lu(), auxlib::qr(), and auxlib::svd().

00143   {
00144   arma_extra_debug_sigprint();
00145   
00146   init(new_n_elem);
00147   }

template<typename T1 >
void podarray< T1 >::fill ( const T1  val  )  [inline, inherited]

Definition at line 154 of file podarray_meat.hpp.

References podarray< T1 >::mem, podarray< T1 >::n_elem, and access::rw().

Referenced by podarray< T1 >::zeros().

00155   {
00156   arma_extra_debug_sigprint();
00157   
00158   for(u32 i=0; i<n_elem; ++i)
00159     {
00160     access::rw(mem[i]) = val;
00161     }
00162   }

template<typename T1 >
void podarray< T1 >::zeros (  )  [inline, inherited]

Definition at line 169 of file podarray_meat.hpp.

References podarray< T1 >::fill().

00170   {
00171   arma_extra_debug_sigprint();
00172   
00173   fill(0);
00174   }

template<typename T1 >
void podarray< T1 >::zeros ( const u32  new_n_elem  )  [inline, inherited]

Definition at line 181 of file podarray_meat.hpp.

References podarray< T1 >::fill(), and podarray< T1 >::init().

00182   {
00183   arma_extra_debug_sigprint();
00184   
00185   init(new_n_elem);
00186   fill(0);
00187   }

template<typename T1 >
arma_inline T1 * podarray< T1 >::memptr (  )  [inline, inherited]

template<typename T1 >
arma_inline const T1 * podarray< T1 >::memptr (  )  const [inline, inherited]

Definition at line 204 of file podarray_meat.hpp.

References podarray< T1 >::mem.

00205   {
00206   return mem;
00207   }

template<typename T1 >
void podarray< T1 >::init ( const u32  new_n_elem  )  [inline, protected, inherited]

Definition at line 214 of file podarray_meat.hpp.

References podarray< T1 >::mem, podarray< T1 >::mem_local, podarray< T1 >::n_elem, and access::rw().

Referenced by podarray< T1 >::operator=(), podarray< T1 >::podarray(), podarray< T1 >::set_size(), and podarray< T1 >::zeros().

00215   {
00216   arma_extra_debug_sigprint();
00217   
00218   if(n_elem == new_n_elem)
00219     {
00220     return;
00221     }
00222     
00223   if(n_elem > sizeof(mem_local)/sizeof(T1) )
00224     {
00225     delete [] mem;
00226     }
00227   
00228   if(new_n_elem <= sizeof(mem_local)/sizeof(T1) )
00229     {
00230     access::rw(mem) = mem_local;
00231     }
00232   else
00233     {
00234     access::rw(mem) = new T1[new_n_elem];
00235     }
00236   
00237   access::rw(n_elem) = new_n_elem;
00238   
00239   
00240   }