Add free-function swap.

This commit is contained in:
Antonio Sánchez
2024-10-14 15:51:40 +00:00
committed by Rasmus Munk Larsen
parent 820e8a45fb
commit b396a6fbb2
4 changed files with 48 additions and 0 deletions

View File

@@ -829,6 +829,8 @@ class SparseMatrix : public SparseCompressedBase<SparseMatrix<Scalar_, Options_,
std::swap(m_innerNonZeros, other.m_innerNonZeros);
m_data.swap(other.m_data);
}
/** Free-function swap. */
friend EIGEN_DEVICE_FUNC void swap(SparseMatrix& a, SparseMatrix& b) { a.swap(b); }
/** Sets *this to the identity matrix.
* This function also turns the matrix into compressed mode, and drop any reserved memory. */