passagemath-cmr 10.6.33__cp314-cp314-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
sage/libs/cmr/cmr.pxd ADDED
@@ -0,0 +1,600 @@
1
+ # sage_setup: distribution = sagemath-cmr
2
+ # -*- python -*-
3
+ # distutils: libraries = cmr
4
+
5
+ # (progn (replace-regexp "/[*]\\(.\\|\n\\)*?[*]/" "" nil (point) (point-max)) (replace-regexp "[;{}]" "" nil (point) (point-max)) (replace-regexp "CMR_EXPORT *" "" nil (point) (point-max)) (replace-regexp "bool" "bint" nil (point) (point-max)))
6
+
7
+ from libc.stdint cimport int8_t, uint32_t, int64_t
8
+
9
+ cdef extern from "stdbool.h":
10
+
11
+ ctypedef bint bool
12
+
13
+ cdef extern from "cmr/env.h":
14
+ const int CMR_OKAY
15
+ const int CMR_ERROR_INPUT
16
+ const int CMR_ERROR_OUTPUT
17
+ const int CMR_ERROR_MEMORY
18
+ const int CMR_ERROR_INVALID
19
+ const int CMR_ERROR_OVERFLOW
20
+ const int CMR_ERROR_TIMEOUT
21
+ const int CMR_ERROR_STRUCTURE
22
+ const int CMR_ERROR_INCONSISTENT
23
+ const int CMR_ERROR_PARAMS
24
+
25
+ ctypedef int CMR_ERROR
26
+
27
+ ctypedef struct CMR
28
+
29
+ int CMRcreateEnvironment(CMR** pcmr)
30
+ int CMRfreeEnvironment(CMR** pcmr)
31
+
32
+ char* CMRgetErrorMessage(CMR* cmr)
33
+ void CMRclearErrorMessage(CMR* cmr)
34
+
35
+ CMR_ERROR _CMRallocBlock(CMR* cmr, void** ptr, size_t size)
36
+ CMR_ERROR _CMRfreeBlock(CMR* cmr, void** ptr, size_t size)
37
+ CMR_ERROR _CMRallocBlockArray(CMR* cmr, void** ptr, size_t size, size_t length)
38
+ CMR_ERROR _CMRreallocBlockArray(CMR* cmr, void** ptr, size_t size, size_t length)
39
+ CMR_ERROR _CMRduplicateBlockArray(CMR* cmr, void** ptr, size_t size, size_t length, void* source)
40
+ CMR_ERROR _CMRfreeBlockArray(CMR* cmr, void** ptr)
41
+
42
+ cdef extern from "cmr/matrix.h":
43
+
44
+ ctypedef struct CMR_SUBMAT:
45
+ size_t numRows
46
+ size_t* rows
47
+ size_t numColumns
48
+ size_t* columns
49
+
50
+ CMR_ERROR CMRsubmatCreate(CMR* cmr, size_t numRows, size_t numColumns, CMR_SUBMAT** psubmatrix)
51
+ CMR_ERROR CMRsubmatCreate1x1(CMR* cmr, size_t row, size_t column, CMR_SUBMAT** psubmatrix)
52
+ CMR_ERROR CMRsubmatCreate2x2(CMR* cmr, size_t row1, size_t row2, size_t column1, size_t column2, CMR_SUBMAT** psubmatrix)
53
+ CMR_ERROR CMRsubmatFree(CMR* cmr, CMR_SUBMAT** psubmatrix)
54
+ # CMR_ERROR CMRsubmatPrint(CMR* cmr, CMR_SUBMAT* submatrix, size_t numRows, size_t numColumns, FILE* stream)
55
+
56
+ ctypedef struct CMR_INTMAT:
57
+ size_t numRows
58
+ size_t numColumns
59
+ size_t numNonzeros
60
+ size_t* rowSlice
61
+ size_t* entryColumns
62
+ int* entryValues
63
+
64
+ CMR_ERROR CMRintmatCreate(CMR* cmr, CMR_INTMAT** presult, int numRows, int numColumns, int numNonzeros)
65
+ CMR_ERROR CMRintmatSortNonzeros(CMR* cmr, CMR_INTMAT* matrix)
66
+ # CMR_ERROR CMRintmatPrintDense(CMR* cmr, CMR_INTMAT* matrix, FILE* stream, char zeroChar, bint header)
67
+ CMR_ERROR CMRintmatFindEntry(CMR_INTMAT* matrix, size_t row, size_t column, size_t* pentry)
68
+ CMR_ERROR CMRintmatSlice(CMR* cmr, CMR_INTMAT* matrix, CMR_SUBMAT* submatrix, CMR_INTMAT** presult)
69
+ CMR_ERROR CMRintmatFree(CMR* cmr, CMR_INTMAT** pmatrix)
70
+
71
+ ctypedef struct CMR_CHRMAT:
72
+ size_t numRows
73
+ size_t numColumns
74
+ size_t numNonzeros
75
+ size_t* rowSlice
76
+ size_t* entryColumns
77
+ signed char* entryValues
78
+
79
+ CMR_ERROR CMRchrmatCreate(CMR* cmr, CMR_CHRMAT** presult, int numRows, int numColumns, int numNonzeros)
80
+ CMR_ERROR CMRchrmatSortNonzeros(CMR* cmr, CMR_CHRMAT* matrix)
81
+ # CMR_ERROR CMRchrmatPrintDense(CMR* cmr, CMR_CHRMAT* matrix, FILE* stream, char zeroChar, bint header)
82
+ CMR_ERROR CMRchrmatFindEntry(CMR_CHRMAT* matrix, size_t row, size_t column, size_t* pentry)
83
+ CMR_ERROR CMRchrmatSlice(CMR* cmr, CMR_CHRMAT* matrix, CMR_SUBMAT* submatrix, CMR_CHRMAT** presult)
84
+ CMR_ERROR CMRchrmatFree(CMR* cmr, CMR_CHRMAT** pmatrix)
85
+ CMR_ERROR CMRchrmatTranspose(CMR* cmr, CMR_CHRMAT* matrix, CMR_CHRMAT** presult)
86
+
87
+ CMR_ERROR CMRchrmatToInt(CMR* cmr, CMR_CHRMAT* matrix, CMR_INTMAT** presult)
88
+ CMR_ERROR CMRintmatToChr(CMR* cmr, CMR_INTMAT* matrix, CMR_CHRMAT** presult)
89
+
90
+ cdef extern from "cmr/camion.h":
91
+
92
+ ctypedef struct CMR_CAMION_STATISTICS:
93
+ uint32_t generalCount
94
+ double generalTime
95
+ uint32_t graphCount
96
+ double graphTime
97
+ uint32_t totalCount
98
+ double totalTime
99
+
100
+ CMR_ERROR CMRcamionStatsInit(CMR_CAMION_STATISTICS* stats)
101
+ # CMR_ERROR CMRstatsCamionPrint(FILE* stream, CMR_CAMION_STATISTICS* stats, const char* prefix)
102
+ CMR_ERROR CMRcamionTestSigns(CMR* cmr, CMR_CHRMAT* matrix, bool* pisCamionSigned, CMR_SUBMAT** psubmatrix, CMR_CAMION_STATISTICS* stats, double timeLimit)
103
+ CMR_ERROR CMRcamionComputeSigns(CMR* cmr, CMR_CHRMAT* matrix, bool* pwasCamionSigned, CMR_SUBMAT** psubmatrix, CMR_CAMION_STATISTICS* stats, double timeLimit)
104
+
105
+ cdef extern from "cmr/element.h":
106
+
107
+ ctypedef int CMR_ELEMENT
108
+
109
+ const char* CMRelementString(CMR_ELEMENT element, char* buffer)
110
+ bint CMRelementIsValid(CMR_ELEMENT element)
111
+ CMR_ELEMENT CMRrowToElement(size_t row)
112
+ CMR_ELEMENT CMRcolumnToElement(size_t column)
113
+ bint CMRelementIsRow(CMR_ELEMENT element)
114
+ size_t CMRelementToRowIndex(CMR_ELEMENT element)
115
+ bint CMRelementIsColumn(CMR_ELEMENT element)
116
+ size_t CMRelementToColumnIndex(CMR_ELEMENT element)
117
+ CMR_ELEMENT CMRelementTranspose(CMR_ELEMENT element)
118
+
119
+ cdef extern from "cmr/graph.h":
120
+
121
+ ctypedef int CMR_GRAPH_NODE
122
+ ctypedef int CMR_GRAPH_EDGE
123
+ ctypedef int CMR_GRAPH_ITER
124
+
125
+ ctypedef struct CMR_GRAPH_NODE_DATA:
126
+ int prev
127
+ int next
128
+ int firstOut
129
+
130
+ ctypedef struct CMR_GRAPH_ARC_DATA:
131
+ int target
132
+ int prev
133
+ int next
134
+
135
+ ctypedef struct CMR_GRAPH:
136
+ size_t numNodes
137
+ size_t memNodes
138
+ CMR_GRAPH_NODE_DATA* nodes
139
+ int firstNode
140
+ int freeNode
141
+ size_t numEdges
142
+ size_t memEdges
143
+ CMR_GRAPH_ARC_DATA* arcs
144
+ int freeEdge
145
+
146
+ size_t CMRgraphMemNodes(CMR_GRAPH* graph)
147
+ size_t CMRgraphNumNodes(CMR_GRAPH* graph)
148
+ size_t CMRgraphMemEdges(CMR_GRAPH* graph)
149
+ size_t CMRgraphNumEdges(CMR_GRAPH* graph)
150
+ CMR_GRAPH_NODE CMRgraphEdgeU(CMR_GRAPH* graph, CMR_GRAPH_EDGE e)
151
+ CMR_GRAPH_NODE CMRgraphEdgeV(CMR_GRAPH* graph, CMR_GRAPH_EDGE e)
152
+ CMR_ERROR CMRgraphCreateEmpty(CMR* cmr, CMR_GRAPH** pgraph, int memNodes, int memEdges)
153
+ CMR_ERROR CMRgraphFree(CMR* cmr, CMR_GRAPH** pgraph)
154
+ CMR_ERROR CMRgraphClear(CMR* cmr, CMR_GRAPH* graph)
155
+ CMR_ERROR CMRgraphAddNode(CMR* cmr, CMR_GRAPH* graph, CMR_GRAPH_NODE* pnode)
156
+ CMR_ERROR CMRgraphAddEdge(CMR* cmr, CMR_GRAPH* graph, CMR_GRAPH_NODE u, CMR_GRAPH_NODE v, CMR_GRAPH_EDGE* pedge)
157
+ CMR_ERROR CMRgraphDeleteNode(CMR* cmr, CMR_GRAPH* graph, CMR_GRAPH_NODE v)
158
+ CMR_ERROR CMRgraphDeleteEdge(CMR* cmr, CMR_GRAPH* graph, CMR_GRAPH_EDGE e)
159
+ CMR_GRAPH_NODE CMRgraphNodesFirst(CMR_GRAPH* graph)
160
+ bint CMRgraphNodesValid(CMR_GRAPH* graph, CMR_GRAPH_NODE v)
161
+ CMR_GRAPH_NODE CMRgraphNodesNext(CMR_GRAPH* graph, CMR_GRAPH_NODE v)
162
+ CMR_GRAPH_ITER CMRgraphIncFirst(CMR_GRAPH* graph, CMR_GRAPH_NODE v)
163
+ bint CMRgraphIncValid(CMR_GRAPH* graph, CMR_GRAPH_ITER i)
164
+ CMR_GRAPH_ITER CMRgraphIncNext(CMR_GRAPH* graph, CMR_GRAPH_ITER i)
165
+ CMR_GRAPH_EDGE CMRgraphIncEdge(CMR_GRAPH* graph, CMR_GRAPH_ITER i)
166
+ CMR_GRAPH_NODE CMRgraphIncSource(CMR_GRAPH* graph, CMR_GRAPH_ITER i)
167
+ CMR_GRAPH_NODE CMRgraphIncTarget(CMR_GRAPH* graph, CMR_GRAPH_ITER i)
168
+ CMR_GRAPH_ITER CMRgraphEdgesFirst(CMR_GRAPH* graph)
169
+ CMR_GRAPH_ITER CMRgraphEdgesNext(CMR_GRAPH* graph, CMR_GRAPH_ITER i)
170
+ bint CMRgraphEdgesValid(CMR_GRAPH* graph, CMR_GRAPH_ITER i)
171
+ CMR_GRAPH_EDGE CMRgraphEdgesEdge(CMR_GRAPH* graph, CMR_GRAPH_ITER i)
172
+ # CMR_ERROR CMRgraphPrint(CMR_GRAPH* graph, FILE* stream)
173
+ CMR_ERROR CMRgraphMergeNodes(CMR* cmr, CMR_GRAPH* graph, CMR_GRAPH_NODE u, CMR_GRAPH_NODE v)
174
+ # CMR_ERROR CMRgraphCreateFromEdgeList(CMR* cmr, CMR_GRAPH** pgraph, CMR_ELEMENT** pedgeElements, char*** pnodeLabels, FILE* stream)
175
+ # CMR_ERROR CMRgraphCopy(CMR* cmr, CMR_GRAPH* graph, CMR_GRAPH** pcopy)
176
+
177
+ cdef extern from "cmr/matroid.h":
178
+
179
+ CMR_ERROR CMRchrmatBinaryPivot(CMR* cmr, CMR_CHRMAT* matrix, size_t pivotRow, size_t pivotColumn, CMR_CHRMAT** presult)
180
+ CMR_ERROR CMRchrmatTernaryPivot(CMR* cmr, CMR_CHRMAT* matrix, size_t pivotRow, size_t pivotColumn, CMR_CHRMAT** presult)
181
+ CMR_ERROR CMRchrmatRegularPivot(CMR* cmr, CMR_CHRMAT* matrix, size_t pivotRow, size_t pivotColumn, CMR_SUBMAT** pviolator, CMR_CHRMAT** presult)
182
+ CMR_ERROR CMRchrmatBinaryPivots(CMR* cmr, CMR_CHRMAT* matrix, size_t numPivots, size_t* pivotRows, size_t* pivotColumns, CMR_CHRMAT** presult)
183
+ CMR_ERROR CMRchrmatTernaryPivots(CMR* cmr, CMR_CHRMAT* matrix, size_t numPivots, size_t* pivotRows, size_t* pivotColumns, CMR_CHRMAT** presult)
184
+ CMR_ERROR CMRchrmatRegularPivots(CMR* cmr, CMR_CHRMAT* matrix, size_t numPivots, size_t* pivotRows, size_t* pivotColumns, CMR_SUBMAT** pviolator, CMR_CHRMAT** presult)
185
+
186
+ ctypedef int CMR_MINOR_TYPE
187
+
188
+ const int CMR_MINOR_TYPE_DETERMINANT
189
+ const int CMR_MINOR_TYPE_ENTRY
190
+ const int CMR_MINOR_TYPE_CUSTOM
191
+ const int CMR_MINOR_TYPE_U24
192
+ const int CMR_MINOR_TYPE_FANO
193
+ const int CMR_MINOR_TYPE_FANO_DUAL
194
+ const int CMR_MINOR_TYPE_K5
195
+ const int CMR_MINOR_TYPE_K5_DUAL
196
+ const int CMR_MINOR_TYPE_K33
197
+ const int CMR_MINOR_TYPE_K33_DUAL
198
+
199
+ ctypedef struct CMR_MINOR:
200
+ size_t numPivots
201
+ size_t* pivotRows
202
+ size_t* pivotColumns
203
+ CMR_SUBMAT* remainingSubmatrix
204
+ CMR_MINOR_TYPE type
205
+
206
+ CMR_ERROR CMRminorCreate(CMR* cmr, CMR_MINOR** pminor, size_t numPivots, CMR_SUBMAT* submatrix, CMR_MINOR_TYPE type)
207
+ CMR_ERROR CMRminorFree(CMR* cmr, CMR_MINOR** pminor)
208
+ CMR_MINOR_TYPE CMRminorType(CMR_MINOR* minor)
209
+ size_t CMRminorNumPivots(CMR_MINOR* minor)
210
+ size_t* CMRminorPivotRows(CMR_MINOR* minor)
211
+ size_t* CMRminorPivotColumns(CMR_MINOR* minor)
212
+ CMR_SUBMAT* CMRminorSubmatrix(CMR_MINOR* minor)
213
+ # CMR_ERROR CMRminorWriteToFile(CMR* cmr, CMR_MINOR* minor, size_t numRows, size_t numColumns, const char* fileName)
214
+
215
+ cdef extern from "cmr/separation.h":
216
+
217
+ ctypedef int CMR_SEPA_FLAGS
218
+
219
+ const int CMR_SEPA_FIRST
220
+ const int CMR_SEPA_SECOND
221
+ const int CMR_SEPA_FLAG_RANK1
222
+ const int CMR_SEPA_FLAG_RANK2
223
+ const int CMR_SEPA_MASK_CHILD
224
+ const int CMR_SEPA_MASK_EXTRA
225
+
226
+ ctypedef int CMR_SEPA_TYPE
227
+
228
+ const int CMR_SEPA_TYPE_TWO
229
+ const int CMR_SEPA_TYPE_THREE_DISTRIBUTED_RANKS
230
+ const int CMR_SEPA_TYPE_THREE_CONCENTRATED_RANK
231
+
232
+ ctypedef struct CMR_SEPA:
233
+ size_t numRows
234
+ size_t numColumns
235
+ int* rowsFlags
236
+ int* columnsFlags
237
+ CMR_SEPA_TYPE type
238
+
239
+ CMR_ERROR CMRsepaCreate(CMR* cmr, size_t numRows, size_t numColumns, CMR_SEPA** psepa)
240
+ CMR_ERROR CMRsepaFree(CMR* cmr, CMR_SEPA** psepa)
241
+ CMR_ERROR CMRsepaTranspose(CMR* cmr, CMR_SEPA* sepa, CMR_SEPA** ptransposed)
242
+ CMR_ERROR CMRsepaComputeSizes(CMR_SEPA* sepa, size_t* pnumRowsTopLeft, size_t* pnumColumnsTopLeft, size_t* pnumRowsBottomRight, size_t* pnumColumnsBottomRight)
243
+ CMR_ERROR CMRsepaFindBinaryRepresentatives(CMR* cmr, CMR_SEPA* sepa, CMR_CHRMAT* matrix, CMR_CHRMAT* transpose, bool* pswapped, CMR_SUBMAT** pviolator)
244
+ CMR_ERROR CMRsepaFindBinaryRepresentativesSubmatrix(CMR* cmr, CMR_SEPA* sepa, CMR_CHRMAT* matrix, CMR_CHRMAT* transpose, CMR_SUBMAT* submatrix, bool* pswapped, CMR_SUBMAT** pviolator)
245
+ CMR_ERROR CMRsepaGetRepresentatives(CMR_SEPA* sepa, size_t reprRows[2][3], size_t reprColumns[2][3])
246
+ CMR_ERROR CMRsepaGetProjection(CMR_SEPA* sepa, size_t part, size_t* rowsToPart, size_t* columnsToPart, size_t* pnumPartRows, size_t* pnumPartColumns)
247
+ CMR_ERROR CMRsepaCheckTernary(CMR* cmr, CMR_SEPA* sepa, CMR_CHRMAT* matrix, bool* pisTernary, CMR_SUBMAT** pviolator)
248
+ CMR_ERROR CMRsepaCheckTernarySubmatrix(CMR* cmr, CMR_SEPA* sepa, CMR_CHRMAT* matrix, CMR_SUBMAT* submatrix, bool* pisTernary, CMR_SUBMAT** pviolator)
249
+ CMR_ERROR CMRonesumCompose(CMR* cmr, size_t numMatrices, CMR_CHRMAT** matrices, CMR_CHRMAT** presult)
250
+ CMR_ERROR CMRtwosumCompose(CMR* cmr, CMR_CHRMAT* first, CMR_CHRMAT* second, size_t* firstSpecialRows, size_t* firstSpecialColumns, size_t* secondSpecialRows, size_t* secondSpecialColumns, int8_t characteristic, CMR_CHRMAT** presult)
251
+ CMR_ERROR CMRtwosumDecomposeFirst(CMR* cmr, CMR_CHRMAT* matrix, CMR_SEPA* sepa, CMR_CHRMAT** pfirst, size_t* firstRowsOrigin, size_t* firstColumnsOrigin, size_t* rowsToFirst, size_t* columnsToFirst, size_t* firstSpecialRows, size_t* firstSpecialColumns)
252
+ CMR_ERROR CMRtwosumDecomposeSecond(CMR* cmr, CMR_CHRMAT* matrix, CMR_SEPA* sepa, CMR_CHRMAT** psecond, size_t* secondRowsOrigin, size_t* secondColumnsOrigin, size_t* rowsToSecond, size_t* columnsToSecond, size_t* secondSpecialRows, size_t* secondSpecialColumns)
253
+ CMR_ERROR CMRdeltasumCompose(CMR* cmr, CMR_CHRMAT* first, CMR_CHRMAT* second, size_t* firstSpecialRows, size_t* firstSpecialColumns, size_t* secondSpecialRows, size_t* secondSpecialColumns, int8_t characteristic, CMR_CHRMAT** presult)
254
+ CMR_ERROR CMRdeltasumDecomposeEpsilon(CMR* cmr, CMR_CHRMAT* matrix, CMR_CHRMAT* transpose, CMR_SEPA* sepa, signed char* pepsilon)
255
+ CMR_ERROR CMRdeltasumDecomposeFirst(CMR* cmr, CMR_CHRMAT* matrix, CMR_SEPA* sepa, signed char epsilon, CMR_CHRMAT** pfirst, size_t* firstRowsOrigin, size_t* firstColumnsOrigin, size_t* rowsToFirst, size_t* columnsToFirst, size_t* firstSpecialRows, size_t* firstSpecialColumns)
256
+ CMR_ERROR CMRdeltasumDecomposeSecond(CMR* cmr, CMR_CHRMAT* matrix, CMR_SEPA* sepa, signed char epsilon, CMR_CHRMAT** psecond, size_t* secondRowsOrigin, size_t* secondColumnsOrigin, size_t* rowsToSecond, size_t* columnsToSecond, size_t* secondSpecialRows, size_t* secondSpecialColumns)
257
+
258
+ CMR_ERROR CMRysumCompose(CMR* cmr, CMR_CHRMAT* first, CMR_CHRMAT* second, size_t* firstSpecialRows, size_t* firstSpecialColumns, size_t* secondSpecialRows, size_t* secondSpecialColumns, int8_t characteristic, CMR_CHRMAT** presult)
259
+ CMR_ERROR CMRysumDecomposeEpsilon(CMR* cmr, CMR_CHRMAT* matrix, CMR_CHRMAT* transpose, CMR_SEPA* sepa, signed char* pepsilon)
260
+ CMR_ERROR CMRysumDecomposeFirst(CMR* cmr, CMR_CHRMAT* matrix, CMR_SEPA* sepa, signed char epsilon, CMR_CHRMAT** pfirst, size_t* firstRowsOrigin, size_t* firstColumnsOrigin, size_t* rowsToFirst, size_t* columnsToFirst, size_t* firstSpecialRows, size_t* firstSpecialColumns)
261
+ CMR_ERROR CMRysumDecomposeSecond(CMR* cmr, CMR_CHRMAT* matrix, CMR_SEPA* sepa, signed char epsilon, CMR_CHRMAT** psecond, size_t* secondRowsOrigin, size_t* secondColumnsOrigin, size_t* rowsToSecond, size_t* columnsToSecond, size_t* secondSpecialRows, size_t* secondSpecialColumns)
262
+
263
+ CMR_ERROR CMRthreesumCompose(CMR* cmr, CMR_CHRMAT* first, CMR_CHRMAT* second, size_t* firstSpecialRows, size_t* firstSpecialColumns, size_t* secondSpecialRows, size_t* secondSpecialColumns, int8_t characteristic, CMR_CHRMAT** presult)
264
+ CMR_ERROR CMRthreesumDecomposeSearchConnecting(CMR* cmr, CMR_CHRMAT* matrix, CMR_CHRMAT* transpose, CMR_SEPA* sepa, size_t* specialRows, size_t* specialColumns, signed char* pgamma, signed char* pbeta)
265
+ CMR_ERROR CMRthreesumDecomposeSignConnecting(CMR* cmr, CMR_CHRMAT* matrix, CMR_CHRMAT* transpose, CMR_SEPA* sepa, size_t* specialRows, size_t* specialColumns, signed char* pgamma, signed char* pbeta)
266
+ CMR_ERROR CMRthreesumDecomposeFirst(CMR* cmr, CMR_CHRMAT* matrix, CMR_SEPA* sepa, size_t* specialRows, size_t* specialColumns, signed char beta, CMR_CHRMAT** pfirst, size_t* firstRowsOrigin, size_t* firstColumnsOrigin, size_t* rowsToFirst, size_t* columnsToFirst, size_t* firstSpecialRows, size_t* firstSpecialColumns)
267
+ CMR_ERROR CMRthreesumDecomposeSecond(CMR* cmr, CMR_CHRMAT* matrix, CMR_SEPA* sepa, size_t* specialRows, size_t* specialColumns, signed char gamma, CMR_CHRMAT** psecond, size_t* secondRowsOrigin, size_t* secondColumnsOrigin, size_t* rowsToSecond, size_t* columnsToSecond, size_t* secondSpecialRows, size_t* secondSpecialColumns)
268
+
269
+ cdef extern from "cmr/graphic.h":
270
+
271
+ ctypedef struct CMR_GRAPHIC_STATISTICS:
272
+ uint32_t totalCount
273
+ double totalTime
274
+ uint32_t checkCount
275
+ double checkTime
276
+ uint32_t applyCount
277
+ double applyTime
278
+ uint32_t transposeCount
279
+ double transposeTime
280
+
281
+ CMR_ERROR CMRgraphicStatsInit(CMR_GRAPHIC_STATISTICS* stats)
282
+ # CMR_ERROR CMRgraphicStatsPrint(FILE* stream, CMR_GRAPHIC_STATISTICS* stats, const char* prefix)
283
+ CMR_ERROR CMRgraphicComputeMatrix(CMR* cmr, CMR_GRAPH* graph, CMR_CHRMAT** pmatrix, CMR_CHRMAT** ptranspose, int numForestEdges, CMR_GRAPH_EDGE* forestEdges, int numCoforestEdges, CMR_GRAPH_EDGE* coforestEdges, bool* pisCorrectForest)
284
+ CMR_ERROR CMRgraphicTestMatrix(CMR* cmr, CMR_CHRMAT* matrix, bool* pisGraphic, CMR_GRAPH** pgraph, CMR_GRAPH_EDGE** pforestEdges, CMR_GRAPH_EDGE** pcoforestEdges, CMR_SUBMAT** psubmatrix, CMR_GRAPHIC_STATISTICS* stats, double timeLimit)
285
+ CMR_ERROR CMRgraphicTestTranspose(CMR* cmr, CMR_CHRMAT* matrix, bool* pisCographic, CMR_GRAPH** pgraph, CMR_GRAPH_EDGE** pforestEdges, CMR_GRAPH_EDGE** pcoforestEdges, CMR_SUBMAT** psubmatrix, CMR_GRAPHIC_STATISTICS* stats, double timeLimit)
286
+ CMR_ERROR CMRgraphicTestColumnSubmatrixGreedy(CMR* cmr, CMR_CHRMAT* transpose, size_t* orderedColumns, CMR_SUBMAT** psubmatrix)
287
+
288
+ cdef extern from "cmr/series_parallel.h":
289
+
290
+ ctypedef struct CMR_SP_STATISTICS:
291
+ uint32_t totalCount
292
+ double totalTime
293
+ uint32_t reduceCount
294
+ double reduceTime
295
+ uint32_t wheelCount
296
+ double wheelTime
297
+ uint32_t nonbinaryCount
298
+ double nonbinaryTime
299
+
300
+ CMR_ERROR CMRspStatsInit(CMR_SP_STATISTICS* stats)
301
+
302
+ # CMR_ERROR CMRspStatsPrint(FILE* stream, CMR_SP_STATISTICS* stats, const char* prefix)
303
+
304
+ ctypedef struct CMR_SP_REDUCTION:
305
+ CMR_ELEMENT element
306
+ CMR_ELEMENT mate
307
+
308
+ char* CMRspReductionString(CMR_SP_REDUCTION reduction, char* buffer)
309
+
310
+ bint CMRspIsRow(CMR_SP_REDUCTION reduction)
311
+ bint CMRspIsColumn(CMR_SP_REDUCTION reduction)
312
+ bint CMRspIsZero(CMR_SP_REDUCTION reduction)
313
+ bint CMRspIsUnit(CMR_SP_REDUCTION reduction)
314
+ bint CMRspIsCopy(CMR_SP_REDUCTION reduction)
315
+ bint CMRspIsValid(CMR_SP_REDUCTION reduction)
316
+
317
+ CMR_ERROR CMRspTestBinary(CMR* cmr, CMR_CHRMAT* matrix, bool* pisSeriesParallel, CMR_SP_REDUCTION* reductions, size_t* pnumReductions, CMR_SUBMAT** preducedSubmatrix, CMR_SUBMAT** pviolatorSubmatrix, CMR_SP_STATISTICS* stats, double timeLimit)
318
+ CMR_ERROR CMRspTestTernary(CMR* cmr, CMR_CHRMAT* matrix, bool* pisSeriesParallel, CMR_SP_REDUCTION* reductions, size_t* pnumReductions, CMR_SUBMAT** preducedSubmatrix, CMR_SUBMAT** pviolatorSubmatrix, CMR_SP_STATISTICS* stats, double timeLimit)
319
+ CMR_ERROR CMRspDecomposeBinary(CMR* cmr, CMR_CHRMAT* matrix, bool* pisSeriesParallel, CMR_SP_REDUCTION* reductions, size_t maxNumReductions, size_t* pnumReductions, CMR_SUBMAT** preducedSubmatrix, CMR_SUBMAT** pviolatorSubmatrix, CMR_SEPA** pseparation, CMR_SP_STATISTICS* stats, double timeLimit)
320
+ CMR_ERROR CMRspDecomposeTernary(CMR* cmr, CMR_CHRMAT* matrix, bool* pisSeriesParallel, CMR_SP_REDUCTION* reductions, size_t maxNumReductions, size_t* pnumReductions, CMR_SUBMAT** preducedSubmatrix, CMR_SUBMAT** pviolatorSubmatrix, CMR_SEPA** pseparation, CMR_SP_STATISTICS* stats, double timeLimit)
321
+
322
+ cdef extern from "cmr/network.h":
323
+
324
+ ctypedef struct CMR_NETWORK_STATISTICS:
325
+ uint32_t totalCount
326
+ double totalTime
327
+ CMR_CAMION_STATISTICS camion
328
+ CMR_GRAPHIC_STATISTICS graphic
329
+
330
+ CMR_ERROR CMRnetworkStatsInit(CMR_NETWORK_STATISTICS* stats)
331
+ # CMR_ERROR CMRstatsNetworkPrint(FILE* stream, CMR_NETWORK_STATISTICS* stats, const char* prefix)
332
+ CMR_ERROR CMRnetworkComputeMatrix(CMR* cmr, CMR_GRAPH* digraph, CMR_CHRMAT** pmatrix, CMR_CHRMAT** ptranspose, bool* arcsReversed, int numForestArcs, CMR_GRAPH_EDGE* forestArcs, int numCoforestArcs, CMR_GRAPH_EDGE* coforestArcs, bool* pisCorrectForest)
333
+ CMR_ERROR CMRnetworkTestMatrix(CMR* cmr, CMR_CHRMAT* matrix, bool* pisNetwork, bool* psupportIsGraphic, CMR_GRAPH** pdigraph, CMR_GRAPH_EDGE** pforestArcs, CMR_GRAPH_EDGE** pcoforestArcs, bool** parcsReversed, CMR_SUBMAT** psubmatrix, CMR_NETWORK_STATISTICS* stats, double timeLimit)
334
+ CMR_ERROR CMRnetworkTestTranspose(CMR* cmr, CMR_CHRMAT* matrix, bool* pisConetwork, bool* psupportIsCographic, CMR_GRAPH** pdigraph, CMR_GRAPH_EDGE** pforestArcs, CMR_GRAPH_EDGE** pcoforestArcs, bool** parcsReversed, CMR_SUBMAT** psubmatrix, CMR_NETWORK_STATISTICS* stats, double timeLimit)
335
+
336
+
337
+ cdef extern from "cmr/seymour.h":
338
+
339
+ ctypedef int CMR_SEYMOUR_DECOMPOSE_FLAG
340
+
341
+ const int CMR_SEYMOUR_DECOMPOSE_FLAG_DISTRIBUTED_MASK
342
+ const int CMR_SEYMOUR_DECOMPOSE_FLAG_DISTRIBUTED_PIVOT
343
+ const int CMR_SEYMOUR_DECOMPOSE_FLAG_DISTRIBUTED_DELTASUM
344
+ const int CMR_SEYMOUR_DECOMPOSE_FLAG_DISTRIBUTED_YSUM
345
+ const int CMR_SEYMOUR_DECOMPOSE_FLAG_CONCENTRATED_MASK
346
+ const int CMR_SEYMOUR_DECOMPOSE_FLAG_CONCENTRATED_PIVOT
347
+ const int CMR_SEYMOUR_DECOMPOSE_FLAG_CONCENTRATED_THREESUM
348
+ const int CMR_SEYMOUR_DECOMPOSE_FLAG_SEYMOUR
349
+ const int CMR_SEYMOUR_DECOMPOSE_FLAG_TRUEMPER
350
+
351
+ ctypedef struct CMR_SEYMOUR_PARAMS:
352
+ bool stopWhenIrregular
353
+ bool stopWhenNongraphic
354
+ bool stopWhenNoncographic
355
+ bool stopWhenNeitherGraphicNorCoGraphic
356
+ bool seriesParallel
357
+ bool planarityCheck
358
+ bool directGraphicness
359
+ bool preferGraphicness
360
+ int decomposeStrategy
361
+ bool constructLeafGraphs
362
+ bool constructAllGraphs
363
+
364
+ CMR_ERROR CMRseymourParamsInit(CMR_SEYMOUR_PARAMS* params)
365
+
366
+ ctypedef struct CMR_SEYMOUR_STATS:
367
+ uint32_t totalCount
368
+ double totalTime
369
+ CMR_SP_STATISTICS seriesParallel
370
+ CMR_GRAPHIC_STATISTICS graphic
371
+ CMR_NETWORK_STATISTICS network
372
+ uint32_t sequenceExtensionCount
373
+ double sequenceExtensionTime
374
+ uint32_t sequenceGraphicCount
375
+ double sequenceGraphicTime
376
+ uint32_t enumerationCount
377
+ double enumerationTime
378
+ uint32_t enumerationCandidatesCount
379
+
380
+ CMR_ERROR CMRseymourStatsInit(CMR_SEYMOUR_STATS* stats)
381
+ # CMR_ERROR CMRseymourStatsPrint(FILE* stream, CMR_SEYMOUR_STATS* stats, const char* prefix)
382
+
383
+ ctypedef struct CMR_SEYMOUR_NODE
384
+
385
+ ctypedef int CMR_SEYMOUR_NODE_TYPE
386
+
387
+ const int CMR_SEYMOUR_NODE_TYPE_IRREGULAR
388
+ const int CMR_SEYMOUR_NODE_TYPE_UNKNOWN
389
+ const int CMR_SEYMOUR_NODE_TYPE_SERIES_PARALLEL
390
+ const int CMR_SEYMOUR_NODE_TYPE_PIVOTS
391
+ const int CMR_SEYMOUR_NODE_TYPE_GRAPH
392
+ const int CMR_SEYMOUR_NODE_TYPE_COGRAPH
393
+ const int CMR_SEYMOUR_NODE_TYPE_PLANAR
394
+ const int CMR_SEYMOUR_NODE_TYPE_R10
395
+ const int CMR_SEYMOUR_NODE_TYPE_ONESUM
396
+ const int CMR_SEYMOUR_NODE_TYPE_TWOSUM
397
+ const int CMR_SEYMOUR_NODE_TYPE_DELTASUM
398
+ const int CMR_SEYMOUR_NODE_TYPE_THREESUM
399
+ const int CMR_SEYMOUR_NODE_TYPE_YSUM
400
+
401
+ bool CMRseymourIsTernary(CMR_SEYMOUR_NODE* node)
402
+ bool CMRseymourHasTranspose(CMR_SEYMOUR_NODE* node)
403
+ CMR_CHRMAT* CMRseymourGetMatrix(CMR_SEYMOUR_NODE* node)
404
+ CMR_CHRMAT* CMRseymourGetTranspose(CMR_SEYMOUR_NODE* node)
405
+ size_t CMRseymourNumChildren(CMR_SEYMOUR_NODE* node)
406
+ CMR_SEYMOUR_NODE* CMRseymourChild(CMR_SEYMOUR_NODE* node, size_t childIndex)
407
+ CMR_SEYMOUR_NODE_TYPE CMRseymourType(CMR_SEYMOUR_NODE* node)
408
+ size_t CMRseymourNumMinors(CMR_SEYMOUR_NODE* node)
409
+ CMR_MINOR* CMRseymourMinor(CMR_SEYMOUR_NODE* node, size_t minorIndex)
410
+ int8_t CMRseymourGraphicness(CMR_SEYMOUR_NODE* node)
411
+ int8_t CMRseymourCographicness(CMR_SEYMOUR_NODE* node)
412
+ int8_t CMRseymourRegularity(CMR_SEYMOUR_NODE* node)
413
+ size_t CMRseymourNumRows(CMR_SEYMOUR_NODE* node)
414
+ size_t CMRseymourNumColumns(CMR_SEYMOUR_NODE* node)
415
+ CMR_ELEMENT* CMRseymourChildRowsToParent(CMR_SEYMOUR_NODE* node, size_t childIndex)
416
+ CMR_ELEMENT* CMRseymourChildColumnsToParent(CMR_SEYMOUR_NODE* node, size_t childIndex)
417
+ size_t* CMRseymourChildSpecialRows(CMR_SEYMOUR_NODE* node, size_t childIndex)
418
+ size_t* CMRseymourChildSpecialColumns(CMR_SEYMOUR_NODE* node, size_t childIndex)
419
+ CMR_GRAPH* CMRseymourGraph(CMR_SEYMOUR_NODE* node)
420
+ CMR_GRAPH_EDGE* CMRseymourGraphForest(CMR_SEYMOUR_NODE* node)
421
+ size_t CMRseymourGraphSizeForest(CMR_SEYMOUR_NODE* node)
422
+ CMR_GRAPH_EDGE* CMRseymourGraphCoforest(CMR_SEYMOUR_NODE* node)
423
+ size_t CMRseymourGraphSizeCoforest(CMR_SEYMOUR_NODE* node)
424
+ bool* CMRseymourGraphArcsReversed(CMR_SEYMOUR_NODE* node)
425
+ CMR_GRAPH* CMRseymourCograph(CMR_SEYMOUR_NODE* node)
426
+ size_t CMRseymourCographSizeForest(CMR_SEYMOUR_NODE* node)
427
+ CMR_GRAPH_EDGE* CMRseymourCographForest(CMR_SEYMOUR_NODE* node)
428
+ size_t CMRseymourCographSizeCoforest(CMR_SEYMOUR_NODE* node)
429
+ CMR_GRAPH_EDGE* CMRseymourCographCoforest(CMR_SEYMOUR_NODE* node)
430
+ bool* CMRseymourCographArcsReversed(CMR_SEYMOUR_NODE* node)
431
+ size_t CMRseymourNumPivots(CMR_SEYMOUR_NODE* node)
432
+ size_t* CMRseymourPivotRows(CMR_SEYMOUR_NODE* node)
433
+ size_t* CMRseymourPivotColumns(CMR_SEYMOUR_NODE* node)
434
+ size_t CMRseymourGetUsed(CMR_SEYMOUR_NODE* node)
435
+ # CMR_ERROR CMRseymourPrint(CMR* cmr, CMR_SEYMOUR_NODE* node, FILE* stream, bool printChildren, bool printParentElements, bool printMatrices, bool printGraphs, bool printReductions, bool printPivots)
436
+ CMR_ERROR CMRseymourCapture(CMR* cmr, CMR_SEYMOUR_NODE* node)
437
+ CMR_ERROR CMRseymourRelease(CMR* cmr, CMR_SEYMOUR_NODE** pnode)
438
+ CMR_ERROR CMRseymourCreate(CMR* cmr, CMR_SEYMOUR_NODE** pnode, bool isTernary, CMR_CHRMAT* matrix, bool copyMatrix)
439
+ CMR_ERROR CMRseymourCloneUnknown(CMR* cmr, CMR_SEYMOUR_NODE* node, CMR_SEYMOUR_NODE** pclone)
440
+ CMR_ERROR CMRseymourCloneSubtrees(CMR* cmr, size_t numSubtrees, CMR_SEYMOUR_NODE** subtreeRoots,CMR_SEYMOUR_NODE** clonedSubtrees)
441
+
442
+
443
+ cdef extern from "cmr/regular.h":
444
+
445
+ ctypedef struct CMR_REGULAR_PARAMS:
446
+ CMR_SEYMOUR_PARAMS seymour
447
+
448
+ CMR_ERROR CMRregularParamsInit(CMR_REGULAR_PARAMS* params)
449
+
450
+ ctypedef struct CMR_REGULAR_STATS:
451
+ CMR_SEYMOUR_STATS seymour
452
+
453
+ CMR_ERROR CMRregularStatsInit(CMR_REGULAR_STATS* stats)
454
+ # CMR_ERROR CMRstatsRegularPrint(FILE* stream, CMR_REGULAR_STATS* stats, const char* prefix)
455
+ CMR_ERROR CMRregularTest(CMR* cmr, CMR_CHRMAT* matrix, bool* pisRegular, CMR_SEYMOUR_NODE** pnode, CMR_MINOR** pminor, CMR_REGULAR_PARAMS* params, CMR_REGULAR_STATS* stats, double timeLimit)
456
+ CMR_ERROR CMRregularCompleteDecomposition(CMR* cmr, CMR_SEYMOUR_NODE* node, CMR_REGULAR_PARAMS* params, CMR_REGULAR_STATS* stats, double timeLimit)
457
+ CMR_ERROR CMRregularRefineDecomposition(CMR* cmr, size_t numNodes, CMR_SEYMOUR_NODE** nodes, CMR_REGULAR_PARAMS* params, CMR_REGULAR_STATS* stats, double timeLimit)
458
+
459
+
460
+ cdef extern from "cmr/tu.h":
461
+
462
+ const int CMR_TU_ALGORITHM_DECOMPOSITION
463
+ const int CMR_TU_ALGORITHM_EULERIAN
464
+ const int CMR_TU_ALGORITHM_PARTITION
465
+
466
+ ctypedef int CMR_TU_ALGORITHM
467
+
468
+ ctypedef struct CMR_TU_PARAMS:
469
+ CMR_TU_ALGORITHM algorithm
470
+ CMR_SEYMOUR_PARAMS seymour
471
+ bool ternary
472
+ bool camionFirst
473
+ bool naiveSubmatrix
474
+
475
+ CMR_ERROR CMRtuParamsInit(CMR_TU_PARAMS* params)
476
+
477
+ ctypedef struct CMR_TU_STATS:
478
+ CMR_SEYMOUR_STATS seymour
479
+ CMR_CAMION_STATISTICS camion
480
+
481
+ uint32_t enumerationRowSubsets
482
+ uint32_t enumerationColumnSubsets
483
+ double enumerationTime
484
+
485
+ uint32_t partitionRowSubsets
486
+ uint32_t partitionColumnSubsets
487
+ double partitionTime
488
+
489
+ CMR_ERROR CMRtuStatsInit(CMR_TU_STATS* stats)
490
+ # CMR_ERROR CMRtuStatsPrint(FILE* stream, CMR_TU_STATS* stats, const char* prefix)
491
+ CMR_ERROR CMRtuTest(CMR* cmr, CMR_CHRMAT* matrix, bool* pisTotallyUnimodular, CMR_SEYMOUR_NODE** proot, CMR_SUBMAT** psubmatrix, CMR_TU_PARAMS* params, CMR_TU_STATS* stats, double timeLimit)
492
+ CMR_ERROR CMRtuCompleteDecomposition(CMR* cmr, CMR_SEYMOUR_NODE* node, CMR_TU_PARAMS* params, CMR_TU_STATS* stats, double timeLimit)
493
+
494
+
495
+ cdef extern from "cmr/equimodular.h":
496
+
497
+ ctypedef struct CMR_EQUIMODULAR_PARAMS:
498
+ CMR_TU_PARAMS tu
499
+
500
+ CMR_ERROR CMRequimodularParamsInit(CMR_EQUIMODULAR_PARAMS* params)
501
+
502
+ ctypedef struct CMR_EQUIMODULAR_STATS:
503
+ uint32_t totalCount
504
+ double totalTime
505
+ double linalgTime
506
+ CMR_TU_STATS tu
507
+
508
+ CMR_ERROR CMRequimodularStatsInit(CMR_EQUIMODULAR_STATS* stats)
509
+
510
+ CMR_ERROR CMRequimodularTest(CMR* cmr, CMR_INTMAT* matrix,
511
+ bool* pisEquimodular, int64_t *pgcdDet,
512
+ CMR_EQUIMODULAR_PARAMS* params, CMR_EQUIMODULAR_STATS* stats,
513
+ double timeLimit)
514
+ CMR_ERROR CMRequimodularTestStrong(CMR* cmr, CMR_INTMAT* matrix,
515
+ bool* pisStronglyEquimodular, int64_t *pgcdDet,
516
+ CMR_EQUIMODULAR_PARAMS* params, CMR_EQUIMODULAR_STATS* stats,
517
+ double timeLimit)
518
+ CMR_ERROR CMRunimodularTest(CMR* cmr, CMR_INTMAT* matrix,
519
+ bool* pisUnimodular,
520
+ CMR_EQUIMODULAR_PARAMS* params, CMR_EQUIMODULAR_STATS* stats,
521
+ double timeLimit)
522
+ CMR_ERROR CMRunimodularTestStrong(CMR* cmr, CMR_INTMAT* matrix,
523
+ bool* pisStronglyUnimodular,
524
+ CMR_EQUIMODULAR_PARAMS* params, CMR_EQUIMODULAR_STATS* stats,
525
+ double timeLimit)
526
+
527
+
528
+ cdef extern from "cmr/ctu.h":
529
+
530
+ ctypedef struct CMR_CTU_PARAMS:
531
+ CMR_TU_PARAMS tu
532
+
533
+ CMR_ERROR CMRctuParamsInit(CMR_CTU_PARAMS* params)
534
+
535
+ ctypedef struct CMR_CTU_STATS:
536
+ uint32_t totalCount
537
+ double totalTime
538
+ CMR_TU_STATS tu
539
+
540
+ CMR_ERROR CMRstatsComplementTotalUnimodularityInit(CMR_CTU_STATS* stats)
541
+ # CMR_ERROR CMRstatsComplementTotalUnimodularityPrint(FILE* stream, CMR_CTU_STATS* stats, const char* prefix)
542
+ CMR_ERROR CMRctuComplementRowColumn(CMR* cmr, CMR_CHRMAT* matrix, size_t complementRow, size_t complementColumn, CMR_CHRMAT** presult)
543
+ CMR_ERROR CMRctuTest(CMR* cmr, CMR_CHRMAT* matrix, bool* pisComplementTotallyUnimodular, size_t* pcomplementRow, size_t* pcomplementColumn, CMR_CTU_PARAMS* params, CMR_CTU_STATS* stats, double timeLimit)
544
+
545
+
546
+ cdef extern from "cmr/balanced.h":
547
+ ctypedef int CMR_BALANCED_ALGORITHM
548
+
549
+ const int CMR_BALANCED_ALGORITHM_AUTO
550
+ const int CMR_BALANCED_ALGORITHM_SUBMATRIX
551
+ const int CMR_BALANCED_ALGORITHM_GRAPH
552
+
553
+ ctypedef struct CMR_BALANCED_PARAMS:
554
+ CMR_BALANCED_ALGORITHM algorithm
555
+ bool seriesParallel
556
+
557
+ ctypedef struct CMR_BALANCED_STATS:
558
+ uint32_t totalCount
559
+ double totalTime
560
+ CMR_SP_STATISTICS seriesParallel
561
+ size_t enumeratedRowSubsets
562
+ size_t enumeratedColumnSubsets
563
+
564
+ CMR_ERROR CMRbalancedParamsInit(CMR_BALANCED_PARAMS* params)
565
+
566
+ CMR_ERROR CMRbalancedStatsInit(CMR_BALANCED_STATS* stats)
567
+
568
+ # CMR_ERROR CMRbalancedStatsPrint(FILE* stream, CMR_BALANCED_STATS* stats, const char* prefix)
569
+
570
+ CMR_ERROR CMRbalancedTest(CMR* cmr, CMR_CHRMAT* matrix, bool* pisBalanced, CMR_SUBMAT** psubmatrix, CMR_BALANCED_PARAMS* params, CMR_BALANCED_STATS* stats, double timeLimit)
571
+
572
+
573
+ # cdef extern from "cmr/block_decomposition.h":
574
+
575
+ # ctypedef struct CMR_MATRIX
576
+
577
+ # ctypedef struct CMR_BLOCK:
578
+ # CMR_MATRIX* matrix
579
+ # CMR_MATRIX* transpose
580
+ # size_t* rowsToOriginal
581
+ # size_t* columnsToOriginal
582
+
583
+ # CMR_ERROR CMRdecomposeBlocks(
584
+ # CMR* cmr,
585
+ # CMR_MATRIX* matrix,
586
+ # size_t matrixType,
587
+ # size_t targetType,
588
+ # size_t* pnumBlocks,
589
+ # CMR_BLOCK** pblocks,
590
+ # size_t* rowsToBlock,
591
+ # size_t* columnsToBlock,
592
+ # size_t* rowsToBlockRows,
593
+ # size_t* columnsToBlockColumns
594
+ # )
595
+
596
+
597
+ # Our global CMR environment
598
+ cdef CMR *cmr
599
+
600
+ cdef CMR_CALL(CMR_ERROR _cmr_error)
sage/libs/cmr/cmr.pyx ADDED
@@ -0,0 +1,24 @@
1
+ # sage_setup: distribution = sagemath-cmr
2
+ # -*- python -*-
3
+
4
+ cdef CMR *cmr = NULL
5
+
6
+
7
+ cdef CMR_CALL(CMR_ERROR _cmr_error):
8
+ if _cmr_error == CMR_OKAY:
9
+ return
10
+ if _cmr_error == CMR_ERROR_INPUT:
11
+ raise RuntimeError("User input error")
12
+ if _cmr_error == CMR_ERROR_MEMORY:
13
+ raise RuntimeError("Memory (re)allocation failed")
14
+ if _cmr_error == CMR_ERROR_INVALID:
15
+ raise RuntimeError("Invalid input")
16
+ if _cmr_error == CMR_ERROR_TIMEOUT:
17
+ raise RuntimeError("Time limit exceeded")
18
+ if _cmr_error == CMR_ERROR_STRUCTURE:
19
+ raise RuntimeError("Invalid matrix structure")
20
+ if _cmr_error == CMR_ERROR_INCONSISTENT:
21
+ raise RuntimeError("Inconsistent pieces of input")
22
+ if _cmr_error == CMR_ERROR_PARAMS:
23
+ raise RuntimeError("Invalid parameters provided")
24
+ raise RuntimeError("Unknown error")
@@ -0,0 +1 @@
1
+ # sage_setup: distribution = sagemath-cmr
@@ -0,0 +1,33 @@
1
+ # sage_setup: distribution = sagemath-cmr
2
+ from sage.libs.cmr.cmr cimport CMR_CHRMAT, CMR_SEYMOUR_PARAMS, CMR_GRAPH, CMR_GRAPH_EDGE, bool
3
+
4
+ from sage.matrix.matrix_sparse cimport Matrix_sparse
5
+
6
+ cdef class Matrix_cmr_sparse(Matrix_sparse):
7
+ pass
8
+
9
+ # cdef class Matrix_cmr_double_sparse(Matrix_cmr_sparse):
10
+ # pass
11
+
12
+ # cdef class Matrix_cmr_int_sparse(Matrix_cmr_sparse):
13
+ # pass
14
+
15
+ cdef class Matrix_cmr_chr_sparse(Matrix_cmr_sparse):
16
+
17
+ cdef CMR_CHRMAT *_mat
18
+ cdef object _root
19
+
20
+ cdef _init_from_dict(self, dict d, int nrows, int ncols, bint immutable=?)
21
+
22
+ @staticmethod
23
+ cdef _from_cmr(CMR_CHRMAT *mat, bint immutable=?, base_ring=?)
24
+
25
+ cdef _set_cmr_seymour_parameters(CMR_SEYMOUR_PARAMS *params, dict kwds)
26
+
27
+ cdef _sage_edge(CMR_GRAPH *graph, CMR_GRAPH_EDGE e)
28
+ cdef _sage_edges(CMR_GRAPH *graph, CMR_GRAPH_EDGE *edges, int n, keys)
29
+ cdef _sage_graph(CMR_GRAPH *graph)
30
+
31
+ cdef _sage_arc(CMR_GRAPH *graph, CMR_GRAPH_EDGE e, bint reversed)
32
+ cdef _sage_arcs(CMR_GRAPH *graph, CMR_GRAPH_EDGE *arcs, bool *arcs_reversed, n, keys)
33
+ cdef _sage_digraph(CMR_GRAPH *graph, bool *arcs_reversed)