| 1289 | // Creates a compressed sparse matrix from its existing entries and those from an unsorted range of triplets |
| 1290 | template <typename InputIterator, typename SparseMatrixType, typename DupFunctor> |
| 1291 | void insert_from_triplets(const InputIterator& begin, const InputIterator& end, SparseMatrixType& mat, |
| 1292 | DupFunctor dup_func) { |
| 1293 | using Scalar = typename SparseMatrixType::Scalar; |
| 1294 | using SrcXprType = CwiseBinaryOp<scalar_disjunction_op<DupFunctor, Scalar>, const SparseMatrixType, const SparseMatrixType>; |
| 1295 | |
| 1296 | // set_from_triplets is necessary to sort the inner indices and remove the duplicate entries |
| 1297 | SparseMatrixType trips(mat.rows(), mat.cols()); |
| 1298 | set_from_triplets(begin, end, trips, dup_func); |
| 1299 | |
| 1300 | SrcXprType src = mat.binaryExpr(trips, scalar_disjunction_op<DupFunctor, Scalar>(dup_func)); |
| 1301 | // the sparse assignment procedure creates a temporary matrix and swaps the final result |
| 1302 | assign_sparse_to_sparse<SparseMatrixType, SrcXprType>(mat, src); |
| 1303 | } |
| 1304 | |
| 1305 | // Creates a compressed sparse matrix from its existing entries and those from an sorted range of triplets |
| 1306 | template <typename InputIterator, typename SparseMatrixType, typename DupFunctor> |
nothing calls this directly
no test coverage detected