diff options
author | Gael Guennebaud <g.gael@free.fr> | 2012-07-25 09:33:50 +0200 |
---|---|---|
committer | Gael Guennebaud <g.gael@free.fr> | 2012-07-25 09:33:50 +0200 |
commit | e75b1eb883bd65f8f34b1ca2ca13cd28744ab13a (patch) | |
tree | 48adc816550fa2e68636054fa58a25c00d08540b /test/sparse_vector.cpp | |
parent | 7b34b5f6f98115efbda9d127378aea5d403a4905 (diff) |
Fix aliasing issue in sparse matrix assignment.
(m=-m; or m=m.transpose(); with m sparse work again)
Diffstat (limited to 'test/sparse_vector.cpp')
-rw-r--r-- | test/sparse_vector.cpp | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/test/sparse_vector.cpp b/test/sparse_vector.cpp index 7201afe5b..9d559f5bf 100644 --- a/test/sparse_vector.cpp +++ b/test/sparse_vector.cpp @@ -78,6 +78,11 @@ template<typename Scalar> void sparse_vector(int rows, int cols) VERIFY_IS_APPROX(v1.squaredNorm(), refV1.squaredNorm()); + // test aliasing + VERIFY_IS_APPROX((v1 = -v1), (refV1 = -refV1)); + VERIFY_IS_APPROX((v1 = v1.transpose()), (refV1 = refV1.transpose().eval())); + VERIFY_IS_APPROX((v1 += -v1), (refV1 += -refV1)); + } void test_sparse_vector() |