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

◆ setUpperLower()

void DMatLinAlg< M2::ARingZZpFlint >::setUpperLower ( const Mat & LU,
Mat & lower,
Mat & upper )
private

Definition at line 108 of file dmat-lu.hpp.

272{
273 size_t min = std::min(LU.numRows(), LU.numColumns());
274 lower.resize(LU.numRows(), min);
275 upper.resize(min, LU.numColumns());
276
277 // At this point, lower and upper should be zero matrices.
280
281 for (size_t c = 0; c < LU.numColumns(); c++)
282 {
283 if (c < min) ring().set_from_long(lower.entry(c, c), 1);
284 for (size_t r = 0; r < LU.numRows(); r++)
285 {
286 if (r <= c)
287 ring().set(upper.entry(r, c), LU.entry(r, c));
288 else if (c < lower.numRows())
289 {
290 ring().set(lower.entry(r, c), LU.entry(r, c));
291 }
292 }
293 }
294}
const M2::ARingZZpFlint & ring() const
Definition dmat-lu.hpp:107
void set(ElementType &result, ElementType a) const
void set_from_long(ElementType &result, long a) const