#ifndef IGL_REPMAT_H #define IGL_REPMAT_H #define EIGEN_YES_I_KNOW_SPARSE_MODULE_IS_NOT_STABLE_YET #include #include namespace igl { // Ideally this is a super overloaded function that behaves just like // matlab's repmat // Replicate and tile a matrix // // Templates: // T should be a eigen matrix primitive type like int or double // Inputs: // A m by n input matrix // r number of row-direction copies // c number of col-direction copies // Outputs: // B r*m by c*n output matrix // template inline void repmat( const Eigen::Matrix & A, const int r, const int c, Eigen::Matrix & B); } // Implementation template inline void igl::repmat( const Eigen::Matrix & A, const int r, const int c, Eigen::Matrix & B) { assert(r>0); assert(c>0); // Make room for output B.resize(r*A.rows(),c*A.cols()); // copy tiled blocks for(int i = 0;i