CMR  1.3.0
separation.h
Go to the documentation of this file.
1 #ifndef CMR_SEPARATION_H
2 #define CMR_SEPARATION_H
3 
4 #include <cmr/env.h>
5 #include <cmr/matrix.h>
6 #include <cmr/element.h>
7 
8 #include <assert.h>
9 #include <stdint.h>
10 
19 #ifdef __cplusplus
20 extern "C" {
21 #endif
22 
23 typedef enum
24 {
25  CMR_SEPA_FIRST = 0,
27  CMR_SEPA_SECOND = 1,
40 
41 typedef enum
42 {
50 
51 typedef struct
52 {
53  size_t numRows;
54  size_t numColumns;
58 } CMR_SEPA;
59 
66 CMR_EXPORT
68  CMR* cmr,
69  size_t numRows,
70  size_t numColumns,
71  CMR_SEPA** psepa
72 );
73 
78 CMR_EXPORT
80  CMR* cmr,
81  CMR_SEPA** psepa
82 );
83 
88 CMR_EXPORT
90  CMR_SEPA* sepa,
91  size_t* pnumRowsTopLeft,
92  size_t* pnumColumnsTopLeft,
93  size_t* pnumRowsBottomRight,
94  size_t* pnumColumnsBottomRight
95 );
96 
105 CMR_EXPORT
107  CMR* cmr,
108  CMR_SEPA* sepa,
109  CMR_CHRMAT* matrix,
110  CMR_CHRMAT* transpose,
111  bool* pswapped,
112  CMR_SUBMAT** pviolator
113 );
114 
124 CMR_EXPORT
126  CMR* cmr,
127  CMR_SEPA* sepa,
128  CMR_CHRMAT* matrix,
129  CMR_CHRMAT* transpose,
130  CMR_SUBMAT* submatrix,
131  bool* pswapped,
132  CMR_SUBMAT** pviolator
133 );
134 
139 CMR_EXPORT
141  CMR* cmr,
142  CMR_SEPA* sepa,
143  size_t reprRows[2][3],
144  size_t reprColumns[2][3]
145 );
146 
151 CMR_EXPORT
153  CMR_SEPA* sepa,
154  size_t part,
155  size_t* rowsToPart,
156  size_t* columnsToPart,
157  size_t* pnumPartRows,
158  size_t* pnumPartColumns
159 );
160 
170 CMR_EXPORT
172  CMR* cmr,
173  CMR_SEPA* sepa,
174  CMR_CHRMAT* matrix,
175  bool* pisTernary,
176  CMR_SUBMAT** pviolator
177 );
178 
189 CMR_EXPORT
191  CMR* cmr,
192  CMR_SEPA* sepa,
193  CMR_CHRMAT* matrix,
194  CMR_SUBMAT* submatrix,
195  bool* pisTernary,
196  CMR_SUBMAT** pviolator
197 );
198 
213 CMR_EXPORT
215  CMR* cmr,
216  CMR_CHRMAT* first,
217  CMR_CHRMAT* second,
218  CMR_CHRMAT** presult
219 );
220 
247 CMR_EXPORT
249  CMR* cmr,
250  CMR_CHRMAT* first,
251  CMR_CHRMAT* second,
252  CMR_ELEMENT firstMarker,
253  CMR_ELEMENT secondMarker,
254  int8_t characteristic,
255  CMR_CHRMAT** presult
256 );
257 
300 CMR_EXPORT
302  CMR* cmr,
303  CMR_CHRMAT* first,
304  CMR_CHRMAT* second,
305  CMR_ELEMENT firstMarker1,
306  CMR_ELEMENT secondMarker1,
307  CMR_ELEMENT firstMarker2,
308  CMR_ELEMENT secondMarker2,
309  int8_t characteristic,
310  CMR_CHRMAT** presult
311 );
312 
313 
314 #ifdef __cplusplus
315 }
316 #endif
317 
318 #endif /* CMR_SEPARATION_H */
Functionality for the row and column elements of a matrix.
int CMR_ELEMENT
Definition: element.h:20
Basic functionality of the software library.
CMR_ERROR
Type for return codes of library functions.
Definition: env.h:32
Functionality for sparse matrices.
CMR_EXPORT CMR_ERROR CMRoneSum(CMR *cmr, CMR_CHRMAT *first, CMR_CHRMAT *second, CMR_CHRMAT **presult)
Constructs the 1-sum of the two matrices first and second.
Definition: separation.c:981
CMR_EXPORT CMR_ERROR CMRsepaGetProjection(CMR_SEPA *sepa, size_t part, size_t *rowsToPart, size_t *columnsToPart, size_t *pnumPartRows, size_t *pnumPartColumns)
Creates mappings from rows/columns to those of part; also maps up to 3 representative rows/columns.
Definition: separation.c:719
CMR_EXPORT CMR_ERROR CMRsepaCheckTernarySubmatrix(CMR *cmr, CMR_SEPA *sepa, CMR_CHRMAT *matrix, CMR_SUBMAT *submatrix, bool *pisTernary, CMR_SUBMAT **pviolator)
Checks for a submatrix of a given matrix whether the binary k-separation is also a ternary one.
Definition: separation.c:953
CMR_SEPA_TYPE
Definition: separation.h:42
@ CMR_SEPA_TYPE_TWO
Definition: separation.h:43
@ CMR_SEPA_TYPE_THREE_DISTRIBUTED_RANKS
Definition: separation.h:45
@ CMR_SEPA_TYPE_THREE_CONCENTRATED_RANK
Definition: separation.h:47
CMR_EXPORT CMR_ERROR CMRsepaComputeSizes(CMR_SEPA *sepa, size_t *pnumRowsTopLeft, size_t *pnumColumnsTopLeft, size_t *pnumRowsBottomRight, size_t *pnumColumnsBottomRight)
Computes the sizes of the top-left and bottom-right parts.
Definition: separation.c:45
CMR_EXPORT CMR_ERROR CMRsepaFindBinaryRepresentatives(CMR *cmr, CMR_SEPA *sepa, CMR_CHRMAT *matrix, CMR_CHRMAT *transpose, bool *pswapped, CMR_SUBMAT **pviolator)
Scans the support of matrix to compute all representative rows/columns for sepa and sets the type.
Definition: separation.c:627
CMR_EXPORT CMR_ERROR CMRtwoSum(CMR *cmr, CMR_CHRMAT *first, CMR_CHRMAT *second, CMR_ELEMENT firstMarker, CMR_ELEMENT secondMarker, int8_t characteristic, CMR_CHRMAT **presult)
Constructs the 2-sum of the two matrices first and second via firstMarker and secondMarker.
Definition: separation.c:1013
CMR_EXPORT CMR_ERROR CMRsepaGetRepresentatives(CMR *cmr, CMR_SEPA *sepa, size_t reprRows[2][3], size_t reprColumns[2][3])
Returns representative rows/columns of the low-rank submatrices.
Definition: separation.c:671
CMR_EXPORT CMR_ERROR CMRsepaFree(CMR *cmr, CMR_SEPA **psepa)
Frees a separation.
Definition: separation.c:29
CMR_SEPA_FLAGS
Definition: separation.h:24
@ CMR_SEPA_SECOND
Definition: separation.h:27
@ CMR_SEPA_MASK_EXTRA
Definition: separation.h:37
@ CMR_SEPA_FIRST
Definition: separation.h:25
@ CMR_SEPA_FLAG_RANK2
Definition: separation.h:31
@ CMR_SEPA_FLAG_RANK1
Definition: separation.h:29
@ CMR_SEPA_MASK_CHILD
Definition: separation.h:35
CMR_EXPORT CMR_ERROR CMRthreeSum(CMR *cmr, CMR_CHRMAT *first, CMR_CHRMAT *second, CMR_ELEMENT firstMarker1, CMR_ELEMENT secondMarker1, CMR_ELEMENT firstMarker2, CMR_ELEMENT secondMarker2, int8_t characteristic, CMR_CHRMAT **presult)
Constructs the 3-sum of the two matrices first and second via firstMarker1, firstMarker2,...
Definition: separation.c:1225
CMR_EXPORT CMR_ERROR CMRsepaCreate(CMR *cmr, size_t numRows, size_t numColumns, CMR_SEPA **psepa)
Creates a 2- or 3-separation.
Definition: separation.c:11
CMR_EXPORT CMR_ERROR CMRsepaFindBinaryRepresentativesSubmatrix(CMR *cmr, CMR_SEPA *sepa, CMR_CHRMAT *matrix, CMR_CHRMAT *transpose, CMR_SUBMAT *submatrix, bool *pswapped, CMR_SUBMAT **pviolator)
Scans the support of submatrix of matrix to compute all representative rows/columns for sepa and sets...
Definition: separation.c:652
CMR_EXPORT CMR_ERROR CMRsepaCheckTernary(CMR *cmr, CMR_SEPA *sepa, CMR_CHRMAT *matrix, bool *pisTernary, CMR_SUBMAT **pviolator)
Checks for a given matrix whether the binary k-separation is also a ternary one.
Definition: separation.c:923
Row-wise representation of sparse char matrix.
Definition: matrix.h:204
Definition: env_internal.h:45
Definition: separation.h:52
CMR_SEPA_FLAGS * rowsFlags
Array with each row's flags.
Definition: separation.h:55
size_t numRows
Number of rows of the matrix.
Definition: separation.h:53
CMR_SEPA_FLAGS * columnsFlags
Array with each column's flags.
Definition: separation.h:56
size_t numColumns
Number of columns of the matrix.
Definition: separation.h:54
CMR_SEPA_TYPE type
Type of separation.
Definition: separation.h:57
Row and column indices for a submatrix.
Definition: matrix.h:28