Classes | Functions

Podarray

//! More...

Classes

class  podarray< eT >
 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 podarray::podarray (const eT *X, const u32 new_N)
arma_inline eT podarray::operator[] (const u32 i) const
arma_inline eT & podarray::operator[] (const u32 i)
arma_inline eT podarray::operator() (const u32 i) const
arma_inline eT & podarray::operator() (const u32 i)
void podarray::set_size (const u32 new_n_elem)
void podarray::fill (const eT val)
void podarray::zeros ()
void podarray::zeros (const u32 new_n_elem)
arma_inline eT * podarray::memptr ()
arma_inline const eT * podarray::memptr () const
void podarray::init (const u32 new_n_elem)

Detailed Description

//!


Function Documentation

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

Definition at line 23 of file podarray_meat.hpp.

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

  {
  arma_extra_debug_sigprint_this(this);
  
  if(n_elem > sizeof(mem_local)/sizeof(eT) )
    {
    delete [] mem;
    }
  
  if(arma_config::debug == true)
    {
    access::rw(n_elem) = 0;
    access::rw(mem)    = 0;
    }
  }

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

Definition at line 43 of file podarray_meat.hpp.

  : n_elem(0)
  , mem   (0)
  {
  arma_extra_debug_sigprint_this(this);
  }

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

Definition at line 54 of file podarray_meat.hpp.

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

  : n_elem(0)
  , mem   (0)
  {
  arma_extra_debug_sigprint();
  
  this->operator=(x);
  }

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

Definition at line 68 of file podarray_meat.hpp.

References syslib::copy_elem(), podarray< eT >::init(), podarray< eT >::memptr(), and podarray< eT >::n_elem.

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

  {
  arma_extra_debug_sigprint();
  
  if(this != &x)
    {
    init(x.n_elem);
    
    syslib::copy_elem( memptr(), x.memptr(), n_elem );
    }
  
  return *this;
  }

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

Definition at line 86 of file podarray_meat.hpp.

References podarray< eT >::init().

  : n_elem(0)
  , mem   (0)
  {
  arma_extra_debug_sigprint_this(this);
  
  init(new_n_elem);
  }

template<typename eT >
arma_inline podarray< eT >::podarray ( const eT *  X,
const u32  new_N 
) [explicit, inherited]

Definition at line 99 of file podarray_meat.hpp.

References syslib::copy_elem(), podarray< eT >::init(), and podarray< eT >::memptr().

  : n_elem(0)
  , mem   (0)
  {
  arma_extra_debug_sigprint_this(this);
  
  init(new_n_elem);
  
  syslib::copy_elem( memptr(), X, new_n_elem );
  }

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

Definition at line 115 of file podarray_meat.hpp.

References podarray< eT >::mem.

  {
  return mem[i];
  }

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

Definition at line 125 of file podarray_meat.hpp.

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

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

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

Definition at line 135 of file podarray_meat.hpp.

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

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

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

Definition at line 146 of file podarray_meat.hpp.

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

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

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

Definition at line 157 of file podarray_meat.hpp.

References podarray< eT >::init().

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

  {
  arma_extra_debug_sigprint();
  
  init(new_n_elem);
  }

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

Definition at line 169 of file podarray_meat.hpp.

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

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

  {
  arma_extra_debug_sigprint();
  
  for(u32 i=0; i<n_elem; ++i)
    {
    access::rw(mem[i]) = val;
    }
  }

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

Definition at line 184 of file podarray_meat.hpp.

References podarray< eT >::fill().

  {
  arma_extra_debug_sigprint();
  
  fill(eT(0));
  }

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

Definition at line 196 of file podarray_meat.hpp.

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

  {
  arma_extra_debug_sigprint();
  
  init(new_n_elem);
  fill(0);
  }

template<typename eT >
arma_inline eT * podarray< eT >::memptr (  )  [inherited]
template<typename eT >
arma_inline const eT * podarray< eT >::memptr (  )  const [inherited]

Definition at line 219 of file podarray_meat.hpp.

References podarray< eT >::mem.

  {
  return mem;
  }

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

Definition at line 229 of file podarray_meat.hpp.

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

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

  {
  arma_extra_debug_sigprint();
  
  if(n_elem == new_n_elem)
    {
    return;
    }
    
  if(n_elem > sizeof(mem_local)/sizeof(eT) )
    {
    delete [] mem;
    }
  
  if(new_n_elem <= sizeof(mem_local)/sizeof(eT) )
    {
    access::rw(mem) = mem_local;
    }
  else
    {
    access::rw(mem) = new eT[new_n_elem];
    }
  
  access::rw(n_elem) = new_n_elem;
  }