mirror of
https://gitlab.com/libeigen/eigen.git
synced 2025-09-12 17:33:15 +08:00
better fix for (v * v') * v, we still have to find a way to reorder it
This commit is contained in:
parent
5409ce1625
commit
9a3cae4655
@ -135,7 +135,7 @@ struct ProductReturnType<Lhs,Rhs,UnrolledProduct>
|
|||||||
{
|
{
|
||||||
typedef typename ei_nested<Lhs,Rhs::ColsAtCompileTime>::type LhsNested;
|
typedef typename ei_nested<Lhs,Rhs::ColsAtCompileTime>::type LhsNested;
|
||||||
typedef typename ei_nested<Rhs,Lhs::RowsAtCompileTime>::type RhsNested;
|
typedef typename ei_nested<Rhs,Lhs::RowsAtCompileTime>::type RhsNested;
|
||||||
typedef GeneralProduct<Lhs, Rhs, UnrolledProduct> Type;
|
typedef GeneralProduct<LhsNested, RhsNested, UnrolledProduct> Type;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@ -212,11 +212,6 @@ class GeneralProduct<Lhs, Rhs, OuterProduct>
|
|||||||
ei_outer_product_selector<(int(Dest::Flags)&RowMajorBit) ? RowMajor : ColMajor>::run(*this, dest, alpha);
|
ei_outer_product_selector<(int(Dest::Flags)&RowMajorBit) ? RowMajor : ColMajor>::run(*this, dest, alpha);
|
||||||
}
|
}
|
||||||
|
|
||||||
Scalar coeff(int row, int col) const
|
|
||||||
{
|
|
||||||
return this->lhs().coeff(row) * this->rhs().coeff(col);
|
|
||||||
}
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
GeneralProduct& operator=(const GeneralProduct&);
|
GeneralProduct& operator=(const GeneralProduct&);
|
||||||
};
|
};
|
||||||
|
@ -114,11 +114,6 @@ template<typename MatrixType> void product_extra(const MatrixType& m)
|
|||||||
|
|
||||||
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.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());
|
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());
|
||||||
|
|
||||||
// test (outer_product) * vector with and without temporary
|
|
||||||
ColVectorType vc3 = ColVectorType::Random(cols), vc4 = ColVectorType::Random(cols);
|
|
||||||
vcres = (vc2 * vc3.transpose()) * vc4; // without temporary
|
|
||||||
VERIFY_IS_APPROX(vcres, (vc2 * vc3.transpose()).eval() * vc4);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void test_product_extra()
|
void test_product_extra()
|
||||||
|
@ -34,4 +34,10 @@ void test_product_small()
|
|||||||
CALL_SUBTEST( product(Matrix4d()) );
|
CALL_SUBTEST( product(Matrix4d()) );
|
||||||
CALL_SUBTEST( product(Matrix4f()) );
|
CALL_SUBTEST( product(Matrix4f()) );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
// test compilation of (outer_product) * vector
|
||||||
|
Vector3f v = Vector3f::Random();
|
||||||
|
VERIFY_IS_APPROX( (v * v.transpose()) * v, (v * v.transpose()).eval() * v);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user