# Presolve Matrix Manipulation Functions

## Functions
void | CoinPrePostsolveMatrix::presolve_make_memlists (int *lengths, presolvehlink *link, int n)
| Initialise linked list for major vector order in bulk storage.
bool | CoinPrePostsolveMatrix::presolve_expand_major (CoinBigIndex *majstrts, double *majels, int *minndxs, int *majlens, presolvehlink *majlinks, int nmaj, int k)
| Make sure a major-dimension vector k has room for one more coefficient.
bool | CoinPrePostsolveMatrix::presolve_expand_col (CoinBigIndex *mcstrt, double *colels, int *hrow, int *hincol, presolvehlink *clink, int ncols, int colx)
| Make sure a column (colx) in a column-major matrix has room for one more coefficient.
bool | CoinPrePostsolveMatrix::presolve_expand_row (CoinBigIndex *mrstrt, double *rowels, int *hcol, int *hinrow, presolvehlink *rlink, int nrows, int rowx)
| Make sure a row (rowx) in a row-major matrix has room for one more coefficient.
CoinBigIndex | CoinPrePostsolveMatrix::presolve_find_minor (int tgt, CoinBigIndex ks, CoinBigIndex ke, const int *minndxs)
| Find position of a minor index in a major vector.
CoinBigIndex | CoinPrePostsolveMatrix::presolve_find_row (int row, CoinBigIndex kcs, CoinBigIndex kce, const int *hrow)
| Find position of a row in a column in a column-major matrix.
CoinBigIndex | CoinPostsolveMatrix::presolve_find_col (int col, CoinBigIndex krs, CoinBigIndex kre, const int *hcol)
| Find position of a column in a row in a row-major matrix.
CoinBigIndex | CoinPrePostsolveMatrix::presolve_find_minor1 (int tgt, CoinBigIndex ks, CoinBigIndex ke, const int *minndxs)
| Find position of a minor index in a major vector.
CoinBigIndex | CoinPrePostsolveMatrix::presolve_find_row1 (int row, CoinBigIndex kcs, CoinBigIndex kce, const int *hrow)
| Find position of a row in a column in a column-major matrix.
CoinBigIndex | CoinPrePostsolveMatrix::presolve_find_col1 (int col, CoinBigIndex krs, CoinBigIndex kre, const int *hcol)
| Find position of a column in a row in a row-major matrix.
CoinBigIndex | CoinPostsolveMatrix::presolve_find_minor2 (int tgt, CoinBigIndex ks, int majlen, const int *minndxs, const CoinBigIndex *majlinks)
| Find position of a minor index in a major vector in a threaded matrix.
CoinBigIndex | CoinPostsolveMatrix::presolve_find_row2 (int row, CoinBigIndex kcs, int collen, const int *hrow, const CoinBigIndex *clinks)
| Find position of a row in a column in a column-major threaded matrix.
CoinBigIndex | CoinPostsolveMatrix::presolve_find_minor3 (int tgt, CoinBigIndex ks, int majlen, const int *minndxs, const CoinBigIndex *majlinks)
| Find position of a minor index in a major vector in a threaded matrix.
CoinBigIndex | CoinPostsolveMatrix::presolve_find_row3 (int row, CoinBigIndex kcs, int collen, const int *hrow, const CoinBigIndex *clinks)
| Find position of a row in a column in a column-major threaded matrix.
void | CoinPrePostsolveMatrix::presolve_delete_from_major (int majndx, int minndx, const CoinBigIndex *majstrts, int *majlens, int *minndxs, double *els)
| Delete the entry for a minor index from a major vector.
void | CoinPrePostsolveMatrix::presolve_delete_many_from_major (int majndx, char *marked, const CoinBigIndex *majstrts, int *majlens, int *minndxs, double *els)
| Delete marked entries.
void | CoinPrePostsolveMatrix::presolve_delete_from_col (int row, int col, const CoinBigIndex *mcstrt, int *hincol, int *hrow, double *colels)
| Delete the entry for row `row` from column `col` in a column-major matrix.
void | CoinPrePostsolveMatrix::presolve_delete_from_row (int row, int col, const CoinBigIndex *mrstrt, int *hinrow, int *hcol, double *rowels)
| Delete the entry for column `col` from row `row` in a row-major matrix.
void | CoinPostsolveMatrix::presolve_delete_from_major2 (int majndx, int minndx, CoinBigIndex *majstrts, int *majlens, int *minndxs, int *majlinks, CoinBigIndex *free_listp)
| Delete the entry for a minor index from a major vector in a threaded matrix.
void | CoinPostsolveMatrix::presolve_delete_from_col2 (int row, int col, CoinBigIndex *mcstrt, int *hincol, int *hrow, int *clinks, CoinBigIndex *free_listp)
| Delete the entry for row `row` from column `col` in a column-major threaded matrix.

## Detailed Description

Functions to work with the loosely packed and threaded packed matrix structures used during presolve and postsolve.

## Function Documentation

