CMR  1.3.0
matroid.h
Go to the documentation of this file.
1 #ifndef CMR_MATROID_H
2 #define CMR_MATROID_H
3 
12 #include <cmr/env.h>
13 #include <cmr/matrix.h>
14 #include <cmr/graph.h>
15 
16 #include <stdio.h>
17 
18 #ifdef __cplusplus
19 extern "C" {
20 #endif
21 
34 CMR_EXPORT
36  CMR* cmr,
37  CMR_CHRMAT* matrix,
38  size_t pivotRow,
39  size_t pivotColumn,
40  CMR_CHRMAT** presult
41 );
42 
49 CMR_EXPORT
51  CMR* cmr,
52  CMR_CHRMAT* matrix,
53  size_t pivotRow,
54  size_t pivotColumn,
55  CMR_CHRMAT** presult
56 );
57 
64 CMR_EXPORT
66  CMR* cmr,
67  CMR_CHRMAT* matrix,
68  size_t numPivots,
69  size_t* pivotRows,
70  size_t* pivotColumns,
71  CMR_CHRMAT** presult
72 );
73 
80 CMR_EXPORT
82  CMR* cmr,
83  CMR_CHRMAT* matrix,
84  size_t numPivots,
85  size_t* pivotRows,
86  size_t* pivotColumns,
87  CMR_CHRMAT** presult
88 );
89 
90 typedef enum
91 {
104  CMR_MINOR_TYPE_K5 = 4,
108  CMR_MINOR_TYPE_K33 = 6,
113 
120 typedef struct
121 {
122  size_t numPivots;
123  size_t* pivotRows;
124  size_t* pivotColumns;
127 } CMR_MINOR;
128 
133 CMR_EXPORT
135  CMR* cmr,
136  CMR_MINOR** pminor,
137  size_t numPivots,
138  CMR_SUBMAT* submatrix,
139  CMR_MINOR_TYPE type
140 );
141 
146 CMR_EXPORT
148  CMR* cmr,
149  CMR_MINOR** pminor
150 );
151 
156 CMR_EXPORT
158  CMR_MINOR* minor
159 );
160 
165 CMR_EXPORT
166 size_t CMRminorNumPivots(
167  CMR_MINOR* minor
168 );
169 
174 CMR_EXPORT
175 size_t* CMRminorPivotRows(
176  CMR_MINOR* minor
177 );
178 
183 CMR_EXPORT
184 size_t* CMRminorPivotColumns(
185  CMR_MINOR* minor
186 );
187 
192 CMR_EXPORT
194  CMR_MINOR* minor
195 );
196 
201 CMR_EXPORT
203  CMR* cmr,
204  CMR_MINOR* minor,
205  size_t numRows,
206  size_t numColumns,
207  FILE* stream
208 );
209 
215 CMR_EXPORT
217  CMR* cmr,
218  CMR_MINOR* minor,
219  size_t numRows,
220  size_t numColumns,
221  const char* fileName
222 );
223 
224 
227 #ifdef __cplusplus
228 }
229 #endif
230 
231 #endif /* CMR_MATROID_H */
Basic functionality of the software library.
CMR_ERROR
Type for return codes of library functions.
Definition: env.h:32
Functionality for graphs.
CMR_EXPORT CMR_ERROR CMRminorCreate(CMR *cmr, CMR_MINOR **pminor, size_t numPivots, CMR_SUBMAT *submatrix, CMR_MINOR_TYPE type)
Creates a minor, allocating space for numPivots pivots and a remaining submatrix.
Definition: matroid.c:280
CMR_EXPORT CMR_ERROR CMRchrmatTernaryPivot(CMR *cmr, CMR_CHRMAT *matrix, size_t pivotRow, size_t pivotColumn, CMR_CHRMAT **presult)
Applies a sequence of pivots to matrix and returns the resulting matrix in *presult.
Definition: matroid.c:236
CMR_EXPORT CMR_ERROR CMRchrmatBinaryPivots(CMR *cmr, CMR_CHRMAT *matrix, size_t numPivots, size_t *pivotRows, size_t *pivotColumns, CMR_CHRMAT **presult)
Applies a sequence of pivots to matrix and returns the resulting matrix in *presult.
Definition: matroid.c:249
CMR_EXPORT CMR_ERROR CMRchrmatTernaryPivots(CMR *cmr, CMR_CHRMAT *matrix, size_t numPivots, size_t *pivotRows, size_t *pivotColumns, CMR_CHRMAT **presult)
Applies a sequence of pivots to matrix and returns the resulting matrix in *presult.
Definition: matroid.c:263
CMR_EXPORT CMR_ERROR CMRchrmatBinaryPivot(CMR *cmr, CMR_CHRMAT *matrix, size_t pivotRow, size_t pivotColumn, CMR_CHRMAT **presult)
Apply a pivot to matrix and returns the resulting matrix in *presult.
Definition: matroid.c:225
CMR_EXPORT CMR_ERROR CMRminorPrint(CMR *cmr, CMR_MINOR *minor, size_t numRows, size_t numColumns, FILE *stream)
Writes the minor minor to stream by means of lists of row and column indices as well as pivot entries...
Definition: matroid.c:354
CMR_EXPORT CMR_SUBMAT * CMRminorSubmatrix(CMR_MINOR *minor)
Returns the submatrix to take (after applying pivots) to make a minor visible.
Definition: matroid.c:347
CMR_EXPORT size_t * CMRminorPivotColumns(CMR_MINOR *minor)
Returns the array with pivot columns to make a minor visible.
Definition: matroid.c:340
CMR_EXPORT CMR_ERROR CMRminorWriteToFile(CMR *cmr, CMR_MINOR *minor, size_t numRows, size_t numColumns, const char *fileName)
Writes the minor minor to the file fileName by means of lists of row and column indices as well as pi...
Definition: matroid.c:366
CMR_EXPORT size_t CMRminorNumPivots(CMR_MINOR *minor)
Returns the number of pivots needed to make a minor visible.
Definition: matroid.c:326
CMR_EXPORT CMR_ERROR CMRminorFree(CMR *cmr, CMR_MINOR **pminor)
Frees the minor *pminor (if pminor is not NULL).
Definition: matroid.c:302
CMR_EXPORT CMR_MINOR_TYPE CMRminorType(CMR_MINOR *minor)
Returns the type of minor.
Definition: matroid.c:319
CMR_EXPORT size_t * CMRminorPivotRows(CMR_MINOR *minor)
Returns the array with pivot rows to make a minor visible.
Definition: matroid.c:333
CMR_MINOR_TYPE
Definition: matroid.h:91
@ CMR_MINOR_TYPE_U24
Definition: matroid.h:98
@ CMR_MINOR_TYPE_K5_DUAL
Definition: matroid.h:106
@ CMR_MINOR_TYPE_ENTRY
Definition: matroid.h:94
@ CMR_MINOR_TYPE_FANO_DUAL
Definition: matroid.h:102
@ CMR_MINOR_TYPE_K5
Definition: matroid.h:104
@ CMR_MINOR_TYPE_K33
Definition: matroid.h:108
@ CMR_MINOR_TYPE_DETERMINANT
Definition: matroid.h:92
@ CMR_MINOR_TYPE_K33_DUAL
Definition: matroid.h:110
@ CMR_MINOR_TYPE_CUSTOM
Definition: matroid.h:96
@ CMR_MINOR_TYPE_FANO
Definition: matroid.h:100
Functionality for sparse matrices.
Row-wise representation of sparse char matrix.
Definition: matrix.h:220
Definition: env_internal.h:45
A minor of a matroid.
Definition: matroid.h:121
size_t * pivotColumns
Definition: matroid.h:124
size_t numPivots
Definition: matroid.h:122
CMR_SUBMAT * remainingSubmatrix
Definition: matroid.h:125
size_t * pivotRows
Definition: matroid.h:123
CMR_MINOR_TYPE type
Definition: matroid.h:126
Row and column indices for a submatrix.
Definition: matrix.h:28