Ejemplo n.º 1
0
inline
const Col<eT>&
Col<eT>::fixed<fixed_n_elem>::operator=(const eOp<T1, eop_type>& X)
  {
  arma_extra_debug_sigprint();
  
  arma_type_check(( is_same_type< eT, typename T1::elem_type >::no ));
  
  const bool bad_alias = (eOp<T1, eop_type>::proxy_type::has_subview  &&  X.P.is_alias(*this));
  
  if(bad_alias == false)
    {
    arma_debug_assert_same_size(fixed_n_elem, uword(1), X.get_n_rows(), X.get_n_cols(), "Col::fixed::operator=");
    
    eop_type::apply(*this, X);
    }
  else
    {
    arma_extra_debug_print("bad_alias = true");
    
    Col<eT> tmp(X);
    
    (*this) = tmp;
    }
  
  return *this;
  }
arma_hot
inline
void
eop_core<eop_type>::apply(Mat<typename T1::elem_type>& out, const eOp<T1, eop_type>& x)
{
    arma_extra_debug_sigprint();

    typedef typename T1::elem_type eT;

    // NOTE: we're assuming that the matrix has already been set to the correct size and there is no aliasing;
    // size setting and alias checking is done by either the Mat contructor or operator=()

    const eT  k       = x.aux;
    eT* out_mem = out.memptr();

    if(Proxy<T1>::prefer_at_accessor == false)
    {
        // for fixed-sized vectors with n_elem >= 6, using x.get_n_elem() directly can cause a mis-optimisation (slowdown) of the loop under GCC 4.4
        const uword n_elem = (Proxy<T1>::is_fixed) ? ( (x.get_n_elem() <= 4) ? x.get_n_elem() : out.n_elem ) : out.n_elem;

        typename Proxy<T1>::ea_type P = x.P.get_ea();

        arma_applier_1(=);
    }
    else
    {
Ejemplo n.º 3
0
arma_hot
inline
void
eop_core<eop_type>::apply(Mat<typename T1::elem_type>& out, const eOp<T1, eop_type>& x)
  {
  arma_extra_debug_sigprint();
  
  typedef typename T1::elem_type eT;
  
  // NOTE: we're assuming that the matrix has already been set to the correct size and there is no aliasing;
  // size setting and alias checking is done by either the Mat contructor or operator=()
  
  const eT  k       = x.aux;
        eT* out_mem = out.memptr();
  
  if(Proxy<T1>::prefer_at_accessor == false)
    {
    const uword n_elem = (Proxy<T1>::is_fixed) ? x.get_n_elem() : out.n_elem;
    
    //if(memory::is_aligned(out_mem))
    if( memory::is_aligned(out_mem) && ((Proxy<T1>::is_fixed) ? (x.get_n_elem() >= 32) : true) )
      {
      memory::mark_as_aligned(out_mem);
      
      if(x.P.is_aligned())
        {
        typename Proxy<T1>::aligned_ea_type P = x.P.get_aligned_ea();
        
        arma_applier_1a(=);
        }
      else
        {
Ejemplo n.º 4
0
arma_hot
inline
void
eop_core<eop_type>::apply(outT& out, const eOp<T1, eop_type>& x)
  {
  arma_extra_debug_sigprint();
  
  typedef typename T1::elem_type eT;
  
  // NOTE: we're assuming that the matrix has already been set to the correct size and there is no aliasing;
  // size setting and alias checking is done by either the Mat contructor or operator=()
  
  const eT  k       = x.aux;
        eT* out_mem = out.memptr();
  
  const bool use_mp = (arma_config::cxx11 && arma_config::openmp) && (eOp<T1, eop_type>::use_mp || (is_same_type<eop_type, eop_pow>::value && (is_cx<eT>::yes || x.aux != eT(2))));
  
  if(Proxy<T1>::use_at == false)
    {
    const uword n_elem = x.get_n_elem();
    
    if(use_mp && mp_gate<eT>::eval(n_elem))
      {
      typename Proxy<T1>::ea_type P = x.P.get_ea();
      
      arma_applier_1_mp(=);
      }
    else
      {
      if(memory::is_aligned(out_mem))