CMR  1.3.0
Classes | Functions
matroid_internal.h File Reference
#include "densematrix.h"
#include <cmr/matroid.h>
#include <cmr/series_parallel.h>

Go to the source code of this file.

Classes

struct  _CMR_MATROID_DEC
 

Functions

char * CMRmatroiddecConsistency (CMR_MATROID_DEC *dec, bool recurse)
 Checks a matroid decomposition node for consistency. More...
 
CMR_EXPORT CMR_ERROR CMRmatroiddecPrintChild (CMR *cmr, CMR_MATROID_DEC *child, CMR_MATROID_DEC *parent, size_t childIndex, FILE *stream, size_t indent, bool printChildren, bool printParentElements, bool printMatrices, bool printGraphs, bool printReductions, bool printPivots)
 Prints the decomposition child to stream. More...
 
CMR_ERROR CMRmatroiddecSetNumChildren (CMR *cmr, CMR_MATROID_DEC *dec, size_t numChildren)
 Sets the number of children and allocates memory accordingly. More...
 
CMR_ERROR CMRmatroiddecUpdateOneSum (CMR *cmr, CMR_MATROID_DEC *dec, size_t numChildren)
 Initialize an existing unknown decomposition node as a 1-sum with numChildren children. More...
 
CMR_ERROR CMRmatroiddecCreateChildFromMatrices (CMR *cmr, CMR_MATROID_DEC *parent, size_t childIndex, CMR_CHRMAT *matrix, CMR_CHRMAT *transpose, CMR_ELEMENT *rowsToParent, CMR_ELEMENT *columnsToParent)
 Creates a decomposition node as a child. More...
 
CMR_ERROR CMRmatroiddecUpdateSubmatrix (CMR *cmr, CMR_MATROID_DEC *dec, CMR_SUBMAT *submatrix, CMR_MATROID_DEC_TYPE type)
 Initialize an existing unknown decomposition node as a submatrix node whose child is of given type. More...
 
CMR_ERROR CMRmatroiddecUpdateTwoSum (CMR *cmr, CMR_MATROID_DEC *dec, CMR_SEPA *separation)
 Initialize an existing unknown decomposition node as a 2-separation node according to the given separation. More...
 
CMR_ERROR CMRmatroiddecUpdatePivots (CMR *cmr, CMR_MATROID_DEC *dec, size_t numPivots, size_t *pivotRows, size_t *pivotColumns, CMR_CHRMAT *matrix, CMR_CHRMAT *transpose)
 Initialize an existing unknown decomposition node as a pivot node according to the given arrays of pivots. More...
 
CMR_ERROR CMRmatroiddecUpdateThreeSumInit (CMR *cmr, CMR_MATROID_DEC *dec)
 Initialize an existing unknown decomposition node as a 3-sum node. More...
 
CMR_ERROR CMRmatroiddecUpdateThreeSumCreateWideFirstChild (CMR *cmr, CMR_MATROID_DEC *dec, CMR_SEPA *separation, size_t *rowsToChild, size_t *columnsToChild, size_t numChildBaseRows, size_t numChildBaseColumns, size_t extraRow, size_t extraColumn1, size_t extraColumn2, int8_t extraEntry)
 Creates wide first child of an initialized 3-sum node. More...
 
CMR_ERROR CMRmatroiddecUpdateThreeSumCreateWideSecondChild (CMR *cmr, CMR_MATROID_DEC *dec, CMR_SEPA *separation, size_t *rowsToChild, size_t *columnsToChild, size_t numChildBaseRows, size_t numChildBaseColumns, size_t extraRow, size_t extraColumn1, size_t extraColumn2, int8_t extraEntry)
 Creates wide second child of an initialized 3-sum node. More...
 
CMR_ERROR CMRmatroiddecUpdateThreeSumCreateMixedFirstChild (CMR *cmr, CMR_MATROID_DEC *dec, CMR_SEPA *separation, size_t *rowsToChild, size_t *columnsToChild, size_t numChildBaseRows, size_t numChildBaseColumns, size_t extraRow1, size_t extraRow2, int8_t extraEntry)
 Creates mixed first child of an initialized 3-sum node. More...
 
CMR_ERROR CMRmatroiddecUpdateThreeSumCreateMixedSecondChild (CMR *cmr, CMR_MATROID_DEC *dec, CMR_SEPA *separation, size_t *rowsToChild, size_t *columnsToChild, size_t numChildBaseRows, size_t numChildBaseColumns, size_t extraColumn1, size_t extraColumn2, int8_t extraEntry)
 Creates mixed second child of an initialized 3-sum node. More...
 
CMR_ERROR CMRmatroiddecSetAttributes (CMR_MATROID_DEC *dec)
 Set regularity and (co)graphicness attributes of a decomposition tree. More...
 

Function Documentation

◆ CMRmatroiddecConsistency()

char* CMRmatroiddecConsistency ( CMR_MATROID_DEC dec,
bool  recurse 
)

