op_repmat_meat.hpp
Go to the documentation of this file.
1 // Copyright (C) 2009-2011 NICTA (www.nicta.com.au)
2 // Copyright (C) 2009-2011 Conrad Sanderson
3 // Copyright (C) 2009-2010 Dimitrios Bouzas
4 //
5 // This file is part of the Armadillo C++ library.
6 // It is provided without any warranty of fitness
7 // for any purpose. You can redistribute this file
8 // and/or modify it under the terms of the GNU
9 // Lesser General Public License (LGPL) as published
10 // by the Free Software Foundation, either version 3
11 // of the License or (at your option) any later version.
12 // (see http://www.opensource.org/licenses for more info)
13 
14 
15 
18 
19 
20 
23 template<typename T1>
24 inline
25 void
27  {
29 
30  typedef typename T1::elem_type eT;
31 
32  const unwrap_check<T1> tmp(in.m, out);
33  const Mat<eT>& X = tmp.M;
34 
35  const uword copies_per_row = in.aux_uword_a;
36  const uword copies_per_col = in.aux_uword_b;
37 
38  const uword X_n_rows = X.n_rows;
39  const uword X_n_cols = X.n_cols;
40 
41  out.set_size(X_n_rows * copies_per_row, X_n_cols * copies_per_col);
42 
43  const uword out_n_rows = out.n_rows;
44  const uword out_n_cols = out.n_cols;
45 
46  if( (out_n_rows > 0) && (out_n_cols > 0) )
47  {
48  for(uword col = 0; col < out_n_cols; col += X_n_cols)
49  {
50  for(uword row = 0; row < out_n_rows; row += X_n_rows)
51  {
52  out.submat(row, col, row+X_n_rows-1, col+X_n_cols-1) = X;
53  }
54  }
55  }
56  }
57 
58 
59 
void set_size(const uword in_elem)
change the matrix to have user specified dimensions (data is not preserved)
Definition: Mat_meat.hpp:4211
arma_inline subview< eT > submat(const uword in_row1, const uword in_col1, const uword in_row2, const uword in_col2)
creation of subview (submatrix)
Definition: Mat_meat.hpp:2092
const uword n_cols
number of columns in the matrix (read-only)
Definition: Mat_bones.hpp:30
arma_aligned uword aux_uword_b
storage of auxiliary data, uword format
Definition: Op_bones.hpp:48
const uword n_rows
number of rows in the matrix (read-only)
Definition: Mat_bones.hpp:29
arma_aligned const T1 & m
storage of reference to the operand (eg. a matrix)
Definition: Op_bones.hpp:45
u32 uword
Definition: typedef.hpp:85
static void apply(Mat< typename T1::elem_type > &out, const Op< T1, op_repmat > &in)
implementation of the &#39;repeat matrix&#39; operation, used for constructing matrices
#define arma_extra_debug_sigprint
Definition: debug.hpp:1116
Dense matrix class.
const Mat< eT > M
Definition: unwrap.hpp:142
arma_aligned uword aux_uword_a
storage of auxiliary data, uword format
Definition: Op_bones.hpp:47


armadillo_matrix
Author(s):
autogenerated on Fri Apr 16 2021 02:31:58