Macaulay2 Engine
Loading...
Searching...
No Matches

◆ setUpperLower()

template<class RingType>
void LUUtil< RingType >::setUpperLower ( const Mat & LU,
Mat & lower,
Mat & upper )
static

Definition at line 414 of file dmat-lu-inplace.hpp.

415{
416 size_t min = std::min(LU.numRows(), LU.numColumns());
417 lower.resize(LU.numRows(), min);
418 upper.resize(min, LU.numColumns());
419
420 // At this point, lower and upper should be zero matrices.
423
424 for (size_t c = 0; c < LU.numColumns(); c++)
425 {
426 if (c < min) LU.ring().set_from_long(lower.entry(c, c), 1);
427 for (size_t r = 0; r < LU.numRows(); r++)
428 {
429 if (r <= c)
430 LU.ring().set(upper.entry(r, c), LU.entry(r, c));
431 else if (c < lower.numRows())
432 {
433 LU.ring().set(lower.entry(r, c), LU.entry(r, c));
434 }
435 }
436 }
437}

References DMat< ACoeffRing >::entry(), MatrixOps::isZero(), DMat< ACoeffRing >::numRows(), and DMat< ACoeffRing >::resize().

Referenced by DMatLinAlg< M2::ARingQQ >::matrixPLU(), DMatLinAlg< M2::ARingZZpFFPACK >::matrixPLU(), and DMatLinAlg< M2::ARingZZpFlint >::matrixPLU().