aboutsummaryrefslogtreecommitdiffhomepage
path: root/test/mapped_matrix.cpp
diff options
context:
space:
mode:
authorGravatar Gael Guennebaud <g.gael@free.fr>2015-06-14 15:04:07 +0200
committerGravatar Gael Guennebaud <g.gael@free.fr>2015-06-14 15:04:07 +0200
commit972a535288c5aaa62b66d43e1825e3b4eed7d234 (patch)
tree2f961167811c8876f6a4bf1e9c4e4d17c818c51b /test/mapped_matrix.cpp
parente5b490b6542c444aa8e263e50c50e09a4201c99f (diff)
Remove aligned-on-scalar assert and fallback to non vectorized path at runtime (first_aligned already had this runtime guard)
Diffstat (limited to 'test/mapped_matrix.cpp')
-rw-r--r--test/mapped_matrix.cpp24
1 files changed, 24 insertions, 0 deletions
diff --git a/test/mapped_matrix.cpp b/test/mapped_matrix.cpp
index 05a86e70b..1f9da31ac 100644
--- a/test/mapped_matrix.cpp
+++ b/test/mapped_matrix.cpp
@@ -159,6 +159,28 @@ template<typename PlainObjectType> void check_const_correctness(const PlainObjec
VERIFY( !(Map<ConstPlainObjectType, Aligned>::Flags & LvalueBit) );
}
+template<typename Scalar>
+void map_not_aligned_on_scalar()
+{
+ typedef Matrix<Scalar,Dynamic,Dynamic> MatrixType;
+ typedef typename MatrixType::Index Index;
+ Index size = 11;
+ Scalar* array1 = internal::aligned_new<Scalar>((size+1)*(size+1)+1);
+ Scalar* array2 = reinterpret_cast<Scalar*>(sizeof(Scalar)/2+std::size_t(array1));
+ Map<MatrixType,0,OuterStride<> > map2(array2, size, size, OuterStride<>(size+1));
+ MatrixType m2 = MatrixType::Random(size,size);
+ map2 = m2;
+ VERIFY_IS_EQUAL(m2, map2);
+
+ typedef Matrix<Scalar,Dynamic,1> VectorType;
+ Map<VectorType> map3(array2, size);
+ MatrixType v3 = VectorType::Random(size);
+ map3 = v3;
+ VERIFY_IS_EQUAL(v3, map3);
+
+ internal::aligned_delete(array1, (size+1)*(size+1)+1);
+}
+
void test_mapped_matrix()
{
for(int i = 0; i < g_repeat; i++) {
@@ -183,5 +205,7 @@ void test_mapped_matrix()
CALL_SUBTEST_8( map_static_methods(RowVector3d()) );
CALL_SUBTEST_9( map_static_methods(VectorXcd(8)) );
CALL_SUBTEST_10( map_static_methods(VectorXf(12)) );
+
+ CALL_SUBTEST_11( map_not_aligned_on_scalar<double>() );
}
}