diff options
author | 2015-04-01 13:15:23 +0200 | |
---|---|---|
committer | 2015-04-01 13:15:23 +0200 | |
commit | 8481dc21eada115b20116b17826a761208602b02 (patch) | |
tree | a4649596d8084f86bf938ac4c02fbd1c7b33810c /test/product_extra.cpp | |
parent | 79b4e6acaf9f81155f4cdda9eb4bb6fe12aef5d7 (diff) |
bug #986: add support for coefficient-based product with 0 depth.
Diffstat (limited to 'test/product_extra.cpp')
-rw-r--r-- | test/product_extra.cpp | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/test/product_extra.cpp b/test/product_extra.cpp index 67ea13568..7c54b6977 100644 --- a/test/product_extra.cpp +++ b/test/product_extra.cpp @@ -113,6 +113,9 @@ void mat_mat_scalar_scalar_product() template <typename MatrixType> void zero_sized_objects(const MatrixType& m) { + typedef typename MatrixType::Scalar Scalar; + const int PacketSize = internal::packet_traits<Scalar>::size; + const int PacketSize1 = PacketSize>1 ? PacketSize-1 : 1; Index rows = m.rows(); Index cols = m.cols(); @@ -132,6 +135,38 @@ void zero_sized_objects(const MatrixType& m) res = b*a; VERIFY(res.rows()==0 && res.cols()==cols); } + + { + Matrix<Scalar,PacketSize,0> a; + Matrix<Scalar,0,1> b; + Matrix<Scalar,PacketSize,1> res; + VERIFY_IS_APPROX( (res=a*b), MatrixType::Zero(PacketSize,1) ); + VERIFY_IS_APPROX( (res=a.lazyProduct(b)), MatrixType::Zero(PacketSize,1) ); + } + + { + Matrix<Scalar,PacketSize1,0> a; + Matrix<Scalar,0,1> b; + Matrix<Scalar,PacketSize1,1> res; + VERIFY_IS_APPROX( (res=a*b), MatrixType::Zero(PacketSize1,1) ); + VERIFY_IS_APPROX( (res=a.lazyProduct(b)), MatrixType::Zero(PacketSize1,1) ); + } + + { + Matrix<Scalar,PacketSize,Dynamic> a(PacketSize,0); + Matrix<Scalar,Dynamic,1> b(0,1); + Matrix<Scalar,PacketSize,1> res; + VERIFY_IS_APPROX( (res=a*b), MatrixType::Zero(PacketSize,1) ); + VERIFY_IS_APPROX( (res=a.lazyProduct(b)), MatrixType::Zero(PacketSize,1) ); + } + + { + Matrix<Scalar,PacketSize1,Dynamic> a(PacketSize1,0); + Matrix<Scalar,Dynamic,1> b(0,1); + Matrix<Scalar,PacketSize1,1> res; + VERIFY_IS_APPROX( (res=a*b), MatrixType::Zero(PacketSize1,1) ); + VERIFY_IS_APPROX( (res=a.lazyProduct(b)), MatrixType::Zero(PacketSize1,1) ); + } } template<int> |