568{
569 size_t n =
LU.numRows();
570
571
572
573 for (size_t j = 0; j < n; j++)
574 LU.ring().set(
LU.entry(j, m), v.
entry(P[j], 0));
575
576
579
580
581 for (size_t i = 0; i < m; i++)
582 LU.ring().set(
LU.entry(i, m),
x.entry(i, 0));
583
584
585 int pivotPosition = -1;
586
587 for (size_t j = m; j < n; j++)
588 if (!
LU.ring().is_zero(
LU.entry(j, m)))
589 {
590 pivotPosition = j;
591 break;
592 }
593
595
596 MatElementaryOps<DMat<RT>>::interchange_rows(
LU, pivotPosition, m);
598
599
600
601 for (int j = m + 1; j < n; j++)
602 LU.ring().divide(
LU.entry(j, m),
LU.entry(j, m),
LU.entry(m, m));
603
605}
ElementType & entry(size_t row, size_t column)
M2_arrayintOrNull LU(const Mat &A, Mat &L, Mat &U)
void triangularSolve(Mat &Lv, Mat &x, int m, int strategy)
void swap(mpfr::mpreal &x, mpfr::mpreal &y)
M2_arrayint stdvector_to_M2_arrayint(const std::vector< T > &v)