// This file is part of libigl, a simple c++ geometry processing library. // // Copyright (C) 2013 Alec Jacobson // // This Source Code Form is subject to the terms of the Mozilla Public License // v. 2.0. If a copy of the MPL was not distributed with this file, You can // obtain one at http://mozilla.org/MPL/2.0/. #include "columnize.h" #include template IGL_INLINE void igl::columnize( const Eigen::PlainObjectBase & A, const int k, const int dim, Eigen::PlainObjectBase & B) { // Eigen matrices must be 2d so dim must be only 1 or 2 assert(dim == 1 || dim == 2); // block height, width, and number of blocks int m,n; if(dim == 1) { m = A.rows()/k; assert(m*(int)k == (int)A.rows()); n = A.cols(); }else// dim == 2 { m = A.rows(); n = A.cols()/k; assert(n*(int)k == (int)A.cols()); } // resize output B.resize(A.rows()*A.cols(),1); for(int b = 0;b<(int)k;b++) { for(int i = 0;i, Eigen::Matrix >(Eigen::PlainObjectBase > const&, int, int, Eigen::PlainObjectBase >&); template void igl::columnize, Eigen::Matrix >(Eigen::PlainObjectBase > const&, int, int, Eigen::PlainObjectBase >&); template void igl::columnize, Eigen::Matrix >(Eigen::PlainObjectBase > const&, int, int, Eigen::PlainObjectBase >&); template void igl::columnize, Eigen::Matrix >(Eigen::PlainObjectBase > const&, int, int, Eigen::PlainObjectBase >&); #endif