| 1245 | // Creates a compressed sparse matrix from its existing entries and those from an unsorted range of triplets |
| 1246 | template <typename InputIterator, typename SparseMatrixType, typename DupFunctor> |
| 1247 | void insert_from_triplets(const InputIterator& begin, const InputIterator& end, SparseMatrixType& mat, |
| 1248 | DupFunctor dup_func) { |
| 1249 | using Scalar = typename SparseMatrixType::Scalar; |
| 1250 | using SrcXprType = |
| 1251 | CwiseBinaryOp<scalar_disjunction_op<DupFunctor, Scalar>, const SparseMatrixType, const SparseMatrixType>; |
| 1252 | |
| 1253 | // set_from_triplets is necessary to sort the inner indices and remove the duplicate entries |
| 1254 | SparseMatrixType trips(mat.rows(), mat.cols()); |
| 1255 | set_from_triplets(begin, end, trips, dup_func); |
| 1256 | |
| 1257 | SrcXprType src = mat.binaryExpr(trips, scalar_disjunction_op<DupFunctor, Scalar>(dup_func)); |
| 1258 | // the sparse assignment procedure creates a temporary matrix and swaps the final result |
| 1259 | assign_sparse_to_sparse<SparseMatrixType, SrcXprType>(mat, src); |
| 1260 | } |
| 1261 | |
| 1262 | // Creates a compressed sparse matrix from its existing entries and those from an sorted range of triplets |
| 1263 | template <typename InputIterator, typename SparseMatrixType, typename DupFunctor> |
nothing calls this directly
no test coverage detected