// This file is part of libigl, a simple c++ geometry processing library. // // Copyright (C) 2019 Jérémie Dumas // // 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/. #ifndef IGL_SLICE_SORTED_H #define IGL_SLICE_SORTED_H #include "igl_inline.h" #include #include namespace igl { // Act like the matlab X(row_indices,col_indices) operator, where row_indices, // col_indices are non-negative integer indices. This version is about 2x faster // than igl::slice, but it assumes that the indices to slice with are already sorted. // // Inputs: // X m by n matrix // R list of row indices // C list of column indices // // Output: // Y #R by #C matrix // template IGL_INLINE void slice_sorted(const Eigen::SparseMatrix &X, const Eigen::DenseBase &R, const Eigen::DenseBase &C, Eigen::SparseMatrix &Y); } // namespace igl #ifndef IGL_STATIC_LIBRARY #include "slice_sorted.cpp" #endif #endif