bugfix in DiagonalProduct: a "DiagonalProduct<SomeXpr>" expression

is now evaluated as a "DiagonalProduct<Matrix<SomeXpr::Eval> >".
Note that currently this only happens in DiagonalProduct.
This commit is contained in:
Gael Guennebaud
2008-12-10 19:02:13 +00:00
parent ba9a53f9c6
commit beabf008b0
4 changed files with 46 additions and 5 deletions

View File

@@ -33,4 +33,13 @@ void test_product_large()
CALL_SUBTEST( product(MatrixXcf(ei_random<int>(1,50), ei_random<int>(1,50))) );
CALL_SUBTEST( product(Matrix<float,Dynamic,Dynamic,RowMajor>(ei_random<int>(1,320), ei_random<int>(1,320))) );
}
{
// test a specific issue in DiagonalProduct
int N = 1000000;
VectorXf v = VectorXf::Ones(N);
MatrixXf m = MatrixXf::Ones(N,3);
m = (v+v).asDiagonal() * m;
VERIFY_IS_APPROX(m, MatrixXf::Constant(N,3,2));
}
}