11 #ifndef EIGEN_JACOBI_H    12 #define EIGEN_JACOBI_H    34 template<
typename Scalar> 
class JacobiRotation
    45     Scalar& 
c() { 
return m_c; }
    46     Scalar 
c()
 const { 
return m_c; }
    47     Scalar& 
s() { 
return m_s; }
    48     Scalar 
s()
 const { 
return m_s; }
    55                             conj(
m_c * conj(other.m_s) + conj(
m_s) * conj(other.m_c)));
    64     template<
typename Derived>
    66     bool makeJacobi(
const RealScalar& x, 
const Scalar& y, 
const RealScalar& z);
    68     void makeGivens(
const Scalar& p, 
const Scalar& q, Scalar* z=0);
    82 template<
typename Scalar>
    97     RealScalar tau = (x-z)/deno;
   110     m_s = - sign_t * (numext::conj(y) / 
abs(y)) * 
abs(t) * n;
   125 template<
typename Scalar>
   126 template<
typename Derived>
   148 template<
typename Scalar>
   156 template<
typename Scalar>
   169   else if(p==Scalar(0))
   191       m_s = -qs*conj(ps)*(
m_c/p2);
   208       m_s = -conj(ps) * (q/u);
   215 template<
typename Scalar>
   222     m_c = p<Scalar(0) ? Scalar(-1) : Scalar(1);
   226   else if(p==Scalar(0))
   229     m_s = q<Scalar(0) ? Scalar(1) : Scalar(-1);
   266 template<
typename VectorX, 
typename VectorY, 
typename OtherScalar>
   276 template<
typename Derived>
   277 template<
typename OtherScalar>
   291 template<
typename Derived>
   292 template<
typename OtherScalar>
   301 template<
typename VectorX, 
typename VectorY, 
typename OtherScalar>
   304   typedef typename VectorX::Scalar Scalar;
   308   Index size = xpr_x.size();
   309   Index incrx = xpr_x.derived().innerStride();
   310   Index incry = xpr_y.derived().innerStride();
   315   OtherScalar 
c = j.c();
   316   OtherScalar 
s = j.s();
   317   if (c==OtherScalar(1) && s==OtherScalar(0))
   322   if(VectorX::SizeAtCompileTime == 
Dynamic &&
   324     ((incrx==1 && incry==1) || PacketSize == 1))
   327     enum { Peeling = 2 };
   330     Index alignedEnd = alignedStart + ((size-alignedStart)/PacketSize)*PacketSize;
   332     const Packet pc = pset1<Packet>(
c);
   333     const Packet ps = pset1<Packet>(
s);
   336     for(
Index i=0; i<alignedStart; ++i)
   340       x[i] =  c * xi + numext::conj(s) * yi;
   341       y[i] = -s * xi + numext::conj(c) * yi;
   349       for(
Index i=alignedStart; i<alignedEnd; i+=PacketSize)
   351         Packet xi = pload<Packet>(px);
   352         Packet yi = pload<Packet>(py);
   361       Index peelingEnd = alignedStart + ((size-alignedStart)/(Peeling*PacketSize))*(Peeling*PacketSize);
   362       for(
Index i=alignedStart; i<peelingEnd; i+=Peeling*PacketSize)
   364         Packet xi   = ploadu<Packet>(px);
   365         Packet xi1  = ploadu<Packet>(px+PacketSize);
   366         Packet yi   = pload <Packet>(py);
   367         Packet yi1  = pload <Packet>(py+PacketSize);
   372         px += Peeling*PacketSize;
   373         py += Peeling*PacketSize;
   375       if(alignedEnd!=peelingEnd)
   377         Packet xi = ploadu<Packet>(x+peelingEnd);
   378         Packet yi = pload <Packet>(y+peelingEnd);
   384     for(
Index i=alignedEnd; i<size; ++i)
   388       x[i] =  c * xi + numext::conj(s) * yi;
   389       y[i] = -s * xi + numext::conj(c) * yi;
   394   else if(VectorX::SizeAtCompileTime != 
Dynamic &&
   395           (VectorX::Flags & VectorY::Flags & PacketAccessBit) &&
   398     const Packet pc = pset1<Packet>(
c);
   399     const Packet ps = pset1<Packet>(
s);
   403     for(
Index i=0; i<size; i+=PacketSize)
   405       Packet xi = pload<Packet>(px);
   406       Packet yi = pload<Packet>(py);
   417     for(
Index i=0; i<size; ++i)
   421       *x =  c * xi + numext::conj(s) * yi;
   422       *y = -s * xi + numext::conj(c) * yi;
   433 #endif // EIGEN_JACOBI_H 
JacobiRotation operator*(const JacobiRotation &other)
EIGEN_DEVICE_FUNC RealReturnType real() const
void applyOnTheLeft(const EigenBase< OtherDerived > &other)
void makeGivens(const Scalar &p, const Scalar &q, Scalar *z=0)
EIGEN_DEVICE_FUNC ColXpr col(Index i)
This is the const version of col(). */. 
JacobiRotation(const Scalar &c, const Scalar &s)
void applyOnTheRight(const EigenBase< OtherDerived > &other)
EIGEN_DEVICE_FUNC const SqrtReturnType sqrt() const
Rotation given by a cosine-sine pair. 
Holds information about the various numeric (i.e. scalar) types allowed by Eigen. ...
bool makeJacobi(const MatrixBase< Derived > &, Index p, Index q)
Base class for all dense matrices, vectors, and arrays. 
const unsigned int PacketAccessBit
static Index first_default_aligned(const DenseBase< Derived > &m)
EIGEN_DEVICE_FUNC Packet padd(const Packet &a, const Packet &b)
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const AbsReturnType abs() const
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const Abs2ReturnType abs2() const
EIGEN_DEVICE_FUNC void pstoreu(Scalar *to, const Packet &from)
EIGEN_DEFAULT_DENSE_INDEX_TYPE Index
The Index type as used for the API. 
EIGEN_DEVICE_FUNC void pstore(Scalar *to, const Packet &from)
NumTraits< Scalar >::Real RealScalar
Expression of a fixed-size or dynamic-size block. 
#define EIGEN_PLAIN_ENUM_MIN(a, b)
JacobiRotation transpose() const
EIGEN_DEVICE_FUNC RowXpr row(Index i)
This is the const version of row(). */. 
EIGEN_DEVICE_FUNC Packet psub(const Packet &a, const Packet &b)
void apply_rotation_in_the_plane(DenseBase< VectorX > &xpr_x, DenseBase< VectorY > &xpr_y, const JacobiRotation< OtherScalar > &j)
Base class for all dense matrices, vectors, and expressions. 
EIGEN_DEVICE_FUNC Packet pmul(const Packet &a, const Packet &b)
JacobiRotation adjoint() const