mirror of
https://gitlab.com/libeigen/eigen.git
synced 2025-07-21 12:24:25 +08:00
fix bad Map in row-vector by matrix products
This commit is contained in:
parent
81f36b0e21
commit
468863f3a0
@ -614,7 +614,7 @@ struct ei_cache_friendly_product_selector<ProductType,1,LhsOrder,LhsAccess,RhsCo
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
_res = ei_aligned_stack_new(Scalar, res.size());
|
_res = ei_aligned_stack_new(Scalar, res.size());
|
||||||
Map<Matrix<Scalar,DestDerived::SizeAtCompileTime,1,ColMajor> >(_res, res.size()) = res;
|
Map<Matrix<Scalar,1,DestDerived::SizeAtCompileTime,ColMajor> >(_res, res.size()) = res;
|
||||||
}
|
}
|
||||||
ei_cache_friendly_product_colmajor_times_vector(res.size(),
|
ei_cache_friendly_product_colmajor_times_vector(res.size(),
|
||||||
&product.rhs().const_cast_derived().coeffRef(0,0), product.rhs().stride(),
|
&product.rhs().const_cast_derived().coeffRef(0,0), product.rhs().stride(),
|
||||||
@ -622,7 +622,7 @@ struct ei_cache_friendly_product_selector<ProductType,1,LhsOrder,LhsAccess,RhsCo
|
|||||||
|
|
||||||
if (!EvalToRes)
|
if (!EvalToRes)
|
||||||
{
|
{
|
||||||
res = Map<Matrix<Scalar,DestDerived::SizeAtCompileTime,1,ColMajor> >(_res, res.size());
|
res = Map<Matrix<Scalar,1,DestDerived::SizeAtCompileTime,ColMajor> >(_res, res.size());
|
||||||
ei_aligned_stack_delete(Scalar, _res, res.size());
|
ei_aligned_stack_delete(Scalar, _res, res.size());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -677,7 +677,7 @@ struct ei_cache_friendly_product_selector<ProductType,1,LhsOrder,LhsAccess,RhsCo
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
_lhs = ei_aligned_stack_new(Scalar, product.lhs().size());
|
_lhs = ei_aligned_stack_new(Scalar, product.lhs().size());
|
||||||
Map<Matrix<Scalar,Lhs::SizeAtCompileTime,1,ColMajor> >(_lhs, product.lhs().size()) = product.lhs();
|
Map<Matrix<Scalar,1,Lhs::SizeAtCompileTime,ColMajor> >(_lhs, product.lhs().size()) = product.lhs();
|
||||||
}
|
}
|
||||||
ei_cache_friendly_product_rowmajor_times_vector(&product.rhs().const_cast_derived().coeffRef(0,0), product.rhs().stride(),
|
ei_cache_friendly_product_rowmajor_times_vector(&product.rhs().const_cast_derived().coeffRef(0,0), product.rhs().stride(),
|
||||||
_lhs, product.lhs().size(), res);
|
_lhs, product.lhs().size(), res);
|
||||||
|
@ -48,4 +48,11 @@ void test_product_large()
|
|||||||
MatrixXf a = MatrixXf::Random(10,4), b = MatrixXf::Random(4,10), c = a;
|
MatrixXf a = MatrixXf::Random(10,4), b = MatrixXf::Random(4,10), c = a;
|
||||||
VERIFY_IS_APPROX((a = a * b), (c * b).eval());
|
VERIFY_IS_APPROX((a = a * b), (c * b).eval());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
MatrixXf mat1(10,10); mat1.setRandom();
|
||||||
|
MatrixXf mat2(32,10); mat2.setRandom();
|
||||||
|
MatrixXf result = mat1.row(2)*mat2.transpose();
|
||||||
|
VERIFY_IS_APPROX(result, (mat1.row(2)*mat2.transpose()).eval());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user