CMR  1.3.0
Classes | Functions
regular_nested_minor_sequence.c File Reference
#include "dec_internal.h"
#include "regular_internal.h"
#include "env_internal.h"
#include "densematrix.h"
#include "hashtable.h"
#include <time.h>

Classes

struct  ElementData
 Element specific data for the enumeration of 3-separations. More...
 

Functions

static CMR_ERROR createHashVector (CMR *cmr, long long **phashVector, size_t size)
 
static CMR_ERROR initializeHashing (CMR *cmr, DenseBinaryMatrix *dense, ElementData *majorData, CMR_LISTHASHTABLE *majorHashtable, size_t numMajors, size_t *processedMinors, size_t numProcessedMinors, long long *hashVector, bool isRow)
 
static CMR_ERROR updateRepresentative (CMR *cmr, DenseBinaryMatrix *dense, ElementData *majorData, CMR_LISTHASHTABLE *majorHashtable, size_t *processedMinors, size_t numProcessedMinors, size_t majorIndex, bool isRow)
 Ensures that the representative entry for row/column index is correct. More...
 
static CMR_ERROR updateHashtable (CMR *cmr, ElementData *majorData, size_t *processedMajors, size_t numProcessedMajors, CMR_LISTHASHTABLE *majorHashtable)
 
static CMR_ERROR prepareSearch (CMR *cmr, DenseBinaryMatrix *matrix, ElementData *rowData, ElementData *columnData, CMR_ELEMENT *pstartElement)
 
static CMR_ERROR searchShortestPath (CMR *cmr, DenseBinaryMatrix *dense, ElementData *rowData, ElementData *columnData, CMR_ELEMENT *preachedTarget)
 
static CMR_ERROR pivot (CMR *cmr, DenseBinaryMatrix *dense, size_t pivotRow, size_t pivotColumn)
 
static CMR_ERROR applyPivots (CMR *cmr, DenseBinaryMatrix *dense, ElementData *rowData, ElementData *columnData, CMR_ELEMENT reachedTarget, CMR_ELEMENT *newElements)
 
static CMR_ERROR addElement (CMR *cmr, CMR_DEC *dec, DenseBinaryMatrix *dense, ElementData *majorData, ElementData *minorData, CMR_LISTHASHTABLE *minorHashtable, long long *hashVector, size_t numMinor, size_t *processedMajors, size_t *pnumProcessedMajors, size_t newMajor, size_t *nestedMinorsElements, bool isRow)
 
static CMR_ELEMENT mapGivenToOriginal (CMR_DEC *dec, CMR_ELEMENT given)
 Maps an element from the matrix given the extension algorithm to the element of the original node's matrix. More...
 
static CMR_ERROR combineMaps (CMR_DEC *dec, size_t *nestedMinorsElements, size_t numElements, ElementData *elementData, CMR_ELEMENT *combinedMap)
 Computes the mapping rows/columns to elements of the original matrix. More...
 
static CMR_ERROR extendNestedMinorSequence (CMR *cmr, CMR_DEC *dec, bool ternary, DenseBinaryMatrix *dense, size_t *nestedMinorsRows, size_t *nestedMinorsColumns, CMR_SUBMAT **psubmatrix, CMR_REGULAR_STATISTICS *stats, double timeLimit)
 Continues the construction of a sequence of nested 3-connected minors for the matrix of a decomposition node. More...
 
CMR_ERROR CMRregularConstructNestedMinorSequence (CMR *cmr, CMR_DEC *dec, bool ternary, CMR_SUBMAT *wheelSubmatrix, CMR_SUBMAT **psubmatrix, CMR_REGULAR_STATISTICS *stats, double timeLimit)
 Constructs a sequence of nested 3-connected minors for the matrix of a decomposition node. More...
 
CMR_ERROR CMRregularExtendNestedMinorSequence (CMR *cmr, CMR_DEC *dec, bool ternary, CMR_SUBMAT **psubmatrix, CMR_REGULAR_STATISTICS *stats, double timeLimit)
 Extends an incomplete sequence of nested 3-connected minors for the matrix of a decomposition node. More...
 

Function Documentation

◆ addElement()

