Classes | Functions

Op_repmat

//! More...

Classes

class  op_repmat

Functions

template<typename T1 >
static void op_repmat::apply (Mat< typename T1::elem_type > &out, const Op< T1, op_repmat > &in)
 //! implementation of the 'repeat matrix' operation, used for constructing matrices

Detailed Description

//!


Function Documentation

template<typename T1 >
void op_repmat::apply ( Mat< typename T1::elem_type > &  out,
const Op< T1, op_repmat > &  in 
) [inline, static, inherited]

//! implementation of the 'repeat matrix' operation, used for constructing matrices

Definition at line 29 of file op_repmat_meat.hpp.

References Op< T1, op_type >::aux_u32_a, Op< T1, op_type >::aux_u32_b, unwrap_check< T1 >::M, Op< T1, op_type >::m, Mat< eT >::n_cols, Mat< eT >::n_elem, Mat< eT >::n_rows, Mat< eT >::set_size(), and Mat< eT >::submat().

  {
  arma_extra_debug_sigprint();
  
  typedef typename T1::elem_type eT;
  
  const unwrap_check<T1> tmp(in.m, out);
  const Mat<eT>& X     = tmp.M;
  
  arma_debug_check( (X.n_elem == 0), "op_repmat::apply(): given object has no elements" );

  const u32 copies_per_row = in.aux_u32_a;
  const u32 copies_per_col = in.aux_u32_b;
  
  out.set_size(X.n_rows * copies_per_row, X.n_cols * copies_per_col);
  
  for(u32 col = 0; col < out.n_cols; col += X.n_cols)
    {
    for(u32 row = 0; row < out.n_rows; row += X.n_rows)
      {
      out.submat(row, col, row+X.n_rows-1, col+X.n_cols-1) = X;
      }
    }
  }