aboutsummaryrefslogtreecommitdiff
path: root/test/zerosized.cpp
diff options
context:
space:
mode:
authorMiao Wang <miaowang@google.com>2017-03-08 17:23:02 +0000
committerandroid-build-merger <android-build-merger@google.com>2017-03-08 17:23:02 +0000
commit4b1361e1aca4189cfba2bd2c0fc87d593da76728 (patch)
tree0488797fc544fe977bec6418c73445759f052482 /test/zerosized.cpp
parent29a3140b512228375adb9f24414fb2996c2889e6 (diff)
parentd3ea081e6f4a81b7086df9f35f08f25e54f20863 (diff)
downloadeigen-4b1361e1aca4189cfba2bd2c0fc87d593da76728.tar.gz
Merge "Rebase Eigen to 3.3.3." am: 7de1f32623 am: 6688b8b260
am: d3ea081e6f Change-Id: Id61115ffaa6ad3c134b182547652c7248e8aa5cd
Diffstat (limited to 'test/zerosized.cpp')
-rw-r--r--test/zerosized.cpp20
1 files changed, 19 insertions, 1 deletions
diff --git a/test/zerosized.cpp b/test/zerosized.cpp
index da7dd0481..477ff0070 100644
--- a/test/zerosized.cpp
+++ b/test/zerosized.cpp
@@ -25,6 +25,7 @@ template<typename MatrixType> void zeroReduction(const MatrixType& m) {
template<typename MatrixType> void zeroSizedMatrix()
{
MatrixType t1;
+ typedef typename MatrixType::Scalar Scalar;
if (MatrixType::SizeAtCompileTime == Dynamic || MatrixType::SizeAtCompileTime == 0)
{
@@ -37,7 +38,7 @@ template<typename MatrixType> void zeroSizedMatrix()
if (MatrixType::RowsAtCompileTime == Dynamic && MatrixType::ColsAtCompileTime == Dynamic)
{
- MatrixType t2(0, 0);
+ MatrixType t2(0, 0), t3(t1);
VERIFY(t2.rows() == 0);
VERIFY(t2.cols() == 0);
@@ -45,6 +46,23 @@ template<typename MatrixType> void zeroSizedMatrix()
VERIFY(t1==t2);
}
}
+
+ if(MatrixType::MaxColsAtCompileTime!=0 && MatrixType::MaxRowsAtCompileTime!=0)
+ {
+ Index rows = MatrixType::RowsAtCompileTime==Dynamic ? internal::random<Index>(1,10) : Index(MatrixType::RowsAtCompileTime);
+ Index cols = MatrixType::ColsAtCompileTime==Dynamic ? internal::random<Index>(1,10) : Index(MatrixType::ColsAtCompileTime);
+ MatrixType m(rows,cols);
+ zeroReduction(m.template block<0,MatrixType::ColsAtCompileTime>(0,0,0,cols));
+ zeroReduction(m.template block<MatrixType::RowsAtCompileTime,0>(0,0,rows,0));
+ zeroReduction(m.template block<0,1>(0,0));
+ zeroReduction(m.template block<1,0>(0,0));
+ Matrix<Scalar,Dynamic,Dynamic> prod = m.template block<MatrixType::RowsAtCompileTime,0>(0,0,rows,0) * m.template block<0,MatrixType::ColsAtCompileTime>(0,0,0,cols);
+ VERIFY(prod.rows()==rows && prod.cols()==cols);
+ VERIFY(prod.isZero());
+ prod = m.template block<1,0>(0,0) * m.template block<0,1>(0,0);
+ VERIFY(prod.size()==1);
+ VERIFY(prod.isZero());
+ }
}
template<typename VectorType> void zeroSizedVector()