@@ -82,6 +82,7 @@ template<typename _MatrixType, int _UpLo> class LDLT
8282 * The default constructor is useful in cases in which the user intends to
8383 * perform decompositions via LDLT::compute(const MatrixType&).
8484 */
85+ EIGEN_DEVICE_FUNC
8586 LDLT ()
8687 : m_matrix(),
8788 m_transpositions (),
@@ -95,6 +96,7 @@ template<typename _MatrixType, int _UpLo> class LDLT
9596 * according to the specified problem \a size.
9697 * \sa LDLT()
9798 */
99+ EIGEN_DEVICE_FUNC
98100 explicit LDLT (Index size)
99101 : m_matrix(size, size),
100102 m_transpositions(size),
@@ -110,6 +112,7 @@ template<typename _MatrixType, int _UpLo> class LDLT
110112 * \sa LDLT(Index size)
111113 */
112114 template <typename InputType>
115+ EIGEN_DEVICE_FUNC
113116 explicit LDLT (const EigenBase<InputType>& matrix)
114117 : m_matrix(matrix.rows(), matrix.cols()),
115118 m_transpositions(matrix.rows()),
@@ -127,6 +130,7 @@ template<typename _MatrixType, int _UpLo> class LDLT
127130 * \sa LDLT(const EigenBase&)
128131 */
129132 template <typename InputType>
133+ EIGEN_DEVICE_FUNC
130134 explicit LDLT (EigenBase<InputType>& matrix)
131135 : m_matrix(matrix.derived()),
132136 m_transpositions(matrix.rows()),
@@ -140,19 +144,22 @@ template<typename _MatrixType, int _UpLo> class LDLT
140144 /* * Clear any existing decomposition
141145 * \sa rankUpdate(w,sigma)
142146 */
147+ EIGEN_DEVICE_FUNC
143148 void setZero ()
144149 {
145150 m_isInitialized = false ;
146151 }
147152
148153 /* * \returns a view of the upper triangular matrix U */
154+ EIGEN_DEVICE_FUNC
149155 inline typename Traits::MatrixU matrixU () const
150156 {
151157 eigen_assert (m_isInitialized && " LDLT is not initialized." );
152158 return Traits::getU (m_matrix);
153159 }
154160
155161 /* * \returns a view of the lower triangular matrix L */
162+ EIGEN_DEVICE_FUNC
156163 inline typename Traits::MatrixL matrixL () const
157164 {
158165 eigen_assert (m_isInitialized && " LDLT is not initialized." );
@@ -161,27 +168,31 @@ template<typename _MatrixType, int _UpLo> class LDLT
161168
162169 /* * \returns the permutation matrix P as a transposition sequence.
163170 */
171+ EIGEN_DEVICE_FUNC
164172 inline const TranspositionType& transpositionsP () const
165173 {
166174 eigen_assert (m_isInitialized && " LDLT is not initialized." );
167175 return m_transpositions;
168176 }
169177
170178 /* * \returns the coefficients of the diagonal matrix D */
179+ EIGEN_DEVICE_FUNC
171180 inline Diagonal<const MatrixType> vectorD () const
172181 {
173182 eigen_assert (m_isInitialized && " LDLT is not initialized." );
174183 return m_matrix.diagonal ();
175184 }
176185
177186 /* * \returns true if the matrix is positive (semidefinite) */
187+ EIGEN_DEVICE_FUNC
178188 inline bool isPositive () const
179189 {
180190 eigen_assert (m_isInitialized && " LDLT is not initialized." );
181191 return m_sign == internal::PositiveSemiDef || m_sign == internal::ZeroSign;
182192 }
183193
184194 /* * \returns true if the matrix is negative (semidefinite) */
195+ EIGEN_DEVICE_FUNC
185196 inline bool isNegative (void ) const
186197 {
187198 eigen_assert (m_isInitialized && " LDLT is not initialized." );
@@ -205,45 +216,53 @@ template<typename _MatrixType, int _UpLo> class LDLT
205216 * \sa MatrixBase::ldlt(), SelfAdjointView::ldlt()
206217 */
207218 template <typename Rhs>
219+ EIGEN_DEVICE_FUNC
208220 inline const Solve<LDLT, Rhs>
209221 solve (const MatrixBase<Rhs>& b) const ;
210222 #endif
211223
212224 template <typename Derived>
225+ EIGEN_DEVICE_FUNC
213226 bool solveInPlace (MatrixBase<Derived> &bAndX) const ;
214227
215228 template <typename InputType>
229+ EIGEN_DEVICE_FUNC
216230 LDLT& compute (const EigenBase<InputType>& matrix);
217231
218232 /* * \returns an estimate of the reciprocal condition number of the matrix of
219233 * which \c *this is the LDLT decomposition.
220234 */
235+ EIGEN_DEVICE_FUNC
221236 RealScalar rcond () const
222237 {
223238 eigen_assert (m_isInitialized && " LDLT is not initialized." );
224239 return internal::rcond_estimate_helper (m_l1_norm, *this );
225240 }
226241
227242 template <typename Derived>
243+ EIGEN_DEVICE_FUNC
228244 LDLT& rankUpdate (const MatrixBase<Derived>& w, const RealScalar& alpha=1 );
229245
230246 /* * \returns the internal LDLT decomposition matrix
231247 *
232248 * TODO: document the storage layout
233249 */
250+ EIGEN_DEVICE_FUNC
234251 inline const MatrixType& matrixLDLT () const
235252 {
236253 eigen_assert (m_isInitialized && " LDLT is not initialized." );
237254 return m_matrix;
238255 }
239256
257+ EIGEN_DEVICE_FUNC
240258 MatrixType reconstructedMatrix () const ;
241259
242260 /* * \returns the adjoint of \c *this, that is, a const reference to the decomposition itself as the underlying matrix is self-adjoint.
243261 *
244262 * This method is provided for compatibility with other matrix decompositions, thus enabling generic code such as:
245263 * \code x = decomposition.adjoint().solve(b) \endcode
246264 */
265+ EIGEN_DEVICE_FUNC
247266 const LDLT& adjoint () const { return *this ; };
248267
249268 EIGEN_DEVICE_FUNC inline Index rows () const { return m_matrix.rows (); }
@@ -254,6 +273,7 @@ template<typename _MatrixType, int _UpLo> class LDLT
254273 * \returns \c Success if computation was successful,
255274 * \c NumericalIssue if the factorization failed because of a zero pivot.
256275 */
276+ EIGEN_DEVICE_FUNC
257277 ComputationInfo info () const
258278 {
259279 eigen_assert (m_isInitialized && " LDLT is not initialized." );
@@ -262,6 +282,7 @@ template<typename _MatrixType, int _UpLo> class LDLT
262282
263283 #ifndef EIGEN_PARSED_BY_DOXYGEN
264284 template <typename RhsType, typename DstType>
285+ EIGEN_DEVICE_FUNC
265286 void _solve_impl (const RhsType &rhs, DstType &dst) const ;
266287
267288 template <bool Conjugate, typename RhsType, typename DstType>
@@ -270,6 +291,7 @@ template<typename _MatrixType, int _UpLo> class LDLT
270291
271292 protected:
272293
294+ EIGEN_DEVICE_FUNC
273295 static void check_template_parameters ()
274296 {
275297 EIGEN_STATIC_ASSERT_NON_INTEGER (Scalar);
@@ -297,6 +319,7 @@ template<int UpLo> struct ldlt_inplace;
297319template <> struct ldlt_inplace <Lower>
298320{
299321 template <typename MatrixType, typename TranspositionType, typename Workspace>
322+ EIGEN_DEVICE_FUNC
300323 static bool unblocked (MatrixType& mat, TranspositionType& transpositions, Workspace& temp, SignMatrix& sign)
301324 {
302325 using std::abs;
@@ -333,7 +356,7 @@ template<> struct ldlt_inplace<Lower>
333356 Index s = size-index_of_biggest_in_corner-1 ; // trailing size after the biggest element
334357 mat.row (k).head (k).swap (mat.row (index_of_biggest_in_corner).head (k));
335358 mat.col (k).tail (s).swap (mat.col (index_of_biggest_in_corner).tail (s));
336- std ::swap (mat.coeffRef (k,k),mat.coeffRef (index_of_biggest_in_corner,index_of_biggest_in_corner));
359+ numext ::swap (mat.coeffRef (k,k),mat.coeffRef (index_of_biggest_in_corner,index_of_biggest_in_corner));
337360 for (Index i=k+1 ;i<index_of_biggest_in_corner;++i)
338361 {
339362 Scalar tmp = mat.coeffRef (i,k);
@@ -410,6 +433,7 @@ template<> struct ldlt_inplace<Lower>
410433 // Here only rank-1 updates are implemented, to reduce the
411434 // requirement for intermediate storage and improve accuracy
412435 template <typename MatrixType, typename WDerived>
436+ EIGEN_DEVICE_FUNC
413437 static bool updateInPlace (MatrixType& mat, MatrixBase<WDerived>& w, const typename MatrixType::RealScalar& sigma=1 )
414438 {
415439 using numext::isfinite;
@@ -448,6 +472,7 @@ template<> struct ldlt_inplace<Lower>
448472 }
449473
450474 template <typename MatrixType, typename TranspositionType, typename Workspace, typename WType>
475+ EIGEN_DEVICE_FUNC
451476 static bool update (MatrixType& mat, const TranspositionType& transpositions, Workspace& tmp, const WType& w, const typename MatrixType::RealScalar& sigma=1 )
452477 {
453478 // Apply the permutation to the input w
@@ -460,13 +485,15 @@ template<> struct ldlt_inplace<Lower>
460485template <> struct ldlt_inplace <Upper>
461486{
462487 template <typename MatrixType, typename TranspositionType, typename Workspace>
488+ EIGEN_DEVICE_FUNC
463489 static EIGEN_STRONG_INLINE bool unblocked (MatrixType& mat, TranspositionType& transpositions, Workspace& temp, SignMatrix& sign)
464490 {
465491 Transpose<MatrixType> matt (mat);
466492 return ldlt_inplace<Lower>::unblocked (matt, transpositions, temp, sign);
467493 }
468494
469495 template <typename MatrixType, typename TranspositionType, typename Workspace, typename WType>
496+ EIGEN_DEVICE_FUNC
470497 static EIGEN_STRONG_INLINE bool update (MatrixType& mat, TranspositionType& transpositions, Workspace& tmp, WType& w, const typename MatrixType::RealScalar& sigma=1 )
471498 {
472499 Transpose<MatrixType> matt (mat);
@@ -478,15 +505,19 @@ template<typename MatrixType> struct LDLT_Traits<MatrixType,Lower>
478505{
479506 typedef const TriangularView<const MatrixType, UnitLower> MatrixL;
480507 typedef const TriangularView<const typename MatrixType::AdjointReturnType, UnitUpper> MatrixU;
508+ EIGEN_DEVICE_FUNC
481509 static inline MatrixL getL (const MatrixType& m) { return MatrixL (m); }
510+ EIGEN_DEVICE_FUNC
482511 static inline MatrixU getU (const MatrixType& m) { return MatrixU (m.adjoint ()); }
483512};
484513
485514template <typename MatrixType> struct LDLT_Traits <MatrixType,Upper>
486515{
487516 typedef const TriangularView<const typename MatrixType::AdjointReturnType, UnitLower> MatrixL;
488517 typedef const TriangularView<const MatrixType, UnitUpper> MatrixU;
518+ EIGEN_DEVICE_FUNC
489519 static inline MatrixL getL (const MatrixType& m) { return MatrixL (m.adjoint ()); }
520+ EIGEN_DEVICE_FUNC
490521 static inline MatrixU getU (const MatrixType& m) { return MatrixU (m); }
491522};
492523
@@ -496,6 +527,7 @@ template<typename MatrixType> struct LDLT_Traits<MatrixType,Upper>
496527 */
497528template <typename MatrixType, int _UpLo>
498529template <typename InputType>
530+ EIGEN_DEVICE_FUNC
499531LDLT<MatrixType,_UpLo>& LDLT<MatrixType,_UpLo>::compute(const EigenBase<InputType>& a)
500532{
501533 check_template_parameters ();
@@ -536,6 +568,7 @@ LDLT<MatrixType,_UpLo>& LDLT<MatrixType,_UpLo>::compute(const EigenBase<InputTyp
536568 */
537569template <typename MatrixType, int _UpLo>
538570template <typename Derived>
571+ EIGEN_DEVICE_FUNC
539572LDLT<MatrixType,_UpLo>& LDLT<MatrixType,_UpLo>::rankUpdate(const MatrixBase<Derived>& w, const typename LDLT<MatrixType,_UpLo>::RealScalar& sigma)
540573{
541574 typedef typename TranspositionType::StorageIndex IndexType;
@@ -564,6 +597,7 @@ LDLT<MatrixType,_UpLo>& LDLT<MatrixType,_UpLo>::rankUpdate(const MatrixBase<Deri
564597#ifndef EIGEN_PARSED_BY_DOXYGEN
565598template <typename _MatrixType, int _UpLo>
566599template <typename RhsType, typename DstType>
600+ EIGEN_DEVICE_FUNC
567601void LDLT<_MatrixType,_UpLo>::_solve_impl(const RhsType &rhs, DstType &dst) const
568602{
569603 _solve_impl_transposed<true >(rhs, dst);
@@ -626,6 +660,7 @@ void LDLT<_MatrixType,_UpLo>::_solve_impl_transposed(const RhsType &rhs, DstType
626660 */
627661template <typename MatrixType,int _UpLo>
628662template <typename Derived>
663+ EIGEN_DEVICE_FUNC
629664bool LDLT<MatrixType,_UpLo>::solveInPlace(MatrixBase<Derived> &bAndX) const
630665{
631666 eigen_assert (m_isInitialized && " LDLT is not initialized." );
@@ -640,6 +675,7 @@ bool LDLT<MatrixType,_UpLo>::solveInPlace(MatrixBase<Derived> &bAndX) const
640675 * i.e., it returns the product: P^T L D L^* P.
641676 * This function is provided for debug purpose. */
642677template <typename MatrixType, int _UpLo>
678+ EIGEN_DEVICE_FUNC
643679MatrixType LDLT<MatrixType,_UpLo>::reconstructedMatrix() const
644680{
645681 eigen_assert (m_isInitialized && " LDLT is not initialized." );
@@ -666,6 +702,7 @@ MatrixType LDLT<MatrixType,_UpLo>::reconstructedMatrix() const
666702 * \sa MatrixBase::ldlt()
667703 */
668704template <typename MatrixType, unsigned int UpLo>
705+ EIGEN_DEVICE_FUNC
669706inline const LDLT<typename SelfAdjointView<MatrixType, UpLo>::PlainObject, UpLo>
670707SelfAdjointView<MatrixType, UpLo>::ldlt() const
671708{
@@ -677,6 +714,7 @@ SelfAdjointView<MatrixType, UpLo>::ldlt() const
677714 * \sa SelfAdjointView::ldlt()
678715 */
679716template <typename Derived>
717+ EIGEN_DEVICE_FUNC
680718inline const LDLT<typename MatrixBase<Derived>::PlainObject>
681719MatrixBase<Derived>::ldlt() const
682720{
0 commit comments