From aaaade4b3d66d67d2c08af3372c3965e7255b2e8 Mon Sep 17 00:00:00 2001 From: Benoit Jacob Date: Sun, 30 May 2010 16:00:58 -0400 Subject: the Index types change. As discussed on the list (too long to explain here). --- Eigen/src/Jacobi/Jacobi.h | 33 +++++++++++++++++---------------- 1 file changed, 17 insertions(+), 16 deletions(-) (limited to 'Eigen/src/Jacobi') diff --git a/Eigen/src/Jacobi/Jacobi.h b/Eigen/src/Jacobi/Jacobi.h index 024a130f2..f34e1836b 100644 --- a/Eigen/src/Jacobi/Jacobi.h +++ b/Eigen/src/Jacobi/Jacobi.h @@ -74,7 +74,7 @@ template class PlanarRotation PlanarRotation adjoint() const { return PlanarRotation(ei_conj(m_c), -m_s); } template - bool makeJacobi(const MatrixBase&, int p, int q); + bool makeJacobi(const MatrixBase&, typename Derived::Index p, typename Derived::Index q); bool makeJacobi(RealScalar x, Scalar y, RealScalar z); void makeGivens(const Scalar& p, const Scalar& q, Scalar* z=0); @@ -89,7 +89,7 @@ template class PlanarRotation /** Makes \c *this as a Jacobi rotation \a J such that applying \a J on both the right and left sides of the selfadjoint 2x2 matrix * \f$ B = \left ( \begin{array}{cc} x & y \\ \overline y & z \end{array} \right )\f$ yields a diagonal matrix \f$ A = J^* B J \f$ * - * \sa MatrixBase::makeJacobi(const MatrixBase&, int, int), MatrixBase::applyOnTheLeft(), MatrixBase::applyOnTheRight() + * \sa MatrixBase::makeJacobi(const MatrixBase&, Index, Index), MatrixBase::applyOnTheLeft(), MatrixBase::applyOnTheRight() */ template bool PlanarRotation::makeJacobi(RealScalar x, Scalar y, RealScalar z) @@ -133,7 +133,7 @@ bool PlanarRotation::makeJacobi(RealScalar x, Scalar y, RealScalar z) */ template template -inline bool PlanarRotation::makeJacobi(const MatrixBase& m, int p, int q) +inline bool PlanarRotation::makeJacobi(const MatrixBase& 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))); } @@ -277,7 +277,7 @@ void ei_apply_rotation_in_the_plane(VectorX& _x, VectorY& _y, const PlanarRotati */ template template -inline void MatrixBase::applyOnTheLeft(int p, int q, const PlanarRotation& j) +inline void MatrixBase::applyOnTheLeft(Index p, Index q, const PlanarRotation& j) { RowXpr x(this->row(p)); RowXpr y(this->row(q)); @@ -292,7 +292,7 @@ inline void MatrixBase::applyOnTheLeft(int p, int q, const PlanarRotati */ template template -inline void MatrixBase::applyOnTheRight(int p, int q, const PlanarRotation& j) +inline void MatrixBase::applyOnTheRight(Index p, Index q, const PlanarRotation& j) { ColXpr x(this->col(p)); ColXpr y(this->col(q)); @@ -303,11 +303,12 @@ inline void MatrixBase::applyOnTheRight(int p, int q, const PlanarRotat template void /*EIGEN_DONT_INLINE*/ ei_apply_rotation_in_the_plane(VectorX& _x, VectorY& _y, const PlanarRotation& j) { + typedef typename VectorX::Index Index; typedef typename VectorX::Scalar Scalar; ei_assert(_x.size() == _y.size()); - int size = _x.size(); - int incrx = size ==1 ? 1 : &_x.coeffRef(1) - &_x.coeffRef(0); - int incry = size ==1 ? 1 : &_y.coeffRef(1) - &_y.coeffRef(0); + Index size = _x.size(); + Index incrx = size ==1 ? 1 : &_x.coeffRef(1) - &_x.coeffRef(0); + Index incry = size ==1 ? 1 : &_y.coeffRef(1) - &_y.coeffRef(0); Scalar* EIGEN_RESTRICT x = &_x.coeffRef(0); Scalar* EIGEN_RESTRICT y = &_y.coeffRef(0); @@ -318,14 +319,14 @@ void /*EIGEN_DONT_INLINE*/ ei_apply_rotation_in_the_plane(VectorX& _x, VectorY& typedef typename ei_packet_traits::type Packet; enum { PacketSize = ei_packet_traits::size, Peeling = 2 }; - int alignedStart = ei_first_aligned(y, size); - int alignedEnd = alignedStart + ((size-alignedStart)/PacketSize)*PacketSize; + Index alignedStart = ei_first_aligned(y, size); + Index alignedEnd = alignedStart + ((size-alignedStart)/PacketSize)*PacketSize; const Packet pc = ei_pset1(Scalar(j.c())); const Packet ps = ei_pset1(Scalar(j.s())); ei_conj_helper::IsComplex,false> cj; - for(int i=0; i