#include "find.h" #include "verbose.h" template IGL_INLINE void igl::find( const Eigen::SparseMatrix& X, Eigen::Matrix & I, Eigen::Matrix & J, Eigen::Matrix & V) { // Resize outputs to fit nonzeros I.resize(X.nonZeros()); J.resize(X.nonZeros()); V.resize(X.nonZeros()); int i = 0; // Iterate over outside for(int k=0; k::InnerIterator it (X,k); it; ++it) { V(i) = it.value(); I(i) = it.row(); J(i) = it.col(); i++; } } } template IGL_INLINE void igl::find( const Eigen::SparseVector& X, Eigen::Matrix & I, Eigen::Matrix & V) { // Resize outputs to fit nonzeros I.resize(X.nonZeros()); V.resize(X.nonZeros()); int i = 0; // loop over non-zeros for(typename Eigen::SparseVector::InnerIterator it(X); it; ++it) { I(i) = it.index(); V(i) = it.value(); i++; } } #ifndef IGL_HEADER_ONLY // Explicit template specialization #endif