void presolve_make_memlists | ( | int * | lengths,
|  | presolvehlink * | link,
|  | int | n |
| ) |  |  | `[related, inherited]`

Initialise linked list for major vector order in bulk storage.

bool presolve_expand_major | ( | CoinBigIndex * | majstrts,
|  | double * | majels,
|  | int * | minndxs,
|  | int * | majlens,
|  | presolvehlink * | majlinks,
|  | int | nmaj,
|  | int | k |
| ) |  |  | `[related, inherited]`

Make sure a major-dimension vector k has room for one more coefficient.

You can use this directly, or use the inline wrappers presolve_expand_col and presolve_expand_row

bool presolve_expand_col | ( | CoinBigIndex * | mcstrt,
|  | double * | colels,
|  | int * | hrow,
|  | int * | hincol,
|  | presolvehlink * | clink,
|  | int | ncols,
|  | int | colx |
| ) |  |  | `[related, inherited]`

Make sure a column (colx) in a column-major matrix has room for one more coefficient.

Definition at line 1559 of file CoinPresolveMatrix.hpp.

bool presolve_expand_row | ( | CoinBigIndex * | mrstrt,
|  | double * | rowels,
|  | int * | hcol,
|  | int * | hinrow,
|  | presolvehlink * | rlink,
|  | int | nrows,
|  | int | rowx |
| ) |  |  | `[related, inherited]`

Make sure a row (rowx) in a row-major matrix has room for one more coefficient.

Definition at line 1570 of file CoinPresolveMatrix.hpp.

CoinBigIndex presolve_find_minor | ( | int | tgt,
|  | CoinBigIndex | ks,
|  | CoinBigIndex | ke,
|  | const int * | minndxs |
| ) |  |  | `[related, inherited]`

Find position of a minor index in a major vector.

The routine returns the position `k` in `minndxs` for the specified minor index `tgt`. It will abort if the entry does not exist. Can be used directly or via the inline wrappers presolve_find_row and presolve_find_col.

Definition at line 1585 of file CoinPresolveMatrix.hpp.

CoinBigIndex presolve_find_row | ( | int | row,
|  | CoinBigIndex | kcs,
|  | CoinBigIndex | kce,
|  | const int * | hrow |
| ) |  |  | `[related, inherited]`

Find position of a row in a column in a column-major matrix.

The routine returns the position `k` in `hrow` for the specified `row`. It will abort if the entry does not exist.

Definition at line 1609 of file CoinPresolveMatrix.hpp.

CoinBigIndex presolve_find_col | ( | int | col,
|  | CoinBigIndex | krs,
|  | CoinBigIndex | kre,
|  | const int * | hcol |
| ) |  |  | `[related, inherited]`

Find position of a column in a row in a row-major matrix.

The routine returns the position `k` in `hcol` for the specified `col`. It will abort if the entry does not exist.

Definition at line 1619 of file CoinPresolveMatrix.hpp.

CoinBigIndex presolve_find_minor1 | ( | int | tgt,
|  | CoinBigIndex | ks,
|  | CoinBigIndex | ke,
|  | const int * | minndxs |
| ) |  |  | `[related, inherited]`

Find position of a minor index in a major vector.

The routine returns the position `k` in `minndxs` for the specified minor index `tgt`. A return value of `ke` means the entry does not exist. Can be used directly or via the inline wrappers presolve_find_row1 and presolve_find_col1.

CoinBigIndex presolve_find_row1 | ( | int | row,
|  | CoinBigIndex | kcs,
|  | CoinBigIndex | kce,
|  | const int * | hrow |
| ) |  |  | `[related, inherited]`

Find position of a row in a column in a column-major matrix.

The routine returns the position `k` in `hrow` for the specified `row`. A return value of `kce` means the entry does not exist.

Definition at line 1641 of file CoinPresolveMatrix.hpp.

CoinBigIndex presolve_find_col1 | ( | int | col,
|  | CoinBigIndex | krs,
|  | CoinBigIndex | kre,
|  | const int * | hcol |
| ) |  |  | `[related, inherited]`

Find position of a column in a row in a row-major matrix.

The routine returns the position `k` in `hcol` for the specified `col`. A return value of `kre` means the entry does not exist.

Definition at line 1651 of file CoinPresolveMatrix.hpp.

CoinBigIndex presolve_find_minor2 | ( | int | tgt,
|  | CoinBigIndex | ks,
|  | int | majlen,
|  | const int * | minndxs,
|  | const CoinBigIndex * | majlinks |
| ) |  |  | `[related, inherited]`

Find position of a minor index in a major vector in a threaded matrix.

The routine returns the position `k` in `minndxs` for the specified minor index `tgt`. It will abort if the entry does not exist. Can be used directly or via the inline wrapper presolve_find_row2.

CoinBigIndex presolve_find_row2 | ( | int | row,
|  | CoinBigIndex | kcs,
|  | int | collen,
|  | const int * | hrow,
|  | const CoinBigIndex * | clinks |
| ) |  |  | `[related, inherited]`

Find position of a row in a column in a column-major threaded matrix.

