Op_repmat

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

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, 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().

00030   {
00031   arma_extra_debug_sigprint();
00032   
00033   typedef typename T1::elem_type eT;
00034   
00035   const unwrap_check<T1> tmp(in.m, out);
00036   const Mat<eT>& X     = tmp.M;
00037   
00038   arma_debug_check( (X.n_elem == 0), "op_repmat::apply(): given object has no elements" );
00039 
00040   const u32 copies_per_row = in.aux_u32_a;
00041   const u32 copies_per_col = in.aux_u32_b;
00042   
00043   out.set_size(X.n_rows * copies_per_row, X.n_cols * copies_per_col);
00044   
00045   for(u32 col = 0; col < out.n_cols; col += X.n_cols)
00046     {
00047     for(u32 row = 0; row < out.n_rows; row += X.n_rows)
00048       {
00049       out.submat(row, col, row+X.n_rows-1, col+X.n_cols-1) = X;
00050       }
00051     }
00052   }