rename PlanarRotation -> JacobiRotation

This commit is contained in:
Benoit Jacob 2010-10-19 21:56:26 -04:00
parent 9044c98cff
commit e259f71477
18 changed files with 50 additions and 50 deletions

View File

@ -377,9 +377,9 @@ template<typename Derived> class MatrixBase
///////// Jacobi module ///////// ///////// Jacobi module /////////
template<typename OtherScalar> template<typename OtherScalar>
void applyOnTheLeft(Index p, Index q, const PlanarRotation<OtherScalar>& j); void applyOnTheLeft(Index p, Index q, const JacobiRotation<OtherScalar>& j);
template<typename OtherScalar> template<typename OtherScalar>
void applyOnTheRight(Index p, Index q, const PlanarRotation<OtherScalar>& j); void applyOnTheRight(Index p, Index q, const JacobiRotation<OtherScalar>& j);
///////// MatrixFunctions module ///////// ///////// MatrixFunctions module /////////

View File

@ -173,7 +173,7 @@ template<typename MatrixType, int QRPreconditioner = ColPivHouseholderQRPrecondi
template<typename MatrixType, int UpLo = Lower> class LLT; template<typename MatrixType, int UpLo = Lower> class LLT;
template<typename MatrixType, int UpLo = Lower> class LDLT; template<typename MatrixType, int UpLo = Lower> class LDLT;
template<typename VectorsType, typename CoeffsType, int Side=OnTheLeft> class HouseholderSequence; template<typename VectorsType, typename CoeffsType, int Side=OnTheLeft> class HouseholderSequence;
template<typename Scalar> class PlanarRotation; template<typename Scalar> class JacobiRotation;
// Geometry module: // Geometry module:
template<typename Derived, int _Dim> class RotationBase; template<typename Derived, int _Dim> class RotationBase;

View File

@ -411,7 +411,7 @@ void ComplexSchur<MatrixType>::reduceToTriangularForm(bool computeU)
bulge is chased down to the bottom of the active submatrix. */ bulge is chased down to the bottom of the active submatrix. */
ComplexScalar shift = computeShift(iu, iter); ComplexScalar shift = computeShift(iu, iter);
PlanarRotation<ComplexScalar> rot; JacobiRotation<ComplexScalar> rot;
rot.makeGivens(m_matT.coeff(il,il) - shift, m_matT.coeff(il+1,il)); rot.makeGivens(m_matT.coeff(il,il) - shift, m_matT.coeff(il+1,il));
m_matT.rightCols(m_matT.cols()-il).applyOnTheLeft(il, il+1, rot.adjoint()); m_matT.rightCols(m_matT.cols()-il).applyOnTheLeft(il, il+1, rot.adjoint());
m_matT.topRows(std::min(il+2,iu)+1).applyOnTheRight(il, il+1, rot); m_matT.topRows(std::min(il+2,iu)+1).applyOnTheRight(il, il+1, rot);

View File

