11 #ifndef EIGEN_JACOBI_H
12 #define EIGEN_JACOBI_H
58 conj(
m_c * conj(other.
m_s) + conj(
m_s) * conj(other.
m_c)));
69 template<
typename Derived>
76 void makeGivens(
const Scalar& p,
const Scalar& q, Scalar* r=0);
92 template<
typename Scalar>
121 m_s = - sign_t * (numext::conj(
y) /
abs(
y)) *
abs(t) * n;
136 template<
typename Scalar>
137 template<
typename Derived>
160 template<
typename Scalar>
169 template<
typename Scalar>
183 else if(p==Scalar(0))
205 m_s = -qs*conj(ps)*(m_c/p2);
222 m_s = -conj(ps) * (q/u);
229 template<
typename Scalar>
237 m_c = p<Scalar(0) ? Scalar(-1) : Scalar(1);
241 else if(p==Scalar(0))
244 m_s = q<Scalar(0) ? Scalar(1) : Scalar(-1);
281 template<
typename VectorX,
typename VectorY,
typename OtherScalar>
292 template<
typename Derived>
293 template<
typename OtherScalar>
308 template<
typename Derived>
309 template<
typename OtherScalar>
320 template<
typename Scalar,
typename OtherScalar,
321 int SizeAtCompileTime,
int MinAlignment,
bool Vectorizable>
331 *x = c * xi + numext::conj(s) * yi;
332 *
y = -s * xi + numext::conj(c) * yi;
339 template<
typename Scalar,
typename OtherScalar,
340 int SizeAtCompileTime,
int MinAlignment>
353 if(SizeAtCompileTime ==
Dynamic && ((incrx==1 && incry==1) || PacketSize == 1))
356 enum { Peeling = 2 };
359 Index alignedEnd = alignedStart + ((
size-alignedStart)/PacketSize)*PacketSize;
361 const OtherPacket pc = pset1<OtherPacket>(c);
362 const OtherPacket ps = pset1<OtherPacket>(s);
366 for(
Index i=0; i<alignedStart; ++i)
370 x[i] = c * xi + numext::conj(s) * yi;
371 y[i] = -s * xi + numext::conj(c) * yi;
379 for(
Index i=alignedStart; i<alignedEnd; i+=PacketSize)
381 Packet xi = pload<Packet>(px);
382 Packet yi = pload<Packet>(py);
391 Index peelingEnd = alignedStart + ((
size-alignedStart)/(Peeling*PacketSize))*(Peeling*PacketSize);
392 for(
Index i=alignedStart; i<peelingEnd; i+=Peeling*PacketSize)
394 Packet xi = ploadu<Packet>(px);
395 Packet xi1 = ploadu<Packet>(px+PacketSize);
396 Packet yi = pload <Packet>(py);
397 Packet yi1 = pload <Packet>(py+PacketSize);
402 px += Peeling*PacketSize;
403 py += Peeling*PacketSize;
405 if(alignedEnd!=peelingEnd)
407 Packet xi = ploadu<Packet>(x+peelingEnd);
408 Packet yi = pload <Packet>(
y+peelingEnd);
418 x[i] = c * xi + numext::conj(s) * yi;
419 y[i] = -s * xi + numext::conj(c) * yi;
424 else if(SizeAtCompileTime !=
Dynamic && MinAlignment>0)
426 const OtherPacket pc = pset1<OtherPacket>(c);
427 const OtherPacket ps = pset1<OtherPacket>(s);
434 Packet xi = pload<Packet>(px);
435 Packet yi = pload<Packet>(py);
446 apply_rotation_in_the_plane_selector<Scalar,OtherScalar,SizeAtCompileTime,MinAlignment,false>::run(x,incrx,
y,incry,
size,c,s);
451 template<
typename VectorX,
typename VectorY,
typename OtherScalar>
455 typedef typename VectorX::Scalar Scalar;
461 Index incrx = xpr_x.derived().innerStride();
462 Index incry = xpr_y.derived().innerStride();
467 OtherScalar c = j.
c();
468 OtherScalar s = j.
s();
469 if (c==OtherScalar(1) && s==OtherScalar(0))
474 VectorX::SizeAtCompileTime,
476 Vectorizable>::run(x,incrx,
y,incry,
size,c,s);
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const AbsReturnType abs() const
Definition: ArrayCwiseUnaryOps.h:52
EIGEN_DEVICE_FUNC const SqrtReturnType sqrt() const
Definition: ArrayCwiseUnaryOps.h:187
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE ColXpr col(Index i)
This is the const version of col().
Definition: BlockMethods.h:1097
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE RowXpr row(Index i)
This is the const version of row(). */.
Definition: BlockMethods.h:1118
EIGEN_DEVICE_FUNC RealReturnType real() const
Definition: CommonCwiseUnaryOps.h:100
#define EIGEN_RESTRICT
Definition: Macros.h:1160
#define EIGEN_PLAIN_ENUM_MIN(a, b)
Definition: Macros.h:1288
#define EIGEN_DEVICE_FUNC
Definition: Macros.h:976
#define eigen_assert(x)
Definition: Macros.h:1037
Base class for all dense matrices, vectors, and arrays.
Definition: DenseBase.h:47
Rotation given by a cosine-sine pair.
Definition: Jacobi.h:35
EIGEN_DEVICE_FUNC Scalar & s()
Definition: Jacobi.h:49
EIGEN_DEVICE_FUNC void makeGivens(const Scalar &p, const Scalar &q, Scalar *r=0)
Definition: Jacobi.h:162
EIGEN_DEVICE_FUNC JacobiRotation transpose() const
Definition: Jacobi.h:63
Scalar m_c
Definition: Jacobi.h:84
EIGEN_DEVICE_FUNC Scalar c() const
Definition: Jacobi.h:48
EIGEN_DEVICE_FUNC JacobiRotation operator*(const JacobiRotation &other)
Definition: Jacobi.h:54
NumTraits< Scalar >::Real RealScalar
Definition: Jacobi.h:37
EIGEN_DEVICE_FUNC JacobiRotation()
Definition: Jacobi.h:41
EIGEN_DEVICE_FUNC Scalar & c()
Definition: Jacobi.h:47
EIGEN_DEVICE_FUNC JacobiRotation adjoint() const
Definition: Jacobi.h:67
EIGEN_DEVICE_FUNC Scalar s() const
Definition: Jacobi.h:50
EIGEN_DEVICE_FUNC JacobiRotation(const Scalar &c, const Scalar &s)
Definition: Jacobi.h:45
Scalar m_s
Definition: Jacobi.h:84
EIGEN_DEVICE_FUNC bool makeJacobi(const MatrixBase< Derived > &, Index p, Index q)
Definition: Jacobi.h:139
Base class for all dense matrices, vectors, and expressions.
Definition: MatrixBase.h:50
void applyOnTheLeft(const EigenBase< OtherDerived > &other)
Definition: MatrixBase.h:540
void applyOnTheRight(const EigenBase< OtherDerived > &other)
Definition: MatrixBase.h:528
Base::RowXpr RowXpr
Definition: MatrixBase.h:87
Base::ColXpr ColXpr
Definition: MatrixBase.h:88
const unsigned int PacketAccessBit
Definition: Constants.h:94
EIGEN_STRONG_INLINE EIGEN_DEVICE_FUNC bfloat16() min(const bfloat16 &a, const bfloat16 &b)
Definition: BFloat16.h:571
EIGEN_DEVICE_FUNC Packet padd(const Packet &a, const Packet &b)
Definition: GenericPacketMath.h:215
const Scalar & y
Definition: MathFunctions.h:821
static Index first_default_aligned(const DenseBase< Derived > &m)
Definition: DenseCoeffsBase.h:650
EIGEN_CONSTEXPR Index size(const T &x)
Definition: Meta.h:479
EIGEN_DEVICE_FUNC void pstore(Scalar *to, const Packet &from)
Definition: GenericPacketMath.h:696
EIGEN_DEVICE_FUNC void apply_rotation_in_the_plane(DenseBase< VectorX > &xpr_x, DenseBase< VectorY > &xpr_y, const JacobiRotation< OtherScalar > &j)
Definition: Jacobi.h:453
EIGEN_DEVICE_FUNC void pstoreu(Scalar *to, const Packet &from)
Definition: GenericPacketMath.h:700
EIGEN_DEVICE_FUNC Packet psub(const Packet &a, const Packet &b)
Definition: GenericPacketMath.h:222
EIGEN_DEVICE_FUNC bool abs2(bool x)
Definition: MathFunctions.h:1292
Namespace containing all symbols from the Eigen library.
Definition: LDLT.h:16
EIGEN_DEFAULT_DENSE_INDEX_TYPE Index
The Index type as used for the API.
Definition: Meta.h:74
const int Dynamic
Definition: Constants.h:22
type
The type the bitset is encoded with.
Definition: bitset.hpp:44
Flags
Special flags for archives.
Definition: cereal.hpp:185
Definition: document.h:416
Holds information about the various numeric (i.e. scalar) types allowed by Eigen.
Definition: NumTraits.h:233
static void run(Scalar *x, Index incrx, Scalar *y, Index incry, Index size, OtherScalar c, OtherScalar s)
Definition: Jacobi.h:343
static EIGEN_DEVICE_FUNC void run(Scalar *x, Index incrx, Scalar *y, Index incry, Index size, OtherScalar c, OtherScalar s)
Definition: Jacobi.h:325
Definition: ConjHelper.h:63
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE ResultType pmul(const LhsType &x, const RhsType &y) const
Definition: ConjHelper.h:71
Definition: CoreEvaluators.h:91
Definition: GenericPacketMath.h:107
T type
Definition: GenericPacketMath.h:108
Definition: PacketMath.h:47