static CMR_ERROR addElement ( CMR cmr,
CMR_DEC dec,
DenseBinaryMatrix dense,
ElementData majorData,
ElementData minorData,
CMR_LISTHASHTABLE minorHashtable,
long long *  hashVector,
size_t  numMinor,
size_t *  processedMajors,
size_t *  pnumProcessedMajors,
size_t  newMajor,
size_t *  nestedMinorsElements,
bool  isRow 
)
static
Parameters
cmrCMR environment.
decDecomposition node.
denseMatrix.
majorDataMajor index data.
minorDataMinor index data.
minorHashtableMinor index hashtable.
hashVectorHash vector.
numMinorNumber of minor indices.
processedMajorsArray of processed major indices.
pnumProcessedMajorsPointer to number of processed major indices.
newMajorMajor index to add.
nestedMinorsElementsMapping from nested minor elements to elements of matrix.
isRowWhether major means row.

◆ applyPivots()

static CMR_ERROR applyPivots ( CMR cmr,
DenseBinaryMatrix dense,
ElementData rowData,
ElementData columnData,
CMR_ELEMENT  reachedTarget,
CMR_ELEMENT newElements 
)
static
Parameters
cmrCMR environment.
denseRemaining matrix.
rowDataRow data.
columnDataColumn data.
reachedTargetReached target row/column.
newElementsArray of length 3 for storing the new elements (followed by 0s).

◆ CMRregularConstructNestedMinorSequence()

CMR_ERROR CMRregularConstructNestedMinorSequence ( CMR cmr,
CMR_DEC dec,
bool  ternary,
CMR_SUBMAT wheelSubmatrix,
CMR_SUBMAT **  psubmatrix,
CMR_REGULAR_STATISTICS stats,
double  timeLimit 
)

Constructs a sequence of nested 3-connected minors for the matrix of a decomposition node.

In case the matrix is not 3-connected, a 2-separation is applied to dec and the function terminates, filling the relevant variables of dec.

Parameters
cmrCMR environment.
decDecomposition node.
ternaryWhether to consider the signs of the matrix.
wheelSubmatrixWheel submatrix to start with.
psubmatrixPointer for storing a violator matrix.
statsStatistics for the computation (may be NULL).
timeLimitTime limit to impose.

◆ CMRregularExtendNestedMinorSequence()

CMR_ERROR CMRregularExtendNestedMinorSequence ( CMR cmr,
CMR_DEC dec,
bool  ternary,
CMR_SUBMAT **  psubmatrix,
CMR_REGULAR_STATISTICS stats,
double  timeLimit 
)

Extends an incomplete sequence of nested 3-connected minors for the matrix of a decomposition node.

In case the matrix is not 3-connected, a 2-separation is applied to dec and the function terminates, filling the relevant variables of dec.

Parameters
cmrCMR environment.
decDecomposition node.
ternaryWhether to consider the signs of the matrix.
psubmatrixPointer for storing a violator matrix.
statsStatistics for the computation (may be NULL).
timeLimitTime limit to impose.

◆ combineMaps()

static CMR_ERROR combineMaps ( CMR_DEC dec,
size_t *  nestedMinorsElements,
size_t  numElements,
ElementData elementData,
CMR_ELEMENT combinedMap 
)
static

Computes the mapping rows/columns to elements of the original matrix.

First, using nestedMinorsElements, the index of the nested sequence is mapped to that of the dense matrix. Second, using elementData, the corresponding element of the matrix passed to the nested minor extension algorithm is determined (which may have changed since pivots exchange elements). Third, using nestedMinorsRowsOriginal or nestedMinorsColumnsOriginal of dec, the element of the matrix that was passed is mapped to the element of the original matrix.

Parameters
decDecomposition node.
nestedMinorsElementsMapping from rows/columns of nested minor sequence to rows/columns of dense matrix.
numElementsNumber of rows/columns in nested minor sequence.
elementDataElement data for rows/columns.
combinedMapComputed map.

◆ createHashVector()

static CMR_ERROR createHashVector ( CMR cmr,
long long **  phashVector,
size_t  size 
)
static
Parameters
cmrCMR environment.
phashVectorPointer for storing the hash vector.
sizeSize of hash vector.

◆ extendNestedMinorSequence()

