1#ifndef CMR_SEPARATION_H
2#define CMR_SEPARATION_H
102 size_t* pnumRowsTopLeft,
103 size_t* pnumColumnsTopLeft,
104 size_t* pnumRowsBottomRight,
105 size_t* pnumColumnsBottomRight
153 size_t reprRows[2][3],
154 size_t reprColumns[2][3]
166 size_t* columnsToPart,
167 size_t* pnumPartRows,
168 size_t* pnumPartColumns
275 size_t* firstSpecialRows,
276 size_t* firstSpecialColumns,
277 size_t* secondSpecialRows,
278 size_t* secondSpecialColumns,
279 int8_t characteristic,
311 size_t* firstRowsOrigin,
313 size_t* firstColumnsOrigin,
317 size_t* columnsToFirst,
319 size_t* firstSpecialRows,
321 size_t* firstSpecialColumns
354 size_t* secondRowsOrigin,
356 size_t* secondColumnsOrigin,
358 size_t* rowsToSecond,
360 size_t* columnsToSecond,
362 size_t* secondSpecialRows,
364 size_t* secondSpecialColumns
409 size_t* firstSpecialRows,
412 size_t* firstSpecialColumns,
416 size_t* secondSpecialRows,
419 size_t* secondSpecialColumns,
423 int8_t characteristic,
484 size_t* firstRowsOrigin,
486 size_t* firstColumnsOrigin,
490 size_t* columnsToFirst,
492 size_t* firstSpecialRows,
495 size_t* firstSpecialColumns
530 size_t* secondRowsOrigin,
532 size_t* secondColumnsOrigin,
534 size_t* rowsToSecond,
536 size_t* columnsToSecond,
538 size_t* secondSpecialRows,
541 size_t* secondSpecialColumns
590 size_t* firstSpecialRows,
594 size_t* firstSpecialColumns,
597 size_t* secondSpecialRows,
601 size_t* secondSpecialColumns,
604 int8_t characteristic,
667 size_t* firstRowsOrigin,
669 size_t* firstColumnsOrigin,
673 size_t* columnsToFirst,
675 size_t* firstSpecialRows,
679 size_t* firstSpecialColumns
714 size_t* secondRowsOrigin,
716 size_t* secondColumnsOrigin,
718 size_t* rowsToSecond,
720 size_t* columnsToSecond,
722 size_t* secondSpecialRows,
726 size_t* secondSpecialColumns
792 size_t* firstSpecialRows,
793 size_t* firstSpecialColumns,
794 size_t* secondSpecialRows,
795 size_t* secondSpecialColumns,
796 int8_t characteristic,
848 size_t* specialColumns,
900 size_t* specialColumns,
955 size_t* specialColumns,
958 size_t* firstRowsOrigin,
960 size_t* firstColumnsOrigin,
964 size_t* columnsToFirst,
966 size_t* firstSpecialRows,
968 size_t* firstSpecialColumns
1021 size_t* specialRows,
1022 size_t* specialColumns,
1026 size_t* secondRowsOrigin,
1028 size_t* secondColumnsOrigin,
1030 size_t* rowsToSecond,
1032 size_t* columnsToSecond,
1034 size_t* secondSpecialRows,
1036 size_t* secondSpecialColumns
Functionality for the row and column elements of a matrix.
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 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)
Composes the 2-sum of the two matrices first and second with connecting elements firstMarker and seco...
Definition separation.c:1047
CMR_EXPORT CMR_ERROR CMRonesumCompose(CMR *cmr, size_t numMatrices, CMR_CHRMAT **matrices, CMR_CHRMAT **presult)
Composes the 1-sum of the several matrices.
Definition separation.c:997
CMR_EXPORT CMR_ERROR CMRthreesumDecomposeSearchConnecting(CMR *cmr, CMR_CHRMAT *matrix, CMR_CHRMAT *transpose, CMR_SEPA *sepa, size_t *specialRows, size_t *specialColumns, char *pgamma, char *pbeta)
Decomposes matrix as a 3-sum according to the 3-separation sepa, searching a suitable connecing matri...
Definition separation.c:3456
CMR_EXPORT CMR_ERROR CMRdeltasumDecomposeSecond(CMR *cmr, CMR_CHRMAT *matrix, CMR_SEPA *sepa, char epsilon, CMR_CHRMAT **psecond, size_t *secondRowsOrigin, size_t *secondColumnsOrigin, size_t *rowsToSecond, size_t *columnsToSecond, size_t *secondSpecialRows, size_t *secondSpecialColumns)
Decomposes matrix as a -sum according to the 3-separation sepa, computing the second component.
Definition separation.c:2237
CMR_EXPORT CMR_ERROR CMRysumDecomposeSecond(CMR *cmr, CMR_CHRMAT *matrix, CMR_SEPA *sepa, char epsilon, CMR_CHRMAT **psecond, size_t *secondRowsOrigin, size_t *secondColumnsOrigin, size_t *rowsToSecond, size_t *columnsToSecond, size_t *secondSpecialRows, size_t *secondSpecialColumns)
Decomposes matrix as a Y-sum according to the 3-separation sepa, computing the second component.
Definition separation.c:2476
CMR_EXPORT CMR_ERROR CMRysumDecomposeFirst(CMR *cmr, CMR_CHRMAT *matrix, CMR_SEPA *sepa, char epsilon, CMR_CHRMAT **pfirst, size_t *firstRowsOrigin, size_t *firstColumnsOrigin, size_t *rowsToFirst, size_t *columnsToFirst, size_t *firstSpecialRows, size_t *firstSpecialColumns)
Decomposes matrix as a Y-sum according to the 3-separation sepa, computing the first component.
Definition separation.c:2450
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:735
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:969
CMR_EXPORT CMR_ERROR CMRsepaTranspose(CMR *cmr, CMR_SEPA *sepa, CMR_SEPA **ptransposed)
Transposes a given separation.
Definition separation.c:47
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:62
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:644
CMR_EXPORT 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)
Decomposes matrix as a 2-sum according to the 2-separation sepa, computing the second component.
Definition separation.c:1413
CMR_EXPORT 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)
Constructs the 3-sum of the two matrices first and second at connecting rows firstSpecialRows and sec...
Definition separation.c:2502
CMR_EXPORT CMR_ERROR CMRthreesumDecomposeFirst(CMR *cmr, CMR_CHRMAT *matrix, CMR_SEPA *sepa, size_t *specialRows, size_t *specialColumns, char beta, CMR_CHRMAT **pfirst, size_t *firstRowsOrigin, size_t *firstColumnsOrigin, size_t *rowsToFirst, size_t *columnsToFirst, size_t *firstSpecialRows, size_t *firstSpecialColumns)
Decomposes matrix as a 3-sum according to the 3-separation sepa, computing the first component.
Definition separation.c:3491
CMR_EXPORT CMR_ERROR CMRsepaFree(CMR *cmr, CMR_SEPA **psepa)
Frees a separation.
Definition separation.c:31
CMR_EXPORT 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)
Constructs the Y-sum of the two matrices first and second.
Definition separation.c:2413
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 CMRysumDecomposeEpsilon(CMR *cmr, CMR_CHRMAT *matrix, CMR_CHRMAT *transpose, CMR_SEPA *sepa, char *pepsilon)
Decomposes matrix as a Y-sum according to the 3-separation sepa, computing .
Definition separation.c:2434
CMR_EXPORT 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)
Constructs the -sum of the two matrices first and second.
Definition separation.c:1589
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:13
CMR_EXPORT CMR_ERROR CMRthreesumDecomposeSignConnecting(CMR *cmr, CMR_CHRMAT *matrix, CMR_CHRMAT *transpose, CMR_SEPA *sepa, size_t *specialRows, size_t *specialColumns, char *pgamma, char *pbeta)
Decomposes matrix as a 3-sum according to the 3-separation sepa, searching a suitable connecing matri...
Definition separation.c:3474
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:669
CMR_EXPORT CMR_ERROR CMRsepaGetRepresentatives(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:688
CMR_EXPORT CMR_ERROR CMRthreesumDecomposeSecond(CMR *cmr, CMR_CHRMAT *matrix, CMR_SEPA *sepa, size_t *specialRows, size_t *specialColumns, char gamma, CMR_CHRMAT **psecond, size_t *secondRowsOrigin, size_t *secondColumnsOrigin, size_t *rowsToSecond, size_t *columnsToSecond, size_t *secondSpecialRows, size_t *secondSpecialColumns)
Decomposes matrix as a 3-sum according to the 3-separation sepa, computing the second component.
Definition separation.c:3619
CMR_EXPORT CMR_ERROR CMRdeltasumDecomposeFirst(CMR *cmr, CMR_CHRMAT *matrix, CMR_SEPA *sepa, char epsilon, CMR_CHRMAT **pfirst, size_t *firstRowsOrigin, size_t *firstColumnsOrigin, size_t *rowsToFirst, size_t *columnsToFirst, size_t *firstSpecialRows, size_t *firstSpecialColumns)
Decomposes matrix as a -sum according to the 3-separation sepa, computing the first component.
Definition separation.c:2078
CMR_EXPORT CMR_ERROR CMRdeltasumDecomposeEpsilon(CMR *cmr, CMR_CHRMAT *matrix, CMR_CHRMAT *transpose, CMR_SEPA *sepa, char *pepsilon)
Decomposes matrix as a -sum according to the 3-separation sepa, computing .
Definition separation.c:1963
CMR_EXPORT 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)
Decomposes matrix as a 2-sum according to the 2-separation sepa, computing the first component.
Definition separation.c:1263
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:939
Row-wise representation of sparse char matrix.
Definition matrix.h:235
Definition env_internal.h:45
Definition separation.h:52
int * columnsFlags
Array with each column's flags; logical OR of CMR_SEPA_TYPE.
Definition separation.h:56
size_t numRows
Number of rows of the matrix.
Definition separation.h:53
int * rowsFlags
Array with each row's flags; logical OR of CMR_SEPA_TYPE.
Definition separation.h:55
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