The routine returns the position `k` in `hrow` for the specified `row`. It will abort if the entry does not exist.

Definition at line 1674 of file CoinPresolveMatrix.hpp.

CoinBigIndex presolve_find_minor3 | ( | int | tgt,
|  | CoinBigIndex | ks,
|  | int | majlen,
|  | const int * | minndxs,
|  | const CoinBigIndex * | majlinks |
| ) |  |  | `[related, inherited]`

Find position of a minor index in a major vector in a threaded matrix.

The routine returns the position `k` in `minndxs` for the specified minor index `tgt`. It will return -1 if the entry does not exist. Can be used directly or via the inline wrappers presolve_find_row3.

CoinBigIndex presolve_find_row3 | ( | int | row,
|  | CoinBigIndex | kcs,
|  | int | collen,
|  | const int * | hrow,
|  | const CoinBigIndex * | clinks |
| ) |  |  | `[related, inherited]`

Find position of a row in a column in a column-major threaded matrix.

The routine returns the position `k` in `hrow` for the specified `row`. It will return -1 if the entry does not exist.

Definition at line 1698 of file CoinPresolveMatrix.hpp.

void presolve_delete_from_major | ( | int | majndx,
|  | int | minndx,
|  | const CoinBigIndex * | majstrts,
|  | int * | majlens,
|  | int * | minndxs,
|  | double * | els |
| ) |  |  | `[related, inherited]`

Delete the entry for a minor index from a major vector.

Deletes the entry for `minndx` from the major vector `majndx`. Specifically, the relevant entries are removed from the minor index (`minndxs`) and coefficient (`els`) arrays and the vector length (`majlens`) is decremented. Loose packing is maintained by swapping the last entry in the row into the position occupied by the deleted entry.

Definition at line 1712 of file CoinPresolveMatrix.hpp.

void presolve_delete_many_from_major | ( | int | majndx,
|  | char * | marked,
|  | const CoinBigIndex * | majstrts,
|  | int * | majlens,
|  | int * | minndxs,
|  | double * | els |
| ) |  |  | `[related, inherited]`

Delete marked entries.

Removes the entries specified in `marked`, compressing the major vector to maintain loose packing. `marked` is cleared in the process.

Definition at line 1734 of file CoinPresolveMatrix.hpp.

void presolve_delete_from_col | ( | int | row,
|  | int | col,
|  | const CoinBigIndex * | mcstrt,
|  | int * | hincol,
|  | int * | hrow,
|  | double * | colels |
| ) |  |  | `[related, inherited]`

Delete the entry for row `row` from column `col` in a column-major matrix.

Deletes the entry for `row` from the major vector for `col`. Specifically, the relevant entries are removed from the row index (`hrow`) and coefficient (`colels`) arrays and the vector length (`hincol`) is decremented. Loose packing is maintained by swapping the last entry in the row into the position occupied by the deleted entry.

Definition at line 1764 of file CoinPresolveMatrix.hpp.

void presolve_delete_from_row | ( | int | row,
|  | int | col,
|  | const CoinBigIndex * | mrstrt,
|  | int * | hinrow,
|  | int * | hcol,
|  | double * | rowels |
| ) |  |  | `[related, inherited]`

Delete the entry for column `col` from row `row` in a row-major matrix.

Deletes the entry for `col` from the major vector for `row`. Specifically, the relevant entries are removed from the column index (`hcol`) and coefficient (`rowels`) arrays and the vector length (`hinrow`) is decremented. Loose packing is maintained by swapping the last entry in the column into the position occupied by the deleted entry.

Definition at line 1779 of file CoinPresolveMatrix.hpp.

void presolve_delete_from_major2 | ( | int | majndx,
|  | int | minndx,
|  | CoinBigIndex * | majstrts,
|  | int * | majlens,
|  | int * | minndxs,
|  | int * | majlinks,
|  | CoinBigIndex * | free_listp |
| ) |  |  | `[related, inherited]`

Delete the entry for a minor index from a major vector in a threaded matrix.

Deletes the entry for `minndx` from the major vector `majndx`. Specifically, the relevant entries are removed from the minor index (`minndxs`) and coefficient (`els`) arrays and the vector length (`majlens`) is decremented. The thread for the major vector is relinked around the deleted entry and the space is returned to the free list.

void presolve_delete_from_col2 | ( | int | row,
|  | int | col,
|  | CoinBigIndex * | mcstrt,
|  | int * | hincol,
|  | int * | hrow,
|  | int * | clinks,
|  | CoinBigIndex * | free_listp |
| ) |  |  | `[related, inherited]`

Delete the entry for row `row` from column `col` in a column-major threaded matrix.

Deletes the entry for `row` from the major vector for `col`. Specifically, the relevant entries are removed from the row index (`hrow`) and coefficient (`colels`) arrays and the vector length (`hincol`) is decremented. The thread for the major vector is relinked around the deleted entry and the space is returned to the free list.

Definition at line 1809 of file CoinPresolveMatrix.hpp.