static CMR_ERROR extendNestedMinorSequence ( CMR cmr,
CMR_DEC dec,
bool  ternary,
DenseBinaryMatrix dense,
size_t *  nestedMinorsRows,
size_t *  nestedMinorsColumns,
CMR_SUBMAT **  psubmatrix,
CMR_REGULAR_STATISTICS stats,
double  timeLimit 
)
static

Continues the construction of a sequence of nested 3-connected minors for the matrix of a decomposition node.

In case the matrix is not 3-connected, a 2-separation is applied to dec and the function terminates, filling the relevant variables of dec.

Parameters
cmrCMR environment.
decDecomposition node.
ternaryWhether to consider the signs of the matrix.
denseDense matrix.
nestedMinorsRowsMapping of rows of the nested minor sequence to rows of dense.
nestedMinorsColumnsMapping of columns of the nested minor sequence to columns of dense.
psubmatrixPointer for storing a violator matrix.
statsStatistics for the computation (may be NULL).
timeLimitTime limit to impose.

◆ initializeHashing()

static CMR_ERROR initializeHashing ( CMR cmr,
DenseBinaryMatrix dense,
ElementData majorData,
CMR_LISTHASHTABLE majorHashtable,
size_t  numMajors,
size_t *  processedMinors,
size_t  numProcessedMinors,
long long *  hashVector,
bool  isRow 
)
static
Parameters
cmrCMR environment.
denseMatrix.
majorDataMajor index data.
majorHashtableMajor index hashtable.
numMajorsNumber of major indices.
processedMinorsArray with processed minor indices.
numProcessedMinorsNumber of processed minor indices.
hashVectorHash vector.
isRowWhether major means row.

◆ mapGivenToOriginal()

static CMR_ELEMENT mapGivenToOriginal ( CMR_DEC dec,
CMR_ELEMENT  given 
)
static

Maps an element from the matrix given the extension algorithm to the element of the original node's matrix.

Parameters
decDecomposition node.
givenSome element from the given matrix.

◆ pivot()

static CMR_ERROR pivot ( CMR cmr,
DenseBinaryMatrix dense,
size_t  pivotRow,
size_t  pivotColumn 
)
static
Parameters
cmrCMR environment.
denseRemaining matrix.
pivotRowPivot row.
pivotColumnPivot column.

◆ prepareSearch()

static CMR_ERROR prepareSearch ( CMR cmr,
DenseBinaryMatrix matrix,
ElementData rowData,
ElementData columnData,
CMR_ELEMENT pstartElement 
)
static
Parameters
cmrCMR environment.
matrixNested matrix.
rowDataRow data.
columnDataColumn data.
pstartElementPointer for storing an element for starting the search.

◆ searchShortestPath()

static CMR_ERROR searchShortestPath ( CMR cmr,
DenseBinaryMatrix dense,
ElementData rowData,
ElementData columnData,
CMR_ELEMENT preachedTarget 
)
static
Parameters
cmrCMR environment.
denseRemaining matrix.
rowDataRow data.
columnDataColumn data.
preachedTargetPointer for storing the reached target row/column.

◆ updateHashtable()

static CMR_ERROR updateHashtable ( CMR cmr,
ElementData majorData,
size_t *  processedMajors,
size_t  numProcessedMajors,
CMR_LISTHASHTABLE majorHashtable 
)
static
Parameters
cmrCMR environment.
majorDataMajor index data.
processedMajorsArray of processed major indices.
numProcessedMajorsNumber of processed major indices.
majorHashtableMajor index hashtable.

◆ updateRepresentative()

static CMR_ERROR updateRepresentative ( CMR cmr,
DenseBinaryMatrix dense,
ElementData majorData,
CMR_LISTHASHTABLE majorHashtable,
size_t *  processedMinors,
size_t  numProcessedMinors,
size_t  majorIndex,
bool  isRow 
)
static

Ensures that the representative entry for row/column index is correct.

Checks the respective hashtable.

Parameters
cmrCMR environment.
denseMatrix.
majorDataMajor index data.
majorHashtableMajor index hashtable.
processedMinorsArray of processed minor indices.
numProcessedMinorsNumber of processed minor indices.
majorIndexMajor index to update.
isRowWhether major means rows.