30 #ifndef SPARSELU_PIVOTL_H 31 #define SPARSELU_PIVOTL_H 59 template <
typename Scalar,
typename StorageIndex>
64 Index nsupc = jcol - fsupc;
68 Scalar* lu_sup_ptr = &(glu.
lusup.data()[glu.
xlusup(fsupc)]);
69 Scalar* lu_col_ptr = &(glu.
lusup.data()[glu.
xlusup(jcol)]);
70 StorageIndex* lsub_ptr = &(glu.
lsub.data()[lptr]);
73 Index diagind = iperm_c(jcol);
78 Index isub, icol, itemp, k;
79 for (isub = nsupc; isub < nsupr; ++isub) {
81 rtemp =
abs(lu_col_ptr[isub]);
86 if (lsub_ptr[isub] == diagind) diag = isub;
92 pivrow = pivmax <
RealScalar(0.0) ? diagind : lsub_ptr[pivptr];
93 perm_r(pivrow) = StorageIndex(jcol);
107 rtemp =
abs(lu_col_ptr[diag]);
108 if (rtemp !=
RealScalar(0.0) && rtemp >= thresh) pivptr = diag;
110 pivrow = lsub_ptr[pivptr];
114 perm_r(pivrow) = StorageIndex(jcol);
116 if (pivptr != nsupc )
118 std::swap( lsub_ptr[pivptr], lsub_ptr[nsupc] );
121 for (icol = 0; icol <= nsupc; icol++)
123 itemp = pivptr + icol * lda;
124 std::swap(lu_sup_ptr[itemp], lu_sup_ptr[nsupc + icol * lda]);
128 Scalar temp = Scalar(1.0) / lu_col_ptr[nsupc];
129 for (k = nsupc+1; k < nsupr; k++)
130 lu_col_ptr[k] *= temp;
137 #endif // SPARSELU_PIVOTL_H
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const AbsReturnType abs() const
EIGEN_DEFAULT_DENSE_INDEX_TYPE Index
The Index type as used for the API.
Index pivotL(const Index jcol, const RealScalar &diagpivotthresh, IndexVector &perm_r, IndexVector &iperm_c, Index &pivrow, GlobalLU_t &glu)
Performs the numerical pivotin on the current column of L, and the CDIV operation.
ScalarVector::RealScalar RealScalar
void swap(mpfr::mpreal &x, mpfr::mpreal &y)