MCPcopy Create free account
hub / github.com/XJTU-Graphics/dandelion / insert_from_triplets

Function insert_from_triplets

deps/Eigen/src/SparseCore/SparseMatrix.h:1247–1260  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1245// Creates a compressed sparse matrix from its existing entries and those from an unsorted range of triplets
1246template <typename InputIterator, typename SparseMatrixType, typename DupFunctor>
1247void 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
1263template <typename InputIterator, typename SparseMatrixType, typename DupFunctor>

Callers

nothing calls this directly

Calls 3

set_from_tripletsFunction · 0.85
rowsMethod · 0.45
colsMethod · 0.45

Tested by

no test coverage detected