mirror of
https://gitlab.com/libeigen/eigen.git
synced 2026-04-10 11:34:33 +08:00
add an optimized "apply in place a rotation in the plane",
and make Jacobi and SelfAdjointEigenSolver use it => ~ x1.75 speedup for JacobiSVD and x2 for SelfAdjointEigenSolver
This commit is contained in:
@@ -28,23 +28,17 @@
|
||||
template<typename Derived>
|
||||
void MatrixBase<Derived>::applyJacobiOnTheLeft(int p, int q, Scalar c, Scalar s)
|
||||
{
|
||||
for(int i = 0; i < cols(); ++i)
|
||||
{
|
||||
Scalar tmp = coeff(p,i);
|
||||
coeffRef(p,i) = c * tmp - s * coeff(q,i);
|
||||
coeffRef(q,i) = s * tmp + c * coeff(q,i);
|
||||
}
|
||||
RowXpr x(row(p));
|
||||
RowXpr y(row(q));
|
||||
ei_apply_rotation_in_the_plane(x, y, c, s);
|
||||
}
|
||||
|
||||
template<typename Derived>
|
||||
void MatrixBase<Derived>::applyJacobiOnTheRight(int p, int q, Scalar c, Scalar s)
|
||||
{
|
||||
for(int i = 0; i < rows(); ++i)
|
||||
{
|
||||
Scalar tmp = coeff(i,p);
|
||||
coeffRef(i,p) = c * tmp - s * coeff(i,q);
|
||||
coeffRef(i,q) = s * tmp + c * coeff(i,q);
|
||||
}
|
||||
ColXpr x(col(p));
|
||||
ColXpr y(col(q));
|
||||
ei_apply_rotation_in_the_plane(x, y, c, s);
|
||||
}
|
||||
|
||||
template<typename Scalar>
|
||||
|
||||
Reference in New Issue
Block a user