Sparse move

This commit is contained in:
Charles Schlosser
2024-03-27 17:44:50 +00:00
committed by Antonio Sánchez
parent c8d368bdaf
commit 7b5d32b7c9
4 changed files with 84 additions and 6 deletions

View File

@@ -108,6 +108,33 @@ void sparse_vector(int rows, int cols) {
VERIFY_IS_APPROX(refV3 = v1.transpose(), v1.toDense());
VERIFY_IS_APPROX(DenseVector(v1), v1.toDense());
// test move
{
SparseVectorType v3(std::move(v1));
VERIFY_IS_APPROX(v3, refV1);
v1 = v3;
}
{
SparseVectorType v3;
v3 = std::move(v1);
VERIFY_IS_APPROX(v3, refV1);
v1 = v3;
}
{
SparseVectorType v3(std::move(mv1));
VERIFY_IS_APPROX(v3, refV1);
mv1 = v3;
}
{
SparseVectorType v3;
v3 = std::move(mv1);
VERIFY_IS_APPROX(v3, refV1);
mv1 = v3;
}
// test conservative resize
{
std::vector<StorageIndex> inc;