// This file is part of libigl, a simple c++ geometry processing library. // // Copyright (C) 2017 Daniele Panozzo // // 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 "sparse_cached.h" #include #include #include #include #include #include template IGL_INLINE void igl::sparse_cached_precompute( const Eigen::MatrixBase & I, const Eigen::MatrixBase & J, Eigen::VectorXi& data, Eigen::SparseMatrix& X) { // Generates the triplets std::vector > t(I.size()); for (unsigned i = 0; i(I[i],J[i],1); // Call the triplets version sparse_cached_precompute(t,X,data); } template IGL_INLINE void igl::sparse_cached_precompute( const std::vector >& triplets, Eigen::VectorXi& data, Eigen::SparseMatrix& X) { // Construct an empty sparse matrix X.setFromTriplets(triplets.begin(),triplets.end()); X.makeCompressed(); std::vector > T(triplets.size()); for (unsigned i=0; i= 0); assert(row < X.rows()); assert(row >= 0); assert(value_index >= 0); assert(value_index < X.nonZeros()); std::pair p_m = std::make_pair(row,col); while (t IGL_INLINE void igl::sparse_cached( const std::vector >& triplets, const Eigen::VectorXi& data, Eigen::SparseMatrix& X) { assert(triplets.size() == data.size()); // Clear it first for (unsigned i = 0; i IGL_INLINE void igl::sparse_cached( const Eigen::MatrixBase& V, const Eigen::VectorXi& data, Eigen::SparseMatrix& X) { assert(V.size() == data.size()); // Clear it first for (unsigned i = 0; i(std::vector::StorageIndex>, std::allocator::StorageIndex> > > const&, Eigen::Matrix const&, Eigen::SparseMatrix&); template void igl::sparse_cached_precompute(std::vector::StorageIndex>, std::allocator::StorageIndex> > > const&, Eigen::Matrix&, Eigen::SparseMatrix&); #else template void igl::sparse_cached(std::vector::Index>, std::allocator::Index> > > const&, Eigen::Matrix const&, Eigen::SparseMatrix&); template void igl::sparse_cached_precompute(std::vector::Index>, std::allocator::Index> > > const&, Eigen::Matrix&, Eigen::SparseMatrix&); #endif #endif