$search
00001 // Copyright (C) 2009-2011 NICTA (www.nicta.com.au) 00002 // Copyright (C) 2009-2011 Conrad Sanderson 00003 // Copyright (C) 2009-2010 Dimitrios Bouzas 00004 // 00005 // This file is part of the Armadillo C++ library. 00006 // It is provided without any warranty of fitness 00007 // for any purpose. You can redistribute this file 00008 // and/or modify it under the terms of the GNU 00009 // Lesser General Public License (LGPL) as published 00010 // by the Free Software Foundation, either version 3 00011 // of the License or (at your option) any later version. 00012 // (see http://www.opensource.org/licenses for more info) 00013 00014 00015 00018 00019 00020 00023 template<typename T1> 00024 inline 00025 void 00026 op_repmat::apply(Mat<typename T1::elem_type>& out, const Op<T1,op_repmat>& in) 00027 { 00028 arma_extra_debug_sigprint(); 00029 00030 typedef typename T1::elem_type eT; 00031 00032 const unwrap_check<T1> tmp(in.m, out); 00033 const Mat<eT>& X = tmp.M; 00034 00035 const uword copies_per_row = in.aux_uword_a; 00036 const uword copies_per_col = in.aux_uword_b; 00037 00038 const uword X_n_rows = X.n_rows; 00039 const uword X_n_cols = X.n_cols; 00040 00041 out.set_size(X_n_rows * copies_per_row, X_n_cols * copies_per_col); 00042 00043 const uword out_n_rows = out.n_rows; 00044 const uword out_n_cols = out.n_cols; 00045 00046 if( (out_n_rows > 0) && (out_n_cols > 0) ) 00047 { 00048 for(uword col = 0; col < out_n_cols; col += X_n_cols) 00049 { 00050 for(uword row = 0; row < out_n_rows; row += X_n_rows) 00051 { 00052 out.submat(row, col, row+X_n_rows-1, col+X_n_cols-1) = X; 00053 } 00054 } 00055 } 00056 } 00057 00058 00059