mirror of
https://gitlab.com/libeigen/eigen.git
synced 2025-04-19 08:09:36 +08:00
improve coverage of matrix-vector product
This commit is contained in:
parent
fb5f546161
commit
ae1d1c8f6c
@ -104,13 +104,24 @@ template<typename MatrixType> void product_extra(const MatrixType& m)
|
||||
VERIFY_IS_APPROX((-m1.adjoint() * s2) * (s1 * v1.adjoint()),
|
||||
(-m1.adjoint()*s2).eval() * (s1 * v1.adjoint()).eval());
|
||||
|
||||
// test the vector-matrix product with non aligned starts
|
||||
int i = ei_random<int>(0,m1.rows()-2);
|
||||
int j = ei_random<int>(0,m1.cols()-2);
|
||||
int r = ei_random<int>(1,m1.rows()-i);
|
||||
int c = ei_random<int>(1,m1.cols()-j);
|
||||
int i2 = ei_random<int>(0,m1.rows()-1);
|
||||
int j2 = ei_random<int>(0,m1.cols()-1);
|
||||
|
||||
VERIFY_IS_APPROX(m1.col(j2).adjoint() * m1.block(0,j,m1.rows(),c), m1.col(j2).adjoint().eval() * m1.block(0,j,m1.rows(),c).eval());
|
||||
VERIFY_IS_APPROX(m1.block(i,0,r,m1.cols()) * m1.row(i2).adjoint(), m1.block(i,0,r,m1.cols()).eval() * m1.row(i2).adjoint().eval());
|
||||
|
||||
}
|
||||
|
||||
void test_product_extra()
|
||||
{
|
||||
for(int i = 0; i < g_repeat; i++) {
|
||||
CALL_SUBTEST( product_extra(MatrixXf(ei_random<int>(1,320), ei_random<int>(1,320))) );
|
||||
CALL_SUBTEST( product_extra(MatrixXf(ei_random<int>(2,320), ei_random<int>(2,320))) );
|
||||
CALL_SUBTEST( product_extra(MatrixXcf(ei_random<int>(50,50), ei_random<int>(50,50))) );
|
||||
CALL_SUBTEST( product_extra(Matrix<std::complex<double>,Dynamic,Dynamic,RowMajor>(ei_random<int>(1,50), ei_random<int>(1,50))) );
|
||||
CALL_SUBTEST( product_extra(Matrix<std::complex<double>,Dynamic,Dynamic,RowMajor>(ei_random<int>(2,50), ei_random<int>(2,50))) );
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user