CMR  1.3.0
matrix.h
Go to the documentation of this file.
1 #ifndef CMR_MATRIX_H
2 #define CMR_MATRIX_H
3 
12 #include <cmr/env.h>
13 
14 #include <stdio.h>
15 
16 #ifdef __cplusplus
17 extern "C" {
18 #endif
19 
20 
27 typedef struct
28 {
29  size_t numRows;
30  size_t* rows;
31  size_t numColumns;
32  size_t* columns;
33 } CMR_SUBMAT;
34 
35 
42 CMR_EXPORT
44  CMR* cmr,
45  size_t numRows,
46  size_t numColumns,
47  CMR_SUBMAT** psubmatrix
48 );
49 
54 CMR_EXPORT
56  CMR* cmr,
57  size_t row,
58  size_t column,
59  CMR_SUBMAT** psubmatrix
60 );
61 
66 CMR_EXPORT
68  CMR* cmr,
69  CMR_SUBMAT** psubmatrix
70 );
71 
76 CMR_EXPORT
78  CMR_SUBMAT* submatrix
79 );
80 
88 CMR_EXPORT
90  CMR* cmr,
91  CMR_SUBMAT* reference,
92  CMR_SUBMAT* input,
93  CMR_SUBMAT** poutput
94 );
95 
100 CMR_EXPORT
102  CMR* cmr,
103  CMR_SUBMAT* submatrix,
104  size_t numRows,
105  size_t numColumns,
106  FILE* stream
107 );
108 
113 CMR_EXPORT
115  CMR* cmr,
116  CMR_SUBMAT* submatrix,
117  size_t numRows,
118  size_t numColumns,
119  const char* fileName
120 );
121 
126 CMR_EXPORT
128  CMR* cmr,
129  CMR_SUBMAT** psubmatrix,
130  size_t* pnumMatrixRows,
131  size_t* pnumMatrixColumns,
132  FILE* stream
133 );
134 
149 typedef struct
150 {
151  size_t numRows;
152  size_t numColumns;
153  size_t numNonzeros;
154  size_t* rowSlice;
155  size_t* entryColumns;
156  double* entryValues;
157 } CMR_DBLMAT;
158 
173 typedef struct
174 {
175  size_t numRows;
176  size_t numColumns;
177  size_t numNonzeros;
178  size_t * rowSlice;
179  size_t* entryColumns;
180  int* entryValues;
181 } CMR_INTMAT;
182 
197 typedef struct
198 {
199  size_t numRows;
200  size_t numColumns;
201  size_t numNonzeros;
202  size_t* rowSlice;
203  size_t* entryColumns;
204  char* entryValues;
205 } CMR_CHRMAT;
206 
212 CMR_EXPORT
214  CMR* cmr,
215  CMR_DBLMAT** presult,
216  int numRows,
217  int numColumns,
218  int numNonzeros
219 );
220 
227 CMR_EXPORT
229  CMR* cmr,
230  CMR_INTMAT** presult,
231  int numRows,
232  int numColumns,
233  int numNonzeros
234 );
235 
241 CMR_EXPORT
243  CMR* cmr,
244  CMR_CHRMAT** presult,
245  int numRows,
246  int numColumns,
247  int numNonzeros
248 );
249 
254 CMR_EXPORT
256  CMR* cmr,
257  CMR_DBLMAT** pmatrix
258 );
259 
264 CMR_EXPORT
266  CMR* cmr,
267  CMR_INTMAT** pmatrix
268 );
269 
274 CMR_EXPORT
276  CMR* cmr,
277  CMR_CHRMAT** pmatrix
278 );
279 
284 CMR_EXPORT
286  CMR* cmr,
287  CMR_DBLMAT* matrix,
288  size_t newNumNonzeros
289 );
290 
295 CMR_EXPORT
297  CMR* cmr,
298  CMR_INTMAT* matrix,
299  size_t newNumNonzeros
300 );
301 
306 CMR_EXPORT
308  CMR* cmr,
309  CMR_CHRMAT* matrix,
310  size_t newNumNonzeros
311 );
312 
317 CMR_EXPORT
319  CMR* cmr,
320  CMR_DBLMAT* matrix
321 );
322 
327 CMR_EXPORT
329  CMR* cmr,
330  CMR_INTMAT* matrix
331 );
332 
337 CMR_EXPORT
339  CMR* cmr,
340  CMR_CHRMAT* matrix
341 );
342 
347 CMR_EXPORT
349  CMR* cmr,
350  CMR_DBLMAT* matrix,
351  CMR_DBLMAT** presult
352 );
353 
358 CMR_EXPORT
360  CMR* cmr,
361  CMR_INTMAT* matrix,
362  CMR_INTMAT** presult
363 );
364 
369 CMR_EXPORT
371  CMR* cmr,
372  CMR_CHRMAT* matrix,
373  CMR_CHRMAT** presult
374 );
375 
380 CMR_EXPORT
382  CMR* cmr,
383  CMR_DBLMAT* matrix,
384  CMR_DBLMAT** presult
385 );
386 
391 CMR_EXPORT
393  CMR* cmr,
394  CMR_INTMAT* matrix,
395  CMR_INTMAT** presult
396 );
397 
402 CMR_EXPORT
404  CMR* cmr,
405  CMR_CHRMAT* matrix,
406  CMR_CHRMAT** presult
407 );
408 
413 CMR_EXPORT
415  CMR* cmr,
416  CMR_DBLMAT* matrix,
417  size_t* rows,
418  size_t* columns,
419  CMR_DBLMAT** presult
420 );
421 
426 CMR_EXPORT
428  CMR* cmr,
429  CMR_INTMAT* matrix,
430  size_t* rows,
431  size_t* columns,
432  CMR_INTMAT** presult
433 );
434 
439 CMR_EXPORT
441  CMR* cmr,
442  CMR_CHRMAT* matrix,
443  size_t* rows,
444  size_t* columns,
445  CMR_CHRMAT** presult
446 );
447 
452 CMR_EXPORT
454  CMR* cmr,
455  CMR_DBLMAT* matrix,
456  FILE* stream
457 );
458 
463 CMR_EXPORT
465  CMR* cmr,
466  CMR_INTMAT* matrix,
467  FILE* stream
468 );
469 
474 CMR_EXPORT
476  CMR* cmr,
477  CMR_CHRMAT* matrix,
478  FILE* stream
479 );
480 
485 CMR_EXPORT
487  CMR* cmr,
488  CMR_DBLMAT* matrix,
489  FILE* stream,
490  char zeroChar,
491  bool header
492 );
493 
498 CMR_EXPORT
500  CMR* cmr,
501  CMR_INTMAT* matrix,
502  FILE* stream,
503  char zeroChar,
504  bool header
505 );
506 
511 CMR_EXPORT
513  CMR* cmr,
514  CMR_CHRMAT* matrix,
515  FILE* stream,
516  char zeroChar,
517  bool header
518 );
519 
526 CMR_EXPORT
528  CMR* cmr,
529  FILE* stream,
530  CMR_DBLMAT** presult
531 );
532 
539 CMR_EXPORT
541  CMR* cmr,
542  FILE* stream,
543  CMR_INTMAT** presult
544 );
545 
552 CMR_EXPORT
554  CMR* cmr,
555  FILE* stream,
556  CMR_CHRMAT** presult
557 );
558 
565 CMR_EXPORT
567  CMR* cmr,
568  FILE* stream,
569  CMR_DBLMAT** presult
570 );
571 
578 CMR_EXPORT
580  CMR* cmr,
581  FILE* stream,
582  CMR_INTMAT** presult
583 );
584 
591 CMR_EXPORT
593  CMR* cmr,
594  FILE* stream,
595  CMR_CHRMAT** presult
596 );
597 
602 CMR_EXPORT
604  CMR_DBLMAT* matrix1,
605  CMR_DBLMAT* matrix2
606 );
607 
612 CMR_EXPORT
614  CMR_INTMAT* matrix1,
615  CMR_INTMAT* matrix2
616 );
617 
622 CMR_EXPORT
624  CMR_CHRMAT* matrix1,
625  CMR_CHRMAT* matrix2
626 );
627 
632 CMR_EXPORT
634  CMR* cmr,
635  CMR_DBLMAT* matrix1,
636  CMR_DBLMAT* matrix2,
637  bool* pareTranspose
638 );
639 
644 CMR_EXPORT
646  CMR* cmr,
647  CMR_INTMAT* matrix1,
648  CMR_INTMAT* matrix2,
649  bool* pareTranspose
650 );
651 
656 CMR_EXPORT
658  CMR* cmr,
659  CMR_CHRMAT* matrix1,
660  CMR_CHRMAT* matrix2,
661  bool* pareTranspose
662 );
663 
676 CMR_EXPORT
678  CMR_DBLMAT* matrix
679 );
680 
693 CMR_EXPORT
695  CMR_INTMAT* matrix
696 );
697 
710 CMR_EXPORT
712  CMR_CHRMAT* matrix
713 );
714 
719 CMR_EXPORT
721  CMR* cmr,
722  CMR_DBLMAT* matrix,
723  CMR_SUBMAT* submatrix,
724  CMR_DBLMAT** presult
725 );
726 
731 CMR_EXPORT
733  CMR* cmr,
734  CMR_INTMAT* matrix,
735  CMR_SUBMAT* submatrix,
736  CMR_INTMAT** presult
737 );
738 
743 CMR_EXPORT
745  CMR* cmr,
746  CMR_CHRMAT* matrix,
747  CMR_SUBMAT* submatrix,
748  CMR_CHRMAT** presult
749 );
750 
755 CMR_EXPORT
756 bool CMRdblmatIsBinary(
757  CMR* cmr,
758  CMR_DBLMAT* matrix,
759  double epsilon,
760  CMR_SUBMAT** psubmatrix
761 );
762 
767 CMR_EXPORT
769  CMR* cmr,
770  CMR_DBLMAT* matrix,
771  double epsilon,
772  CMR_SUBMAT** psubmatrix
773 );
774 
779 CMR_EXPORT
780 bool CMRintmatIsBinary(
781  CMR* cmr,
782  CMR_INTMAT* matrix,
783  CMR_SUBMAT** psubmatrix
784 );
785 
790 CMR_EXPORT
791 bool CMRchrmatIsBinary(
792  CMR* cmr,
793  CMR_CHRMAT* matrix,
794  CMR_SUBMAT** psubmatrix
795 );
796 
801 CMR_EXPORT
802 bool CMRdblmatIsTernary(
803  CMR* cmr,
804  CMR_DBLMAT* matrix,
805  double epsilon,
806  CMR_SUBMAT** psubmatrix
807 );
808 
813 CMR_EXPORT
815  CMR* cmr,
816  CMR_DBLMAT* matrix,
817  double epsilon,
818  CMR_SUBMAT** psubmatrix
819 );
820 
825 CMR_EXPORT
826 bool CMRintmatIsTernary(
827  CMR* cmr,
828  CMR_INTMAT* matrix,
829  CMR_SUBMAT** psubmatrix
830 );
831 
836 CMR_EXPORT
837 bool CMRchrmatIsTernary(
838  CMR* cmr,
839  CMR_CHRMAT* matrix,
840  CMR_SUBMAT** psubmatrix
841 );
842 
847 CMR_EXPORT
849  CMR* cmr,
850  CMR_DBLMAT* matrix,
851  double epsilon,
852  CMR_CHRMAT** presult
853 );
854 
859 CMR_EXPORT
861  CMR* cmr,
862  CMR_INTMAT* matrix,
863  CMR_CHRMAT** presult
864 );
865 
870 CMR_EXPORT
872  CMR* cmr,
873  CMR_CHRMAT* matrix,
874  CMR_CHRMAT** presult
875 );
876 
882 CMR_EXPORT
884  CMR* cmr,
885  CMR_DBLMAT* matrix,
886  double epsilon,
887  CMR_CHRMAT** presult
888 );
889 
894 CMR_EXPORT
896  CMR* cmr,
897  CMR_INTMAT* matrix,
898  CMR_CHRMAT** presult
899 );
900 
905 CMR_EXPORT
907  CMR* cmr,
908  CMR_CHRMAT* matrix,
909  CMR_CHRMAT** presult
910 );
911 
918 CMR_EXPORT
920  CMR* cmr,
921  CMR_INTMAT* matrix,
922  CMR_CHRMAT** presult
923 );
924 
931 CMR_EXPORT
933  CMR_DBLMAT* matrix,
934  size_t row,
935  size_t column,
936  size_t* pentry
937 );
938 
945 CMR_EXPORT
947  CMR_INTMAT* matrix,
948  size_t row,
949  size_t column,
950  size_t* pentry
951 );
952 
960 CMR_EXPORT
962  CMR_CHRMAT* matrix,
963  size_t row,
964  size_t column,
965  size_t* pentry
966 );
967 
968 
969 #ifdef __cplusplus
970 }
971 #endif
972 
973 #endif /* CMR_MATRIX_H */
CMR_EXPORT CMR_ERROR CMRintmatSortNonzeros(CMR *cmr, CMR_INTMAT *matrix)
Sorts the nonzeros of an int matrix by column in ascending order.
Definition: matrix.c:443
CMR_EXPORT CMR_ERROR CMRchrmatFree(CMR *cmr, CMR_CHRMAT **pmatrix)
Frees the memory of a char matrix.
Definition: matrix.c:360
size_t numRows
Number of rows.
Definition: matrix.h:175
CMR_EXPORT CMR_ERROR CMRdblmatTranspose(CMR *cmr, CMR_DBLMAT *matrix, CMR_DBLMAT **presult)
Creates the transpose of a double matrix.
Definition: matrix.c:537
CMR_EXPORT CMR_ERROR CMRdblmatCreate(CMR *cmr, CMR_DBLMAT **presult, int numRows, int numColumns, int numNonzeros)
Creates a double matrix of with numRows rows, numColumns columns and numNonzeros nonzeros. The actual arrays are allocated but not initialized.
Definition: matrix.c:247
CMR_EXPORT CMR_ERROR CMRchrmatCreateFromSparseStream(CMR *cmr, FILE *stream, CMR_CHRMAT **presult)
Reads a char matrix from a file stream in sparse format.
Definition: matrix.c:1219
size_t * rowSlice
Array mapping each row to the index of its first entry.
Definition: matrix.h:178
CMR_EXPORT CMR_ERROR CMRintmatSignedSupport(CMR *cmr, CMR_INTMAT *matrix, CMR_CHRMAT **presult)
Creates the (ternary) signed support matrix of an int matrix as a char matrix.
Definition: matrix.c:2359
CMR_EXPORT CMR_ERROR CMRdblmatFindEntry(CMR_DBLMAT *matrix, size_t row, size_t column, size_t *pentry)
Finds a specific entry of a double matrix.
Definition: matrix.c:2440
size_t numColumns
Number of columns.
Definition: matrix.h:152
CMR_EXPORT CMR_ERROR CMRsubmatWriteToStream(CMR *cmr, CMR_SUBMAT *submatrix, size_t numRows, size_t numColumns, FILE *stream)
Writes the submatrix submatrix to the file stream by means of lists of row and column indices...
Definition: matrix.c:152
size_t * columns
Array with column indices.
Definition: matrix.h:32
CMR_EXPORT CMR_ERROR CMRsubmatWriteToFile(CMR *cmr, CMR_SUBMAT *submatrix, size_t numRows, size_t numColumns, const char *fileName)
Writes the submatrix submatrix to the file by means of lists of row and column indices.
Definition: matrix.c:169
Row and column indices for a submatrix.
Definition: matrix.h:27
CMR_EXPORT char * CMRintmatConsistency(CMR_INTMAT *matrix)
Checks an int matrix for consistency.
Definition: matrix.c:1786
size_t * rowSlice
Array mapping each row to the index of its first entry.
Definition: matrix.h:154
CMR_EXPORT CMR_ERROR CMRchrmatSortNonzeros(CMR *cmr, CMR_CHRMAT *matrix)
Sorts the nonzeros of a char matrix by column in ascending order.
Definition: matrix.c:459
CMR_EXPORT CMR_ERROR CMRchrmatTranspose(CMR *cmr, CMR_CHRMAT *matrix, CMR_CHRMAT **presult)
Creates the transpose of a char matrix.
Definition: matrix.c:625
CMR_EXPORT CMR_ERROR CMRintmatChangeNumNonzeros(CMR *cmr, CMR_INTMAT *matrix, size_t newNumNonzeros)
Changes the number of nonzeros and reallocates corresponding arrays.
Definition: matrix.c:394
CMR_EXPORT CMR_ERROR CMRdblmatFindTernarySubmatrix(CMR *cmr, CMR_DBLMAT *matrix, double epsilon, CMR_SUBMAT **psubmatrix)
Finds a large ternary submatrix with absolute error tolerance epsilon.
Definition: matrix.c:2671
CMR_EXPORT CMR_ERROR CMRintmatPrintDense(CMR *cmr, CMR_INTMAT *matrix, FILE *stream, char zeroChar, bool header)
Prints an int matrix in dense format.
Definition: matrix.c:901
double * entryValues
Array mapping each entry to its value.
Definition: matrix.h:156
CMR_EXPORT CMR_ERROR CMRdblmatCreateFromDenseStream(CMR *cmr, FILE *stream, CMR_DBLMAT **presult)
Reads a double matrix from a file stream in dense format.
Definition: matrix.c:1304
CMR_EXPORT CMR_ERROR CMRchrmatPrintDense(CMR *cmr, CMR_CHRMAT *matrix, FILE *stream, char zeroChar, bool header)
Prints a char matrix in dense format.
Definition: matrix.c:941
CMR_EXPORT CMR_ERROR CMRchrmatPermute(CMR *cmr, CMR_CHRMAT *matrix, size_t *rows, size_t *columns, CMR_CHRMAT **presult)
Creates the char matrix obtained from matrix by applying row- and column-permutations.
Definition: matrix.c:761
Basic functionality of the software library.
CMR_EXPORT CMR_ERROR CMRintmatFree(CMR *cmr, CMR_INTMAT **pmatrix)
Frees the memory of an int matrix.
Definition: matrix.c:338
char * entryValues
Array mapping each entry to its value.
Definition: matrix.h:204
CMR_EXPORT CMR_ERROR CMRsubmatTranspose(CMR_SUBMAT *submatrix)
Transposes a submatrix.
Definition: matrix.c:61
CMR_EXPORT CMR_ERROR CMRdblmatChangeNumNonzeros(CMR *cmr, CMR_DBLMAT *matrix, size_t newNumNonzeros)
Changes the number of nonzeros and reallocates corresponding arrays.
Definition: matrix.c:382
Row-wise representation of sparse char matrix.
Definition: matrix.h:197
CMR_ERROR
Type for return codes of library functions.
Definition: env.h:26
CMR_EXPORT CMR_ERROR CMRintmatPermute(CMR *cmr, CMR_INTMAT *matrix, size_t *rows, size_t *columns, CMR_INTMAT **presult)
Creates the int matrix obtained from matrix by applying row- and column-permutations.
Definition: matrix.c:715
CMR_EXPORT CMR_ERROR CMRdblmatZoomSubmat(CMR *cmr, CMR_DBLMAT *matrix, CMR_SUBMAT *submatrix, CMR_DBLMAT **presult)
Creates a submatrix of a double matrix as an explicit matrix.
Definition: matrix.c:2012
CMR_EXPORT CMR_ERROR CMRintmatCopy(CMR *cmr, CMR_INTMAT *matrix, CMR_INTMAT **presult)
Copies an int matrix to a newly allocated one.
Definition: matrix.c:497
size_t numNonzeros
Number of and memory allocated for nonzeros.
Definition: matrix.h:201
size_t * entryColumns
Array mapping each entry to its column.
Definition: matrix.h:155
CMR_EXPORT CMR_ERROR CMRintmatToChr(CMR *cmr, CMR_INTMAT *matrix, CMR_CHRMAT **presult)
Converts an int matrix to a char matrix.
Definition: matrix.c:2415
size_t numColumns
Number of columns.
Definition: matrix.h:176
CMR_EXPORT CMR_ERROR CMRintmatCreate(CMR *cmr, CMR_INTMAT **presult, int numRows, int numColumns, int numNonzeros)
Creates an int matrix of with numRows rows, numColumns columns and numNonzeros nonzeros. The actual arrays are allocated but not initialized.
Definition: matrix.c:271
CMR_EXPORT char * CMRchrmatConsistency(CMR_CHRMAT *matrix)
Checks a char matrix for consistency.
Definition: matrix.c:1823
CMR_EXPORT CMR_ERROR CMRsubmatZoomSubmat(CMR *cmr, CMR_SUBMAT *reference, CMR_SUBMAT *input, CMR_SUBMAT **poutput)
Returns the submatrix input as a submatrix of the reference submatrix.
Definition: matrix.c:76
CMR_EXPORT CMR_ERROR CMRintmatCreateFromSparseStream(CMR *cmr, FILE *stream, CMR_INTMAT **presult)
Reads an int matrix from a file stream in sparse format.
Definition: matrix.c:1112
Row-wise representation of sparse int matrix.
Definition: matrix.h:173
CMR_EXPORT char * CMRdblmatConsistency(CMR_DBLMAT *matrix)
Checks a double matrix for consistency.
Definition: matrix.c:1757
Definition: env_internal.h:44
CMR_EXPORT CMR_ERROR CMRchrmatSignedSupport(CMR *cmr, CMR_CHRMAT *matrix, CMR_CHRMAT **presult)
Creates the (ternary) signed support matrix of a char matrix as a char matrix.
Definition: matrix.c:2387
CMR_EXPORT CMR_ERROR CMRintmatTranspose(CMR *cmr, CMR_INTMAT *matrix, CMR_INTMAT **presult)
Creates the transpose of an int matrix.
Definition: matrix.c:581
size_t numNonzeros
Number of and memory allocated for nonzeros.
Definition: matrix.h:177
CMR_EXPORT CMR_ERROR CMRchrmatCreateFromDenseStream(CMR *cmr, FILE *stream, CMR_CHRMAT **presult)
Reads a char matrix from a file stream in dense format.
Definition: matrix.c:1448
size_t numRows
Number of rows.
Definition: matrix.h:29
CMR_EXPORT CMR_ERROR CMRdblmatPrintDense(CMR *cmr, CMR_DBLMAT *matrix, FILE *stream, char zeroChar, bool header)
Prints a double matrix in dense format.
Definition: matrix.c:861
CMR_EXPORT CMR_ERROR CMRchrmatZoomSubmat(CMR *cmr, CMR_CHRMAT *matrix, CMR_SUBMAT *submatrix, CMR_CHRMAT **presult)
Creates a submatrix of a char matrix as an explicit matrix.
Definition: matrix.c:2219
CMR_EXPORT CMR_ERROR CMRdblmatSupport(CMR *cmr, CMR_DBLMAT *matrix, double epsilon, CMR_CHRMAT **presult)
Creates the (binary) support matrix of a double matrix as a char matrix with absolute error tolerance...
Definition: matrix.c:2232
size_t numNonzeros
Number of and memory allocated for nonzeros.
Definition: matrix.h:153
CMR_EXPORT bool CMRchrmatIsBinary(CMR *cmr, CMR_CHRMAT *matrix, CMR_SUBMAT **psubmatrix)
Checks if a char matrix has only entries in .
Definition: matrix.c:1911
CMR_EXPORT CMR_ERROR CMRsubmatFree(CMR *cmr, CMR_SUBMAT **psubmatrix)
Frees a submatrix.
Definition: matrix.c:45
CMR_EXPORT bool CMRdblmatCheckEqual(CMR_DBLMAT *matrix1, CMR_DBLMAT *matrix2)
Checks whether two double matrices are equal.
Definition: matrix.c:1520
CMR_EXPORT CMR_ERROR CMRintmatCheckTranspose(CMR *cmr, CMR_INTMAT *matrix1, CMR_INTMAT *matrix2, bool *pareTranspose)
Checks whether two int matrices are transposes of each other.
Definition: matrix.c:1669
CMR_EXPORT bool CMRchrmatCheckEqual(CMR_CHRMAT *matrix1, CMR_CHRMAT *matrix2)
Checks whether two char matrices are equal.
Definition: matrix.c:1590
CMR_EXPORT CMR_ERROR CMRsubmatReadFromStream(CMR *cmr, CMR_SUBMAT **psubmatrix, size_t *pnumMatrixRows, size_t *pnumMatrixColumns, FILE *stream)
Reads the submatrix *psubmatrix from the file stream.
Definition: matrix.c:192
size_t * entryColumns
Array mapping each entry to its column.
Definition: matrix.h:179
size_t numRows
Number of rows.
Definition: matrix.h:151
CMR_EXPORT bool CMRchrmatIsTernary(CMR *cmr, CMR_CHRMAT *matrix, CMR_SUBMAT **psubmatrix)
Checks if a double matrix has only entries in .
Definition: matrix.c:1987
size_t numColumns
Number of columns.
Definition: matrix.h:31
CMR_EXPORT CMR_ERROR CMRdblmatFree(CMR *cmr, CMR_DBLMAT **pmatrix)
Frees the memory of a double matrix.
Definition: matrix.c:316
CMR_EXPORT CMR_ERROR CMRintmatCreateFromDenseStream(CMR *cmr, FILE *stream, CMR_INTMAT **presult)
Reads an int matrix from a file stream in dense format.
Definition: matrix.c:1376
CMR_EXPORT bool CMRdblmatIsBinary(CMR *cmr, CMR_DBLMAT *matrix, double epsilon, CMR_SUBMAT **psubmatrix)
Checks if a double matrix has only entries in with absolute error tolerance epsilon.
Definition: matrix.c:1860
size_t * entryColumns
Array mapping each entry to its column.
Definition: matrix.h:203
CMR_EXPORT CMR_ERROR CMRchrmatPrintSparse(CMR *cmr, CMR_CHRMAT *matrix, FILE *stream)
Prints a char matrix in sparse format.
Definition: matrix.c:843
CMR_EXPORT bool CMRdblmatIsTernary(CMR *cmr, CMR_DBLMAT *matrix, double epsilon, CMR_SUBMAT **psubmatrix)
Checks if a double matrix has only entries in with absolute error tolerance epsilon.
Definition: matrix.c:1936
Row-wise representation of sparse double matrix.
Definition: matrix.h:149
CMR_EXPORT CMR_ERROR CMRsubmatCreate1x1(CMR *cmr, size_t row, size_t column, CMR_SUBMAT **psubmatrix)
Creates a 1-by-1 submatrix.
Definition: matrix.c:33
CMR_EXPORT CMR_ERROR CMRchrmatChangeNumNonzeros(CMR *cmr, CMR_CHRMAT *matrix, size_t newNumNonzeros)
Changes the number of nonzeros and reallocates corresponding arrays.
Definition: matrix.c:406
CMR_EXPORT bool CMRintmatIsBinary(CMR *cmr, CMR_INTMAT *matrix, CMR_SUBMAT **psubmatrix)
Checks if an int matrix has only entries in .
Definition: matrix.c:1886
CMR_EXPORT CMR_ERROR CMRdblmatCopy(CMR *cmr, CMR_DBLMAT *matrix, CMR_DBLMAT **presult)
Copies a double matrix to a newly allocated one.
Definition: matrix.c:477
CMR_EXPORT CMR_ERROR CMRchrmatCopy(CMR *cmr, CMR_CHRMAT *matrix, CMR_CHRMAT **presult)
Copies a char matrix to a newly allocated one.
Definition: matrix.c:517
CMR_EXPORT CMR_ERROR CMRintmatFindEntry(CMR_INTMAT *matrix, size_t row, size_t column, size_t *pentry)
Finds a specific entry of an int matrix.
Definition: matrix.c:2466
CMR_EXPORT CMR_ERROR CMRdblmatSignedSupport(CMR *cmr, CMR_DBLMAT *matrix, double epsilon, CMR_CHRMAT **presult)
Creates the (ternary) signed support matrix of a double matrix as a char matrix with absolute error t...
Definition: matrix.c:2320
CMR_EXPORT CMR_ERROR CMRdblmatPrintSparse(CMR *cmr, CMR_DBLMAT *matrix, FILE *stream)
Prints a double matrix in sparse format.
Definition: matrix.c:807
CMR_EXPORT CMR_ERROR CMRdblmatSortNonzeros(CMR *cmr, CMR_DBLMAT *matrix)
Sorts the nonzeros of a double matrix by column in ascending order.
Definition: matrix.c:426
CMR_EXPORT bool CMRintmatIsTernary(CMR *cmr, CMR_INTMAT *matrix, CMR_SUBMAT **psubmatrix)
Checks if an int matrix has only entries in .
Definition: matrix.c:1962
CMR_EXPORT CMR_ERROR CMRdblmatPermute(CMR *cmr, CMR_DBLMAT *matrix, size_t *rows, size_t *columns, CMR_DBLMAT **presult)
Creates the double matrix obtained from matrix by applying row- and column-permutations.
Definition: matrix.c:669
CMR_EXPORT bool CMRintmatCheckEqual(CMR_INTMAT *matrix1, CMR_INTMAT *matrix2)
Checks whether two int matrices are equal.
Definition: matrix.c:1555
CMR_EXPORT CMR_ERROR CMRintmatZoomSubmat(CMR *cmr, CMR_INTMAT *matrix, CMR_SUBMAT *submatrix, CMR_INTMAT **presult)
Creates a submatrix of an int matrix as an explicit matrix.
Definition: matrix.c:2081
CMR_EXPORT CMR_ERROR CMRchrmatCheckTranspose(CMR *cmr, CMR_CHRMAT *matrix1, CMR_CHRMAT *matrix2, bool *pareTranspose)
Checks whether two char matrices are transposes of each other.
Definition: matrix.c:1713
CMR_EXPORT CMR_ERROR CMRchrmatSupport(CMR *cmr, CMR_CHRMAT *matrix, CMR_CHRMAT **presult)
Creates the (binary) support matrix of a char matrix as a char matrix.
Definition: matrix.c:2292
CMR_EXPORT CMR_ERROR CMRchrmatCreate(CMR *cmr, CMR_CHRMAT **presult, int numRows, int numColumns, int numNonzeros)
Creates a char matrix of with numRows rows, numColumns columns and numNonzeros nonzeros. The actual arrays are allocated but not initialized.
Definition: matrix.c:294
CMR_EXPORT CMR_ERROR CMRdblmatFindBinarySubmatrix(CMR *cmr, CMR_DBLMAT *matrix, double epsilon, CMR_SUBMAT **psubmatrix)
Finds a large binary submatrix with absolute error tolerance epsilon.
Definition: matrix.c:2643
size_t numColumns
Number of columns.
Definition: matrix.h:200
size_t * rows
Array with row indices.
Definition: matrix.h:30
CMR_EXPORT CMR_ERROR CMRdblmatCreateFromSparseStream(CMR *cmr, FILE *stream, CMR_DBLMAT **presult)
Reads a double matrix from a file stream in sparse format.
Definition: matrix.c:1005
size_t * rowSlice
Array mapping each row to the index of its first entry.
Definition: matrix.h:202
CMR_EXPORT CMR_ERROR CMRintmatPrintSparse(CMR *cmr, CMR_INTMAT *matrix, FILE *stream)
Prints an int matrix in sparse format.
Definition: matrix.c:825
CMR_EXPORT CMR_ERROR CMRdblmatCheckTranspose(CMR *cmr, CMR_DBLMAT *matrix1, CMR_DBLMAT *matrix2, bool *pareTranspose)
Checks whether two double matrices are transposes of each other.
Definition: matrix.c:1625
CMR_EXPORT CMR_ERROR CMRchrmatFindEntry(CMR_CHRMAT *matrix, size_t row, size_t column, size_t *pentry)
Finds a specific entry of a char matrix.
Definition: matrix.c:2492
CMR_EXPORT CMR_ERROR CMRintmatSupport(CMR *cmr, CMR_INTMAT *matrix, CMR_CHRMAT **presult)
Creates the (binary) support matrix of an int matrix as a char matrix.
Definition: matrix.c:2264
size_t numRows
Number of rows.
Definition: matrix.h:199
CMR_EXPORT CMR_ERROR CMRsubmatCreate(CMR *cmr, size_t numRows, size_t numColumns, CMR_SUBMAT **psubmatrix)
Creates a submatrix of given size.
Definition: matrix.c:16
int * entryValues
Array mapping each entry to its value.
Definition: matrix.h:180