Checks a matroid decomposition node for consistency.

Checks all requirements defined in Representation of Matroids and their Decomposition.

Returns
NULL if consistent. Otherwise, an explanation string is returned, which must freed with free().
See also
CMRconsistencyAssert() for checking the returned string and aborting in case of inconsistency.
Parameters
decDecomposition.
recurseWhether all (grand-)children shall be checked, too.

◆ CMRmatroiddecCreateChildFromMatrices()

CMR_ERROR CMRmatroiddecCreateChildFromMatrices ( CMR cmr,
CMR_MATROID_DEC parent,
size_t  childIndex,
CMR_CHRMAT matrix,
CMR_CHRMAT transpose,
CMR_ELEMENT rowsToParent,
CMR_ELEMENT columnsToParent 
)

Creates a decomposition node as a child.

Copies matrix and transpose into the node.

Parameters
cmrCMR environment.
parentParent node.
childIndexChild index of parent.
matrixThe matrix corresponding to this node.
transposeThe transpose matrix corresponding to this node.
rowsToParentArray for mapping rows to elements of parent.
columnsToParentArray for mapping columns to elements of parent.

◆ CMRmatroiddecPrintChild()

CMR_EXPORT CMR_ERROR CMRmatroiddecPrintChild ( CMR cmr,
CMR_MATROID_DEC child,
CMR_MATROID_DEC parent,
size_t  childIndex,
FILE *  stream,
size_t  indent,
bool  printChildren,
bool  printParentElements,
bool  printMatrices,
bool  printGraphs,
bool  printReductions,
bool  printPivots 
)

Prints the decomposition child to stream.

Parameters
cmrCMR environment.
childDecomposition node of parent.
parentDecomposition node of parent.
childIndexIndex of child as a child of parent.
streamStream to write to.
indentIndentation of this node.
printChildrenWhether to recurse.
printParentElementsWhether to print mapping of rows/columns to parent elements (if parent is not NULL).
printMatricesWhether to print matrices.
printGraphsWhether to print graphs.
printReductionsWhether to print series-parallel reductions.
printPivotsWhether to print pivots.

◆ CMRmatroiddecSetAttributes()

CMR_ERROR CMRmatroiddecSetAttributes ( CMR_MATROID_DEC dec)

Set regularity and (co)graphicness attributes of a decomposition tree.

Parameters
decDecomposition node.

◆ CMRmatroiddecSetNumChildren()

CMR_ERROR CMRmatroiddecSetNumChildren ( CMR cmr,
CMR_MATROID_DEC dec,
size_t  numChildren 
)

Sets the number of children and allocates memory accordingly.

Parameters
cmrCMR environment.
decDecomposition node.
numChildrenNumber of children.

◆ CMRmatroiddecUpdateOneSum()

CMR_ERROR CMRmatroiddecUpdateOneSum ( CMR cmr,
CMR_MATROID_DEC dec,
size_t  numChildren 
)

Initialize an existing unknown decomposition node as a 1-sum with numChildren children.

Parameters
cmrCMR environment.
decDecomposition node.
numChildrenNumber of child nodes.

◆ CMRmatroiddecUpdatePivots()

CMR_ERROR CMRmatroiddecUpdatePivots ( CMR cmr,
CMR_MATROID_DEC dec,
size_t  numPivots,
size_t *  pivotRows,
size_t *  pivotColumns,
CMR_CHRMAT matrix,
CMR_CHRMAT transpose 
)

Initialize an existing unknown decomposition node as a pivot node according to the given arrays of pivots.

The unique child node will be of type CMR_MATROID_DEC_TYPE_UNKNOWN.

Parameters
cmrCMR environment.
decDecomposition node.
numPivotsNumber of pivots.
pivotRowsArray with pivot rows.
pivotColumnsArray with pivot columns.
matrixNew matrix.
transposeTranspose of matrix.

◆ CMRmatroiddecUpdateSubmatrix()

CMR_ERROR CMRmatroiddecUpdateSubmatrix ( CMR cmr,
CMR_MATROID_DEC dec,
CMR_SUBMAT submatrix,
CMR_MATROID_DEC_TYPE  type 
)

Initialize an existing unknown decomposition node as a submatrix node whose child is of given type.

Parameters
cmrCMR environment.
decDecomposition node.
submatrixSubmatrix.
typeType of submatrix node.

◆ CMRmatroiddecUpdateThreeSumCreateMixedFirstChild()

CMR_ERROR CMRmatroiddecUpdateThreeSumCreateMixedFirstChild ( CMR cmr,
CMR_MATROID_DEC dec,
CMR_SEPA separation,
size_t *  rowsToChild,
size_t *  columnsToChild,
size_t  numChildBaseRows,
size_t  numChildBaseColumns,
size_t  extraRow1,
size_t  extraRow2,
int8_t  extraEntry 
)

