mirror of
https://gitlab.com/libeigen/eigen.git
synced 2026-04-10 11:34:33 +08:00
Zero-out matrix for empty set of triplets.
This commit is contained in:
committed by
Charles Schlosser
parent
52fc978c6f
commit
da1a34a6ba
@@ -1130,7 +1130,11 @@ void set_from_triplets(const InputIterator& begin, const InputIterator& end, Spa
|
||||
using TransposedSparseMatrix =
|
||||
SparseMatrix<typename SparseMatrixType::Scalar, IsRowMajor ? ColMajor : RowMajor, StorageIndex>;
|
||||
|
||||
if (begin == end) return;
|
||||
if (begin == end) {
|
||||
// Clear out existing data (if any).
|
||||
mat.setZero();
|
||||
return;
|
||||
}
|
||||
|
||||
// There are two strategies to consider for constructing a matrix from unordered triplets:
|
||||
// A) construct the 'mat' in its native storage order and sort in-place (less memory); or,
|
||||
|
||||
Reference in New Issue
Block a user