aboutsummaryrefslogtreecommitdiffhomepage
path: root/test/sparse_basic.cpp
diff options
context:
space:
mode:
authorGravatar Gael Guennebaud <g.gael@free.fr>2012-07-25 09:33:50 +0200
committerGravatar Gael Guennebaud <g.gael@free.fr>2012-07-25 09:33:50 +0200
commite75b1eb883bd65f8f34b1ca2ca13cd28744ab13a (patch)
tree48adc816550fa2e68636054fa58a25c00d08540b /test/sparse_basic.cpp
parent7b34b5f6f98115efbda9d127378aea5d403a4905 (diff)
Fix aliasing issue in sparse matrix assignment.
(m=-m; or m=m.transpose(); with m sparse work again)
Diffstat (limited to 'test/sparse_basic.cpp')
-rw-r--r--test/sparse_basic.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/test/sparse_basic.cpp b/test/sparse_basic.cpp
index 767451450..4566de9f2 100644
--- a/test/sparse_basic.cpp
+++ b/test/sparse_basic.cpp
@@ -193,6 +193,12 @@ template<typename SparseMatrixType> void sparse_basic(const SparseMatrixType& re
// sparse cwise* dense
VERIFY_IS_APPROX(m3.cwiseProduct(refM4), refM3.cwiseProduct(refM4));
// VERIFY_IS_APPROX(m3.cwise()/refM4, refM3.cwise()/refM4);
+
+ // test aliasing
+ VERIFY_IS_APPROX((m1 = -m1), (refM1 = -refM1));
+ VERIFY_IS_APPROX((m1 = m1.transpose()), (refM1 = refM1.transpose().eval()));
+ VERIFY_IS_APPROX((m1 = -m1.transpose()), (refM1 = -refM1.transpose().eval()));
+ VERIFY_IS_APPROX((m1 += -m1), (refM1 += -refM1));
}
// test transpose