Creates mixed first child of an initialized 3-sum node.

A nonzero extraEntry indicates the bottom-right nonzero entry.

Parameters
cmrCMR environment.
decDecomposition node (initialized with CMRmatroiddecUpdateThreeSumInit).
separationSeparation.
rowsToChildArray mapping rows to child rows.
columnsToChildArray mapping columns to child columns.
numChildBaseRowsNumber of base rows of this child.
numChildBaseColumnsNumber of base rows of this child.
extraRow1Index of the first extra row.
extraRow2Index of the second extra row.
extraEntrySign of the extra entry.

◆ CMRmatroiddecUpdateThreeSumCreateMixedSecondChild()

CMR_ERROR CMRmatroiddecUpdateThreeSumCreateMixedSecondChild ( CMR cmr,
CMR_MATROID_DEC dec,
CMR_SEPA separation,
size_t *  rowsToChild,
size_t *  columnsToChild,
size_t  numChildBaseRows,
size_t  numChildBaseColumns,
size_t  extraColumn1,
size_t  extraColumn2,
int8_t  extraEntry 
)

Creates mixed second child of an initialized 3-sum node.

A nonzero extraEntry indicates the top-left nonzero entry.

Parameters
cmrCMR environment.
decDecomposition node (initialized with CMRmatroiddecUpdateThreeSumInit).
separationSeparation.
rowsToChildArray mapping rows to child rows.
columnsToChildArray mapping columns to child columns.
numChildBaseRowsNumber of base rows of this child.
numChildBaseColumnsNumber of base rows of this child.
extraColumn1Index of the first extra column.
extraColumn2Index of the second extra column.
extraEntrySign of the extra entry.

◆ CMRmatroiddecUpdateThreeSumCreateWideFirstChild()

CMR_ERROR CMRmatroiddecUpdateThreeSumCreateWideFirstChild ( CMR cmr,
CMR_MATROID_DEC dec,
CMR_SEPA separation,
size_t *  rowsToChild,
size_t *  columnsToChild,
size_t  numChildBaseRows,
size_t  numChildBaseColumns,
size_t  extraRow,
size_t  extraColumn1,
size_t  extraColumn2,
int8_t  extraEntry 
)

Creates wide first child of an initialized 3-sum node.

A nonzero extraEntry indicates the bottom-right nonzero entry.

Parameters
cmrCMR environment.
decDecomposition node (initialized with CMRmatroiddecUpdateThreeSumInit).
separationSeparation.
rowsToChildArray mapping rows to child rows.
columnsToChildArray mapping columns to child columns.
numChildBaseRowsNumber of base rows of this child.
numChildBaseColumnsNumber of base rows of this child.
extraRowIndex of the extra row.
extraColumn1Index of 1st extra column.
extraColumn2Index of 2nd extra column, parallel to extraColumn1; equality is allowed.
extraEntrySign of the extra entry.

◆ CMRmatroiddecUpdateThreeSumCreateWideSecondChild()

CMR_ERROR CMRmatroiddecUpdateThreeSumCreateWideSecondChild ( CMR cmr,
CMR_MATROID_DEC dec,
CMR_SEPA separation,
size_t *  rowsToChild,
size_t *  columnsToChild,
size_t  numChildBaseRows,
size_t  numChildBaseColumns,
size_t  extraRow,
size_t  extraColumn1,
size_t  extraColumn2,
int8_t  extraEntry 
)

Creates wide second child of an initialized 3-sum node.

A nonzero extraEntry indicates the bottom-right nonzero entry.

Parameters
cmrCMR environment.
decDecomposition node (initialized with CMRmatroiddecUpdateThreeSumInit).
separationSeparation.
rowsToChildArray mapping rows to child rows.
columnsToChildArray mapping columns to child columns.
numChildBaseRowsNumber of base rows of this child.
numChildBaseColumnsNumber of base rows of this child.
extraRowIndex of the extra row.
extraColumn1Index of 1st extra column.
extraColumn2Index of 2nd extra column, parallel to extraColumn1; equality is allowed.
extraEntrySign of the extra entry, if known.

◆ CMRmatroiddecUpdateThreeSumInit()

CMR_ERROR CMRmatroiddecUpdateThreeSumInit ( CMR cmr,
CMR_MATROID_DEC dec 
)

Initialize an existing unknown decomposition node as a 3-sum node.

The two child nodes remain uninitialized.

Parameters
cmrCMR environment.
decDecomposition node.

◆ CMRmatroiddecUpdateTwoSum()

CMR_ERROR CMRmatroiddecUpdateTwoSum ( CMR cmr,
CMR_MATROID_DEC dec,
CMR_SEPA separation 
)

Initialize an existing unknown decomposition node as a 2-separation node according to the given separation.

The two child nodes will be of type CMR_MATROID_DEC_TYPE_UNKNOWN.

Parameters
cmrCMR environment.
decDecomposition node.
separation2-separation.