@ -326,7 +326,7 @@ inline void RealSchur<MatrixType>::splitOffTwoRows(Index iu, bool computeU, Scal
if (q >= 0) // Two real eigenvalues if (q >= 0) // Two real eigenvalues
{ {
Scalar z = ei_sqrt(ei_abs(q)); Scalar z = ei_sqrt(ei_abs(q));
PlanarRotation<Scalar> rot; JacobiRotation<Scalar> rot;
if (p >= 0) if (p >= 0)
rot.makeGivens(p + z, m_matT.coeff(iu, iu-1)); rot.makeGivens(p + z, m_matT.coeff(iu, iu-1));
else else

View File

@ -438,7 +438,7 @@ static void ei_tridiagonal_qr_step(RealScalar* diag, RealScalar* subdiag, Index
for (Index k = start; k < end; ++k) for (Index k = start; k < end; ++k)
{ {
PlanarRotation<RealScalar> rot; JacobiRotation<RealScalar> rot;
rot.makeGivens(x, z); rot.makeGivens(x, z);
// do T = G' T G // do T = G' T G

View File

@ -28,8 +28,8 @@
/** \ingroup Jacobi_Module /** \ingroup Jacobi_Module
* \jacobi_module * \jacobi_module
* \class PlanarRotation * \class JacobiRotation
* \brief Represents a rotation in the plane from a cosine-sine pair. * \brief Represents a rotation given by a cosine-sine pair.
* *
* This class represents a Jacobi or Givens rotation. * This class represents a Jacobi or Givens rotation.
* This is a 2D rotation in the plane \c J of angle \f$ \theta \f$ defined by * This is a 2D rotation in the plane \c J of angle \f$ \theta \f$ defined by
@ -44,16 +44,16 @@
* *
* \sa MatrixBase::applyOnTheLeft(), MatrixBase::applyOnTheRight() * \sa MatrixBase::applyOnTheLeft(), MatrixBase::applyOnTheRight()
*/ */
template<typename Scalar> class PlanarRotation template<typename Scalar> class JacobiRotation
{ {
public: public:
typedef typename NumTraits<Scalar>::Real RealScalar; typedef typename NumTraits<Scalar>::Real RealScalar;
/** Default constructor without any initialization. */ /** Default constructor without any initialization. */
PlanarRotation() {} JacobiRotation() {}
/** Construct a planar rotation from a cosine-sine pair (\a c, \c s). */ /** Construct a planar rotation from a cosine-sine pair (\a c, \c s). */
PlanarRotation(const Scalar& c, const Scalar& s) : m_c(c), m_s(s) {} JacobiRotation(const Scalar& c, const Scalar& s) : m_c(c), m_s(s) {}
Scalar& c() { return m_c; } Scalar& c() { return m_c; }
Scalar c() const { return m_c; } Scalar c() const { return m_c; }
@ -61,17 +61,17 @@ template<typename Scalar> class PlanarRotation
Scalar s() const { return m_s; } Scalar s() const { return m_s; }
/** Concatenates two planar rotation */ /** Concatenates two planar rotation */
PlanarRotation operator*(const PlanarRotation& other) JacobiRotation operator*(const JacobiRotation& other)
{ {
return PlanarRotation(m_c * other.m_c - ei_conj(m_s) * other.m_s, return JacobiRotation(m_c * other.m_c - ei_conj(m_s) * other.m_s,
ei_conj(m_c * ei_conj(other.m_s) + ei_conj(m_s) * ei_conj(other.m_c))); ei_conj(m_c * ei_conj(other.m_s) + ei_conj(m_s) * ei_conj(other.m_c)));
} }
/** Returns the transposed transformation */ /** Returns the transposed transformation */
PlanarRotation transpose() const { return PlanarRotation(m_c, -ei_conj(m_s)); } JacobiRotation transpose() const { return JacobiRotation(m_c, -ei_conj(m_s)); }
/** Returns the adjoint transformation */ /** Returns the adjoint transformation */
PlanarRotation adjoint() const { return PlanarRotation(ei_conj(m_c), -m_s); } JacobiRotation adjoint() const { return JacobiRotation(ei_conj(m_c), -m_s); }
template<typename Derived> template<typename Derived>
bool makeJacobi(const MatrixBase<Derived>&, typename Derived::Index p, typename Derived::Index q); bool makeJacobi(const MatrixBase<Derived>&, typename Derived::Index p, typename Derived::Index q);
@ -92,7 +92,7 @@ template<typename Scalar> class PlanarRotation
* \sa MatrixBase::makeJacobi(const MatrixBase<Derived>&, Index, Index), MatrixBase::applyOnTheLeft(), MatrixBase::applyOnTheRight() * \sa MatrixBase::makeJacobi(const MatrixBase<Derived>&, Index, Index), MatrixBase::applyOnTheLeft(), MatrixBase::applyOnTheRight()
*/ */
template<typename Scalar> template<typename Scalar>
bool PlanarRotation<Scalar>::makeJacobi(RealScalar x, Scalar y, RealScalar z) bool JacobiRotation<Scalar>::makeJacobi(RealScalar x, Scalar y, RealScalar z)
{ {
typedef typename NumTraits<Scalar>::Real RealScalar; typedef typename NumTraits<Scalar>::Real RealScalar;
if(y == Scalar(0)) if(y == Scalar(0))
@ -129,11 +129,11 @@ bool PlanarRotation<Scalar>::makeJacobi(RealScalar x, Scalar y, RealScalar z)
* Example: \include Jacobi_makeJacobi.cpp * Example: \include Jacobi_makeJacobi.cpp
* Output: \verbinclude Jacobi_makeJacobi.out * Output: \verbinclude Jacobi_makeJacobi.out
* *
* \sa PlanarRotation::makeJacobi(RealScalar, Scalar, RealScalar), MatrixBase::applyOnTheLeft(), MatrixBase::applyOnTheRight() * \sa JacobiRotation::makeJacobi(RealScalar, Scalar, RealScalar), MatrixBase::applyOnTheLeft(), MatrixBase::applyOnTheRight()
*/ */
template<typename Scalar> template<typename Scalar>
template<typename Derived> template<typename Derived>
inline bool PlanarRotation<Scalar>::makeJacobi(const MatrixBase<Derived>& m, typename Derived::Index p, typename Derived::Index q) inline bool JacobiRotation<Scalar>::makeJacobi(const MatrixBase<Derived>& m, typename Derived::Index p, typename Derived::Index q)
{ {
return makeJacobi(ei_real(m.coeff(p,p)), m.coeff(p,q), ei_real(m.coeff(q,q))); return makeJacobi(ei_real(m.coeff(p,p)), m.coeff(p,q), ei_real(m.coeff(q,q)));
} }
@ -155,7 +155,7 @@ inline bool PlanarRotation<Scalar>::makeJacobi(const MatrixBase<Derived>& m, typ
* \sa MatrixBase::applyOnTheLeft(), MatrixBase::applyOnTheRight() * \sa MatrixBase::applyOnTheLeft(), MatrixBase::applyOnTheRight()
*/ */
template<typename Scalar> template<typename Scalar>
void PlanarRotation<Scalar>::makeGivens(const Scalar& p, const Scalar& q, Scalar* z) void JacobiRotation<Scalar>::makeGivens(const Scalar& p, const Scalar& q, Scalar* z)
{ {
makeGivens(p, q, z, typename ei_meta_if<NumTraits<Scalar>::IsComplex, ei_meta_true, ei_meta_false>::ret()); makeGivens(p, q, z, typename ei_meta_if<NumTraits<Scalar>::IsComplex, ei_meta_true, ei_meta_false>::ret());
} }
@ -163,7 +163,7 @@ void PlanarRotation<Scalar>::makeGivens(const Scalar& p, const Scalar& q, Scalar
// specialization for complexes // specialization for complexes
template<typename Scalar> template<typename Scalar>
void PlanarRotation<Scalar>::makeGivens(const Scalar& p, const Scalar& q, Scalar* r, ei_meta_true) void JacobiRotation<Scalar>::makeGivens(const Scalar& p, const Scalar& q, Scalar* r, ei_meta_true)
{ {
if(q==Scalar(0)) if(q==Scalar(0))
{ {
@ -218,7 +218,7 @@ void PlanarRotation<Scalar>::makeGivens(const Scalar& p, const Scalar& q, Scalar
// specialization for reals // specialization for reals
template<typename Scalar> template<typename Scalar>
void PlanarRotation<Scalar>::makeGivens(const Scalar& p, const Scalar& q, Scalar* r, ei_meta_false) void JacobiRotation<Scalar>::makeGivens(const Scalar& p, const Scalar& q, Scalar* r, ei_meta_false)
{ {
if(q==0) if(q==0)
@ -267,17 +267,17 @@ void PlanarRotation<Scalar>::makeGivens(const Scalar& p, const Scalar& q, Scalar
* \sa MatrixBase::applyOnTheLeft(), MatrixBase::applyOnTheRight() * \sa MatrixBase::applyOnTheLeft(), MatrixBase::applyOnTheRight()
*/ */
template<typename VectorX, typename VectorY, typename OtherScalar> template<typename VectorX, typename VectorY, typename OtherScalar>
void ei_apply_rotation_in_the_plane(VectorX& _x, VectorY& _y, const PlanarRotation<OtherScalar>& j); void ei_apply_rotation_in_the_plane(VectorX& _x, VectorY& _y, const JacobiRotation<OtherScalar>& j);
/** \jacobi_module /** \jacobi_module
* Applies the rotation in the plane \a j to the rows \a p and \a q of \c *this, i.e., it computes B = J * B, * Applies the rotation in the plane \a j to the rows \a p and \a q of \c *this, i.e., it computes B = J * B,
* with \f$ B = \left ( \begin{array}{cc} \text{*this.row}(p) \\ \text{*this.row}(q) \end{array} \right ) \f$. * with \f$ B = \left ( \begin{array}{cc} \text{*this.row}(p) \\ \text{*this.row}(q) \end{array} \right ) \f$.
* *
* \sa class PlanarRotation, MatrixBase::applyOnTheRight(), ei_apply_rotation_in_the_plane() * \sa class JacobiRotation, MatrixBase::applyOnTheRight(), ei_apply_rotation_in_the_plane()
*/ */
template<typename Derived> template<typename Derived>
template<typename OtherScalar> template<typename OtherScalar>
inline void MatrixBase<Derived>::applyOnTheLeft(Index p, Index q, const PlanarRotation<OtherScalar>& j) inline void MatrixBase<Derived>::applyOnTheLeft(Index p, Index q, const JacobiRotation<OtherScalar>& j)
{ {
RowXpr x(this->row(p)); RowXpr x(this->row(p));
RowXpr y(this->row(q)); RowXpr y(this->row(q));
@ -288,11 +288,11 @@ inline void MatrixBase<Derived>::applyOnTheLeft(Index p, Index q, const PlanarRo
* Applies the rotation in the plane \a j to the columns \a p and \a q of \c *this, i.e., it computes B = B * J * Applies the rotation in the plane \a j to the columns \a p and \a q of \c *this, i.e., it computes B = B * J
* with \f$ B = \left ( \begin{array}{cc} \text{*this.col}(p) & \text{*this.col}(q) \end{array} \right ) \f$. * with \f$ B = \left ( \begin{array}{cc} \text{*this.col}(p) & \text{*this.col}(q) \end{array} \right ) \f$.
* *
* \sa class PlanarRotation, MatrixBase::applyOnTheLeft(), ei_apply_rotation_in_the_plane() * \sa class JacobiRotation, MatrixBase::applyOnTheLeft(), ei_apply_rotation_in_the_plane()
*/ */
template<typename Derived> template<typename Derived>
template<typename OtherScalar> template<typename OtherScalar>
inline void MatrixBase<Derived>::applyOnTheRight(Index p, Index q, const PlanarRotation<OtherScalar>& j) inline void MatrixBase<Derived>::applyOnTheRight(Index p, Index q, const JacobiRotation<OtherScalar>& j)
{ {
ColXpr x(this->col(p)); ColXpr x(this->col(p));
ColXpr y(this->col(q)); ColXpr y(this->col(q));
@ -301,7 +301,7 @@ inline void MatrixBase<Derived>::applyOnTheRight(Index p, Index q, const PlanarR
template<typename VectorX, typename VectorY, typename OtherScalar> template<typename VectorX, typename VectorY, typename OtherScalar>
void /*EIGEN_DONT_INLINE*/ ei_apply_rotation_in_the_plane(VectorX& _x, VectorY& _y, const PlanarRotation<OtherScalar>& j) void /*EIGEN_DONT_INLINE*/ ei_apply_rotation_in_the_plane(VectorX& _x, VectorY& _y, const JacobiRotation<OtherScalar>& j)
{ {
typedef typename VectorX::Index Index; typedef typename VectorX::Index Index;
typedef typename VectorX::Scalar Scalar; typedef typename VectorX::Scalar Scalar;

View File

@ -479,7 +479,7 @@ struct ei_svd_precondition_2x2_block_to_be_real<MatrixType, QRPreconditioner, tr
static void run(typename SVD::WorkMatrixType& work_matrix, SVD& svd, Index p, Index q) static void run(typename SVD::WorkMatrixType& work_matrix, SVD& svd, Index p, Index q)
{ {
Scalar z; Scalar z;
PlanarRotation<Scalar> rot; JacobiRotation<Scalar> rot;
RealScalar n = ei_sqrt(ei_abs2(work_matrix.coeff(p,p)) + ei_abs2(work_matrix.coeff(q,p))); RealScalar n = ei_sqrt(ei_abs2(work_matrix.coeff(p,p)) + ei_abs2(work_matrix.coeff(q,p)));
if(n==0) if(n==0)
{ {
@ -514,13 +514,13 @@ struct ei_svd_precondition_2x2_block_to_be_real<MatrixType, QRPreconditioner, tr
template<typename MatrixType, typename RealScalar, typename Index> template<typename MatrixType, typename RealScalar, typename Index>
void ei_real_2x2_jacobi_svd(const MatrixType& matrix, Index p, Index q, void ei_real_2x2_jacobi_svd(const MatrixType& matrix, Index p, Index q,
PlanarRotation<RealScalar> *j_left, JacobiRotation<RealScalar> *j_left,
PlanarRotation<RealScalar> *j_right) JacobiRotation<RealScalar> *j_right)
{ {
Matrix<RealScalar,2,2> m; Matrix<RealScalar,2,2> m;
m << ei_real(matrix.coeff(p,p)), ei_real(matrix.coeff(p,q)), m << ei_real(matrix.coeff(p,p)), ei_real(matrix.coeff(p,q)),
ei_real(matrix.coeff(q,p)), ei_real(matrix.coeff(q,q)); ei_real(matrix.coeff(q,p)), ei_real(matrix.coeff(q,q));
PlanarRotation<RealScalar> rot1; JacobiRotation<RealScalar> rot1;
RealScalar t = m.coeff(0,0) + m.coeff(1,1); RealScalar t = m.coeff(0,0) + m.coeff(1,1);
RealScalar d = m.coeff(1,0) - m.coeff(0,1); RealScalar d = m.coeff(1,0) - m.coeff(0,1);
if(t == RealScalar(0)) if(t == RealScalar(0))
@ -584,7 +584,7 @@ JacobiSVD<MatrixType, QRPreconditioner>::compute(const MatrixType& matrix, unsig
// perform SVD decomposition of 2x2 sub-matrix corresponding to indices p,q to make it diagonal // perform SVD decomposition of 2x2 sub-matrix corresponding to indices p,q to make it diagonal
ei_svd_precondition_2x2_block_to_be_real<MatrixType, QRPreconditioner>::run(m_workMatrix, *this, p, q); ei_svd_precondition_2x2_block_to_be_real<MatrixType, QRPreconditioner>::run(m_workMatrix, *this, p, q);
PlanarRotation<RealScalar> j_left, j_right; JacobiRotation<RealScalar> j_left, j_right;
ei_real_2x2_jacobi_svd(m_workMatrix, p, q, &j_left, &j_right); ei_real_2x2_jacobi_svd(m_workMatrix, p, q, &j_left, &j_right);
// accumulate resulting Jacobi rotations // accumulate resulting Jacobi rotations

View File

@ -166,7 +166,7 @@ public :
} }
static EIGEN_DONT_INLINE void rot(gene_vector & A, gene_vector & B, real c, real s, int N){ static EIGEN_DONT_INLINE void rot(gene_vector & A, gene_vector & B, real c, real s, int N){
ei_apply_rotation_in_the_plane(A, B, PlanarRotation<real>(c,s)); ei_apply_rotation_in_the_plane(A, B, JacobiRotation<real>(c,s));
} }
static inline void atv_product(gene_matrix & A, gene_vector & B, gene_vector & X, int N){ static inline void atv_product(gene_matrix & A, gene_vector & B, gene_vector & X, int N){

View File

@ -233,9 +233,9 @@ int EIGEN_BLAS_FUNC(rot)(int *n, RealScalar *px, int *incx, RealScalar *py, int
Reverse<StridedVectorType> rvx(vx); Reverse<StridedVectorType> rvx(vx);
Reverse<StridedVectorType> rvy(vy); Reverse<StridedVectorType> rvy(vy);
if(*incx<0 && *incy>0) ei_apply_rotation_in_the_plane(rvx, vy, PlanarRotation<Scalar>(c,s)); if(*incx<0 && *incy>0) ei_apply_rotation_in_the_plane(rvx, vy, JacobiRotation<Scalar>(c,s));
else if(*incx>0 && *incy<0) ei_apply_rotation_in_the_plane(vx, rvy, PlanarRotation<Scalar>(c,s)); else if(*incx>0 && *incy<0) ei_apply_rotation_in_the_plane(vx, rvy, JacobiRotation<Scalar>(c,s));
else ei_apply_rotation_in_the_plane(vx, vy, PlanarRotation<Scalar>(c,s)); else ei_apply_rotation_in_the_plane(vx, vy, JacobiRotation<Scalar>(c,s));
return 0; return 0;
@ -293,7 +293,7 @@ int EIGEN_BLAS_FUNC(rotg)(RealScalar *pa, RealScalar *pb, RealScalar *pc, RealSc
} }
#endif #endif
// PlanarRotation<Scalar> r; // JacobiRotation<Scalar> r;
// r.makeGivens(a,b); // r.makeGivens(a,b);
// *c = r.c(); // *c = r.c();
// *s = r.s(); // *s = r.s();

View File

@ -1,5 +1,5 @@
Vector2f v = Vector2f::Random(); Vector2f v = Vector2f::Random();
PlanarRotation<float> G; JacobiRotation<float> G;
G.makeGivens(v.x(), v.y()); G.makeGivens(v.x(), v.y());
cout << "Here is the vector v:" << endl << v << endl; cout << "Here is the vector v:" << endl << v << endl;
v.applyOnTheLeft(0, 1, G.adjoint()); v.applyOnTheLeft(0, 1, G.adjoint());

View File

@ -1,6 +1,6 @@
Matrix2f m = Matrix2f::Random(); Matrix2f m = Matrix2f::Random();
m = (m + m.adjoint()).eval(); m = (m + m.adjoint()).eval();
PlanarRotation<float> J; JacobiRotation<float> J;
J.makeJacobi(m, 0, 1); J.makeJacobi(m, 0, 1);
cout << "Here is the matrix m:" << endl << m << endl; cout << "Here is the matrix m:" << endl << m << endl;
m.applyOnTheLeft(0, 1, J.adjoint()); m.applyOnTheLeft(0, 1, J.adjoint());

View File

@ -45,7 +45,7 @@ void jacobi(const MatrixType& m = MatrixType())
JacobiVector v = JacobiVector::Random().normalized(); JacobiVector v = JacobiVector::Random().normalized();
JacobiScalar c = v.x(), s = v.y(); JacobiScalar c = v.x(), s = v.y();
PlanarRotation<JacobiScalar> rot(c, s); JacobiRotation<JacobiScalar> rot(c, s);
{ {
Index p = ei_random<Index>(0, rows-1); Index p = ei_random<Index>(0, rows-1);

View File

@ -358,7 +358,7 @@ void MatrixFunction<MatrixType,1>::permuteSchur()
template <typename MatrixType> template <typename MatrixType>
void MatrixFunction<MatrixType,1>::swapEntriesInSchur(Index index) void MatrixFunction<MatrixType,1>::swapEntriesInSchur(Index index)
{ {
PlanarRotation<Scalar> rotation; JacobiRotation<Scalar> rotation;
rotation.makeGivens(m_T(index, index+1), m_T(index+1, index+1) - m_T(index, index)); rotation.makeGivens(m_T(index, index+1), m_T(index+1, index+1) - m_T(index, index));
m_T.applyOnTheLeft(index, index+1, rotation.adjoint()); m_T.applyOnTheLeft(index, index+1, rotation.adjoint());
m_T.applyOnTheRight(index, index+1, rotation); m_T.applyOnTheRight(index, index+1, rotation);

View File

@ -201,7 +201,7 @@ HybridNonLinearSolver<FunctorType,Scalar>::solveOneStep(FVectorType &x)
assert(x.size()==n); // check the caller is not cheating us assert(x.size()==n); // check the caller is not cheating us
Index j; Index j;
std::vector<PlanarRotation<Scalar> > v_givens(n), w_givens(n); std::vector<JacobiRotation<Scalar> > v_givens(n), w_givens(n);
jeval = true; jeval = true;
@ -440,7 +440,7 @@ HybridNonLinearSolver<FunctorType,Scalar>::solveNumericalDiffOneStep(FVectorType
assert(x.size()==n); // check the caller is not cheating us assert(x.size()==n); // check the caller is not cheating us
Index j; Index j;
std::vector<PlanarRotation<Scalar> > v_givens(n), w_givens(n); std::vector<JacobiRotation<Scalar> > v_givens(n), w_givens(n);
jeval = true; jeval = true;
if (parameters.nb_of_subdiagonals<0) parameters.nb_of_subdiagonals= n-1; if (parameters.nb_of_subdiagonals<0) parameters.nb_of_subdiagonals= n-1;

View File

@ -18,7 +18,7 @@ void ei_qrsolv(
Scalar temp; Scalar temp;
Index n = s.cols(); Index n = s.cols();
Matrix< Scalar, Dynamic, 1 > wa(n); Matrix< Scalar, Dynamic, 1 > wa(n);
PlanarRotation<Scalar> givens; JacobiRotation<Scalar> givens;
/* Function Body */ /* Function Body */
// the following will only change the lower triangular part of s, including // the following will only change the lower triangular part of s, including

View File

@ -2,7 +2,7 @@
// TODO : move this to GivensQR once there's such a thing in Eigen // TODO : move this to GivensQR once there's such a thing in Eigen
template <typename Scalar> template <typename Scalar>
void ei_r1mpyq(DenseIndex m, DenseIndex n, Scalar *a, const std::vector<PlanarRotation<Scalar> > &v_givens, const std::vector<PlanarRotation<Scalar> > &w_givens) void ei_r1mpyq(DenseIndex m, DenseIndex n, Scalar *a, const std::vector<JacobiRotation<Scalar> > &v_givens, const std::vector<JacobiRotation<Scalar> > &w_givens)
{ {
typedef DenseIndex Index; typedef DenseIndex Index;

View File

@ -3,8 +3,8 @@ template <typename Scalar>
void ei_r1updt( void ei_r1updt(
Matrix< Scalar, Dynamic, Dynamic > &s, Matrix< Scalar, Dynamic, Dynamic > &s,
const Matrix< Scalar, Dynamic, 1> &u, const Matrix< Scalar, Dynamic, 1> &u,
std::vector<PlanarRotation<Scalar> > &v_givens, std::vector<JacobiRotation<Scalar> > &v_givens,
std::vector<PlanarRotation<Scalar> > &w_givens, std::vector<JacobiRotation<Scalar> > &w_givens,
Matrix< Scalar, Dynamic, 1> &v, Matrix< Scalar, Dynamic, 1> &v,
Matrix< Scalar, Dynamic, 1> &w, Matrix< Scalar, Dynamic, 1> &w,
bool *sing) bool *sing)
@ -16,7 +16,7 @@ void ei_r1updt(
const Index n = s.cols(); const Index n = s.cols();
Index i, j=1; Index i, j=1;
Scalar temp; Scalar temp;
PlanarRotation<Scalar> givens; JacobiRotation<Scalar> givens;
// ei_r1updt had a broader usecase, but we dont use it here. And, more // ei_r1updt had a broader usecase, but we dont use it here. And, more
// importantly, we can not test it. // importantly, we can not test it.

View File

@ -10,7 +10,7 @@ void ei_rwupdt(
const Index n = r.cols(); const Index n = r.cols();
assert(r.rows()>=n); assert(r.rows()>=n);
std::vector<PlanarRotation<Scalar> > givens(n); std::vector<JacobiRotation<Scalar> > givens(n);
/* Local variables */ /* Local variables */
Scalar temp, rowj; Scalar temp, rowj;
@ -29,7 +29,7 @@ void ei_rwupdt(
if (rowj == 0.) if (rowj == 0.)
{ {
givens[j] = PlanarRotation<Scalar>(1,0); givens[j] = JacobiRotation<Scalar>(1,0);
continue; continue;
} }