mirror of
https://gitlab.com/libeigen/eigen.git
synced 2025-08-12 11:49:02 +08:00
Make NoAlias and JacobiRotation compatible with CUDA.
This commit is contained in:
parent
1f4b24d2df
commit
687bedfcad
@ -296,7 +296,7 @@ template<typename Derived> class MatrixBase
|
||||
EIGEN_DEVICE_FUNC inline bool operator!=(const MatrixBase<OtherDerived>& other) const
|
||||
{ return cwiseNotEqual(other).any(); }
|
||||
|
||||
NoAlias<Derived,Eigen::MatrixBase > noalias();
|
||||
NoAlias<Derived,Eigen::MatrixBase > EIGEN_DEVICE_FUNC noalias();
|
||||
|
||||
// TODO forceAlignedAccess is temporarily disabled
|
||||
// Need to find a nicer workaround.
|
||||
@ -428,8 +428,10 @@ template<typename Derived> class MatrixBase
|
||||
///////// Jacobi module /////////
|
||||
|
||||
template<typename OtherScalar>
|
||||
EIGEN_DEVICE_FUNC
|
||||
void applyOnTheLeft(Index p, Index q, const JacobiRotation<OtherScalar>& j);
|
||||
template<typename OtherScalar>
|
||||
EIGEN_DEVICE_FUNC
|
||||
void applyOnTheRight(Index p, Index q, const JacobiRotation<OtherScalar>& j);
|
||||
|
||||
///////// SparseCore module /////////
|
||||
|
@ -33,6 +33,7 @@ class NoAlias
|
||||
public:
|
||||
typedef typename ExpressionType::Scalar Scalar;
|
||||
|
||||
EIGEN_DEVICE_FUNC
|
||||
explicit NoAlias(ExpressionType& expression) : m_expression(expression) {}
|
||||
|
||||
template<typename OtherDerived>
|
||||
|
@ -37,17 +37,20 @@ template<typename Scalar> class JacobiRotation
|
||||
typedef typename NumTraits<Scalar>::Real RealScalar;
|
||||
|
||||
/** Default constructor without any initialization. */
|
||||
EIGEN_DEVICE_FUNC
|
||||
JacobiRotation() {}
|
||||
|
||||
/** Construct a planar rotation from a cosine-sine pair (\a c, \c s). */
|
||||
EIGEN_DEVICE_FUNC
|
||||
JacobiRotation(const Scalar& c, const Scalar& s) : m_c(c), m_s(s) {}
|
||||
|
||||
Scalar& c() { return m_c; }
|
||||
Scalar c() const { return m_c; }
|
||||
Scalar& s() { return m_s; }
|
||||
Scalar s() const { return m_s; }
|
||||
EIGEN_DEVICE_FUNC Scalar& c() { return m_c; }
|
||||
EIGEN_DEVICE_FUNC Scalar c() const { return m_c; }
|
||||
EIGEN_DEVICE_FUNC Scalar& s() { return m_s; }
|
||||
EIGEN_DEVICE_FUNC Scalar s() const { return m_s; }
|
||||
|
||||
/** Concatenates two planar rotation */
|
||||
EIGEN_DEVICE_FUNC
|
||||
JacobiRotation operator*(const JacobiRotation& other)
|
||||
{
|
||||
using numext::conj;
|
||||
@ -56,19 +59,26 @@ template<typename Scalar> class JacobiRotation
|
||||
}
|
||||
|
||||
/** Returns the transposed transformation */
|
||||
EIGEN_DEVICE_FUNC
|
||||
JacobiRotation transpose() const { using numext::conj; return JacobiRotation(m_c, -conj(m_s)); }
|
||||
|
||||
/** Returns the adjoint transformation */
|
||||
EIGEN_DEVICE_FUNC
|
||||
JacobiRotation adjoint() const { using numext::conj; return JacobiRotation(conj(m_c), -m_s); }
|
||||
|
||||
template<typename Derived>
|
||||
EIGEN_DEVICE_FUNC
|
||||
bool makeJacobi(const MatrixBase<Derived>&, Index p, Index q);
|
||||
EIGEN_DEVICE_FUNC
|
||||
bool makeJacobi(const RealScalar& x, const Scalar& y, const RealScalar& z);
|
||||
|
||||
EIGEN_DEVICE_FUNC
|
||||
void makeGivens(const Scalar& p, const Scalar& q, Scalar* z=0);
|
||||
|
||||
protected:
|
||||
EIGEN_DEVICE_FUNC
|
||||
void makeGivens(const Scalar& p, const Scalar& q, Scalar* z, internal::true_type);
|
||||
EIGEN_DEVICE_FUNC
|
||||
void makeGivens(const Scalar& p, const Scalar& q, Scalar* z, internal::false_type);
|
||||
|
||||
Scalar m_c, m_s;
|
||||
@ -264,6 +274,7 @@ namespace internal {
|
||||
* \sa MatrixBase::applyOnTheLeft(), MatrixBase::applyOnTheRight()
|
||||
*/
|
||||
template<typename VectorX, typename VectorY, typename OtherScalar>
|
||||
EIGEN_DEVICE_FUNC
|
||||
void apply_rotation_in_the_plane(DenseBase<VectorX>& xpr_x, DenseBase<VectorY>& xpr_y, const JacobiRotation<OtherScalar>& j);
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user