mirror of
https://gitlab.com/libeigen/eigen.git
synced 2026-04-10 11:34:33 +08:00
bug #986: add support for coefficient-based product with 0 depth.
This commit is contained in:
@@ -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>
|
||||
|
||||
Reference in New Issue
Block a user