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

◆ reorder_rows()

void F4GB::reorder_rows ( )
private

Definition at line 409 of file f4.cpp.

410{
411 int nrows = INTSIZE(mat->rows);
412 int ncols = INTSIZE(mat->columns);
414 std::vector<long> rowlocs; // 0..nrows-1 of where row as been placed
415
416 newrows.reserve(nrows);
417 rowlocs.reserve(nrows);
418 for (int r = 0; r < nrows; r++) rowlocs.push_back(-1);
419
420 for (int c = 0; c < ncols; c++)
421 {
422 int oldrow = mat->columns[c].head;
423 if (oldrow >= 0)
424 {
425 // Move the row into place
426 int newrow = INTSIZE(newrows);
427 newrows.push_back(mat->rows[oldrow]);
428 rowlocs[oldrow] = newrow;
429 mat->columns[c].head = newrow;
430 if (mat->columns[c].head == oldrow) mat->columns[c].head = newrow;
431 }
432 }
433 for (int r = 0; r < nrows; r++)
434 if (rowlocs[r] < 0) newrows.push_back(mat->rows[r]);
435 std::swap(mat->rows, newrows);
436}
coefficient_matrix * mat
Definition f4.hpp:186
void swap(mpfr::mpreal &x, mpfr::mpreal &y)
Definition mpreal.h:3244
std::vector< row_elem > row_array
Definition f4-types.hpp:175
#define INTSIZE(a)
Definition style.hpp:37

References INTSIZE, mat, and std::swap().