Static Public Member Functions

syslib Class Reference
[Syslib]

#include <syslib_proto.hpp>

List of all members.

Static Public Member Functions

template<typename eT >
static arma_hot void copy_elem (eT *dest, const eT *src, const u32 n_elem)
template<typename out_eT , typename in_eT >
static arma_hot void copy_and_convert_elem (out_eT *dest, const in_eT *src, const u32 n_elem)
template<typename out_eT , typename in_eT >
arma_hot static arma_inline void convert_cx_scalar (out_eT &out, const in_eT &in)
template<typename out_eT , typename in_T >
arma_hot static arma_inline void convert_cx_scalar (out_eT &out, const std::complex< in_T > &in)
template<typename out_T , typename in_T >
arma_hot static arma_inline void convert_cx_scalar (std::complex< out_T > &out, const std::complex< in_T > &in)
template<typename out_eT , typename in_eT >
static arma_hot void copy_and_convert_cx_elem (out_eT *dest, const in_eT *src, const u32 n_elem)

Detailed Description

Definition at line 21 of file syslib_proto.hpp.


Member Function Documentation

template<typename eT >
static arma_hot void syslib::copy_elem ( eT *  dest,
const eT *  src,
const u32  n_elem 
) [inline, static]

Definition at line 30 of file syslib_proto.hpp.

Referenced by op_reshape::apply(), op_trans::apply_noalias(), Cube< eT >::Cube(), subview< eT >::extract(), Mat< eT >::init(), Cube< eT >::init(), Mat< eT >::Mat(), subview< eT >::operator=(), podarray< eT >::operator=(), subview< eT >::operator_equ_mat(), podarray< eT >::podarray(), auxlib::solve_od(), and auxlib::solve_ud().

    {
    #if !defined(__OPTIMIZE__)
      {
      std::memcpy(dest, src, n_elem*sizeof(eT));
      }
    #else
      {
      switch(n_elem)
        {
        case 0:
          break;
        
        case 1:
          *dest = *src;
          break;
          
        case 2:
          dest[0] = src[0];
          dest[1] = src[1];
          break;
        
        case 3:
          dest[0] = src[0];
          dest[1] = src[1];
          dest[2] = src[2];
          break;
        
        case 4:
          dest[0] = src[0];
          dest[1] = src[1];
          dest[2] = src[2];
          dest[3] = src[3];
          break;
        
        default:
          if( n_elem <= (128/sizeof(eT)) )
            {
            u32 i,j;
            
            for(i=0, j=1; j<n_elem; i+=2, j+=2)
              {
              dest[i] = src[i];
              dest[j] = src[j];
              }
            
            if(i < n_elem)
              {
              dest[i] = src[i];
              }
            }
          else
            {
            std::memcpy(dest, src, n_elem*sizeof(eT));
            }
        }
      }
    #endif
    }

template<typename out_eT , typename in_eT >
static arma_hot void syslib::copy_and_convert_elem ( out_eT *  dest,
const in_eT *  src,
const u32  n_elem 
) [inline, static]

Definition at line 97 of file syslib_proto.hpp.

Referenced by conv_to< itpp::Vec< out_eT > >::from(), conv_to< itpp::Mat< out_eT > >::from(), conv_to< Cube< out_eT > >::from(), conv_to< Col< out_eT > >::from(), conv_to< Row< out_eT > >::from(), and conv_to< Mat< out_eT > >::from().

    {
    u32 i,j;
    
    for(i=0, j=1; j<n_elem; i+=2, j+=2)
      {
      dest[i] = out_eT( src[i] );
      dest[j] = out_eT( src[j] );
      }
    
    if(i < n_elem)
      {
      dest[i] = out_eT( src[i] );
      }
    }

template<typename out_eT , typename in_eT >
arma_hot static arma_inline void syslib::convert_cx_scalar ( out_eT &  out,
const in_eT &  in 
) [inline, static]
template<typename out_eT , typename in_T >
arma_hot static arma_inline void syslib::convert_cx_scalar ( out_eT &  out,
const std::complex< in_T > &  in 
) [inline, static]

Definition at line 136 of file syslib_proto.hpp.

    {
    out = out_eT( in.real() );
    }

template<typename out_T , typename in_T >
arma_hot static arma_inline void syslib::convert_cx_scalar ( std::complex< out_T > &  out,
const std::complex< in_T > &  in 
) [inline, static]

Definition at line 148 of file syslib_proto.hpp.

    {
    typedef std::complex<out_T> out_eT;
    
    out = out_eT(in);
    }

template<typename out_eT , typename in_eT >
static arma_hot void syslib::copy_and_convert_cx_elem ( out_eT *  dest,
const in_eT *  src,
const u32  n_elem 
) [inline, static]

Definition at line 162 of file syslib_proto.hpp.

References convert_cx_scalar().

Referenced by conv_to< itpp::Vec< out_eT > >::from(), conv_to< itpp::Mat< out_eT > >::from(), conv_to< Cube< out_eT > >::from(), conv_to< Col< out_eT > >::from(), conv_to< Row< out_eT > >::from(), and conv_to< Mat< out_eT > >::from().

    {
    u32 i,j;
    
    for(i=0, j=1; j<n_elem; i+=2, j+=2)
      {
      convert_cx_scalar( dest[i], src[i] );
      convert_cx_scalar( dest[j], src[j] );
      }
    
    if(i < n_elem)
      {
      convert_cx_scalar( dest[i], src[i] );
      }
    }