mirror of
https://gitlab.com/libeigen/eigen.git
synced 2024-11-27 06:30:28 +08:00
fix bug #122 : rank 2 update test and scalar multiple extraction were both wrong
This commit is contained in:
parent
0ab9a0a2f7
commit
f1690fb9fa
@ -27,7 +27,7 @@
|
||||
|
||||
namespace internal {
|
||||
|
||||
/* Optimized selfadjoint matrix += alpha * uv' + vu'
|
||||
/* Optimized selfadjoint matrix += alpha * uv' + conj(alpha)*vu'
|
||||
* It corresponds to the Level2 syr2 BLAS routine
|
||||
*/
|
||||
|
||||
@ -84,7 +84,7 @@ SelfAdjointView<MatrixType,UpLo>& SelfAdjointView<MatrixType,UpLo>
|
||||
const ActualVType actualV = VBlasTraits::extract(v.derived());
|
||||
|
||||
Scalar actualAlpha = alpha * UBlasTraits::extractScalarFactor(u.derived())
|
||||
* VBlasTraits::extractScalarFactor(v.derived());
|
||||
* internal::conj(VBlasTraits::extractScalarFactor(v.derived()));
|
||||
|
||||
enum { IsRowMajor = (internal::traits<MatrixType>::Flags&RowMajorBit) ? 1 : 0 };
|
||||
internal::selfadjoint_rank2_update_selector<Scalar, Index,
|
||||
|
@ -60,11 +60,11 @@ template<typename MatrixType> void product_selfadjoint(const MatrixType& m)
|
||||
|
||||
m2 = m1.template triangularView<Upper>();
|
||||
m2.template selfadjointView<Upper>().rankUpdate(-v1,s2*v2,s3);
|
||||
VERIFY_IS_APPROX(m2, (m1 + (-s2*s3) * (v1 * v2.adjoint()+ v2 * v1.adjoint())).template triangularView<Upper>().toDenseMatrix());
|
||||
VERIFY_IS_APPROX(m2, (m1 + (s3*(-v1)*(s2*v2).adjoint()+internal::conj(s3)*(s2*v2)*(-v1).adjoint())).template triangularView<Upper>().toDenseMatrix());
|
||||
|
||||
m2 = m1.template triangularView<Upper>();
|
||||
m2.template selfadjointView<Upper>().rankUpdate(-r1.adjoint(),r2.adjoint()*s3,s1);
|
||||
VERIFY_IS_APPROX(m2, (m1 + (-s3*s1) * (r1.adjoint() * r2 + r2.adjoint() * r1)).template triangularView<Upper>().toDenseMatrix());
|
||||
m2.template selfadjointView<Upper>().rankUpdate(-s2*r1.adjoint(),r2.adjoint()*s3,s1);
|
||||
VERIFY_IS_APPROX(m2, (m1 + s1*(-s2*r1.adjoint())*(r2.adjoint()*s3).adjoint() + internal::conj(s1)*(r2.adjoint()*s3) * (-s2*r1.adjoint()).adjoint()).template triangularView<Upper>().toDenseMatrix());
|
||||
|
||||
if (rows>1)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user