30#ifndef SPARSELU_PIVOTL_H
31#define SPARSELU_PIVOTL_H
59template <
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;
ScalarVector::RealScalar RealScalar
Definition: SparseLUImpl.h:27
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.
Definition: SparseLU_pivotL.h:60
UnitType abs(const UnitType x) noexcept
Compute absolute value.
Definition: math.h:721
@ emptyIdxLU
Definition: SparseLU_Memory.h:38
Namespace containing all symbols from the Eigen library.
Definition: Core:141
EIGEN_DEFAULT_DENSE_INDEX_TYPE Index
The Index type as used for the API.
Definition: Meta.h:74
Definition: Eigen_Colamd.h:50
void swap(wpi::SmallPtrSet< T, N > &LHS, wpi::SmallPtrSet< T, N > &RHS)
Implement std::swap in terms of SmallPtrSet swap.
Definition: SmallPtrSet.h:512
Definition: SparseLU_Structs.h:77
IndexVector xsup
Definition: SparseLU_Structs.h:79
IndexVector xlusup
Definition: SparseLU_Structs.h:83
IndexVector supno
Definition: SparseLU_Structs.h:80
IndexVector lsub
Definition: SparseLU_Structs.h:82
IndexVector xlsub
Definition: SparseLU_Structs.h:84
ScalarVector lusup
Definition: SparseLU_Structs.h:81