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 
89 CMR_EXPORT
91  CMR* cmr,
92  CMR_SUBMAT* base,
93  CMR_SUBMAT* input,
94  CMR_SUBMAT** poutput
95 );
96 
104 CMR_EXPORT
106  CMR* cmr,
107  CMR_SUBMAT* base,
108  CMR_SUBMAT* input,
109  CMR_SUBMAT** poutput
110 );
111 
118 CMR_EXPORT
120  CMR* cmr,
121  CMR_SUBMAT* submatrix,
122  size_t numRows,
123  size_t numColumns,
124  FILE* stream
125 );
126 
133 CMR_EXPORT
135  CMR* cmr,
136  CMR_SUBMAT* submatrix,
137  size_t numRows,
138  size_t numColumns,
139  const char* fileName
140 );
141 
148 CMR_EXPORT
150  CMR* cmr,
151  CMR_SUBMAT** psubmatrix,
152  size_t* pnumMatrixRows,
153  size_t* pnumMatrixColumns,
154  FILE* stream
155 );
156 
171 typedef struct
172 {
173  size_t numRows;
174  size_t numColumns;
175  size_t numNonzeros;
176  size_t* rowSlice;
177  size_t* entryColumns;
178  double* entryValues;
179 } CMR_DBLMAT;
180 
195 typedef struct
196 {
197  size_t numRows;
198  size_t numColumns;
199  size_t numNonzeros;
200  size_t * rowSlice;
201  size_t* entryColumns;
202  int* entryValues;
203 } CMR_INTMAT;
204 
219 typedef struct
220 {
221  size_t numRows;
222  size_t numColumns;
223  size_t numNonzeros;
224  size_t* rowSlice;
225  size_t* entryColumns;
226  char* entryValues;
227 } CMR_CHRMAT;
228 
234 CMR_EXPORT
236  CMR* cmr,
237  CMR_DBLMAT** presult,
238  int numRows,
239  int numColumns,
240  int numNonzeros
241 );
242 
249 CMR_EXPORT
251  CMR* cmr,
252  CMR_INTMAT** presult,
253  int numRows,
254  int numColumns,
255  int numNonzeros
256 );
257 
263 CMR_EXPORT
265  CMR* cmr,
266  CMR_CHRMAT** presult,
267  int numRows,
268  int numColumns,
269  int numNonzeros
270 );
271 
276 CMR_EXPORT
278  CMR* cmr,
279  CMR_DBLMAT** pmatrix
280 );
281 
286 CMR_EXPORT
288  CMR* cmr,
289  CMR_INTMAT** pmatrix
290 );
291 
296 CMR_EXPORT
298  CMR* cmr,
299  CMR_CHRMAT** pmatrix
300 );
301 
306 CMR_EXPORT
308  CMR* cmr,
309  CMR_DBLMAT* matrix,
310  size_t newNumNonzeros
311 );
312 
317 CMR_EXPORT
319  CMR* cmr,
320  CMR_INTMAT* matrix,
321  size_t newNumNonzeros
322 );
323 
328 CMR_EXPORT
330  CMR* cmr,
331  CMR_CHRMAT* matrix,
332  size_t newNumNonzeros
333 );
334 
339 CMR_EXPORT
341  CMR* cmr,
342  CMR_DBLMAT* matrix
343 );
344 
349 CMR_EXPORT
351  CMR* cmr,
352  CMR_INTMAT* matrix
353 );
354 
359 CMR_EXPORT
361  CMR* cmr,
362  CMR_CHRMAT* matrix
363 );
364 
369 CMR_EXPORT
371  CMR* cmr,
372  CMR_DBLMAT* matrix,
373  CMR_DBLMAT** presult
374 );
375 
380 CMR_EXPORT
382  CMR* cmr,
383  CMR_INTMAT* matrix,
384  CMR_INTMAT** presult
385 );
386 
391 CMR_EXPORT
393  CMR* cmr,
394  CMR_CHRMAT* matrix,
395  CMR_CHRMAT** presult
396 );
397 
402 CMR_EXPORT
404  CMR* cmr,
405  CMR_DBLMAT* matrix,
406  CMR_DBLMAT** presult
407 );
408 
413 CMR_EXPORT
415  CMR* cmr,
416  CMR_INTMAT* matrix,
417  CMR_INTMAT** presult
418 );
419 
424 CMR_EXPORT
426  CMR* cmr,
427  CMR_CHRMAT* matrix,
428  CMR_CHRMAT** presult
429 );
430 
435 CMR_EXPORT
437  CMR* cmr,
438  CMR_DBLMAT* matrix,
439  size_t* rows,
440  size_t* columns,
441  CMR_DBLMAT** presult
442 );
443 
448 CMR_EXPORT
450  CMR* cmr,
451  CMR_INTMAT* matrix,
452  size_t* rows,
453  size_t* columns,
454  CMR_INTMAT** presult
455 );
456 
461 CMR_EXPORT
463  CMR* cmr,
464  CMR_CHRMAT* matrix,
465  size_t* rows,
466  size_t* columns,
467  CMR_CHRMAT** presult
468 );
469 
474 CMR_EXPORT
476  CMR* cmr,
477  CMR_DBLMAT* matrix,
478  FILE* stream
479 );
480 
485 CMR_EXPORT
487  CMR* cmr,
488  CMR_INTMAT* matrix,
489  FILE* stream
490 );
491 
496 CMR_EXPORT
498  CMR* cmr,
499  CMR_CHRMAT* matrix,
500  FILE* stream
501 );
502 
507 CMR_EXPORT
509  CMR* cmr,
510  CMR_DBLMAT* matrix,
511  FILE* stream,
512  char zeroChar,
513  bool header
514 );
515 
520 CMR_EXPORT
522  CMR* cmr,
523  CMR_INTMAT* matrix,
524  FILE* stream,
525  char zeroChar,
526  bool header
527 );
528 
533 CMR_EXPORT
535  CMR* cmr,
536  CMR_CHRMAT* matrix,
537  FILE* stream,
538  char zeroChar,
539  bool header
540 );
541 
548 CMR_EXPORT
550  CMR* cmr,
551  FILE* stream,
552  CMR_DBLMAT** presult
553 );
554 
561 CMR_EXPORT
563  CMR* cmr,
564  FILE* stream,
565  CMR_INTMAT** presult
566 );
567 
574 CMR_EXPORT
576  CMR* cmr,
577  FILE* stream,
578  CMR_CHRMAT** presult
579 );
580 
588 CMR_EXPORT
590  CMR* cmr,
591  const char* fileName,
592  const char* stdinName,
593  CMR_DBLMAT** presult
594 );
595 
603 CMR_EXPORT
605  CMR* cmr,
606  const char* fileName,
607  const char* stdinName,
608  CMR_INTMAT** presult
609 );
610 
618 CMR_EXPORT
620  CMR* cmr,
621  const char* fileName,
622  const char* stdinName,
623  CMR_CHRMAT** presult
624 );
625 
632 CMR_EXPORT
634  CMR* cmr,
635  FILE* stream,
636  CMR_DBLMAT** presult
637 );
638 
645 CMR_EXPORT
647  CMR* cmr,
648  FILE* stream,
649  CMR_INTMAT** presult
650 );
651 
658 CMR_EXPORT
660  CMR* cmr,
661  FILE* stream,
662  CMR_CHRMAT** presult
663 );
664 
672 CMR_EXPORT
674  CMR* cmr,
675  const char* fileName,
676  const char* stdinName,
677  CMR_DBLMAT** presult
678 );
679 
687 CMR_EXPORT
689  CMR* cmr,
690  const char* fileName,
691  const char* stdinName,
692  CMR_INTMAT** presult
693 );
694 
702 CMR_EXPORT
704  CMR* cmr,
705  const char* fileName,
706  const char* stdinName,
707  CMR_CHRMAT** presult
708 );
709 
714 CMR_EXPORT
716  CMR_DBLMAT* matrix1,
717  CMR_DBLMAT* matrix2
718 );
719 
724 CMR_EXPORT
726  CMR_INTMAT* matrix1,
727  CMR_INTMAT* matrix2
728 );
729 
734 CMR_EXPORT
736  CMR_CHRMAT* matrix1,
737  CMR_CHRMAT* matrix2
738 );
739 
744 CMR_EXPORT
746  CMR* cmr,
747  CMR_DBLMAT* matrix1,
748  CMR_DBLMAT* matrix2,
749  bool* pareTranspose
750 );
751 
756 CMR_EXPORT
758  CMR* cmr,
759  CMR_INTMAT* matrix1,
760  CMR_INTMAT* matrix2,
761  bool* pareTranspose
762 );
763 
768 CMR_EXPORT
770  CMR* cmr,
771  CMR_CHRMAT* matrix1,
772  CMR_CHRMAT* matrix2,
773  bool* pareTranspose
774 );
775 
788 CMR_EXPORT
790  CMR_DBLMAT* matrix
791 );
792 
805 CMR_EXPORT
807  CMR_INTMAT* matrix
808 );
809 
822 CMR_EXPORT
824  CMR_CHRMAT* matrix
825 );
826 
831 CMR_EXPORT
833  CMR* cmr,
834  CMR_DBLMAT* matrix,
835  CMR_SUBMAT* submatrix,
836  CMR_DBLMAT** presult
837 );
838 
843 CMR_EXPORT
845  CMR* cmr,
846  CMR_INTMAT* matrix,
847  CMR_SUBMAT* submatrix,
848  CMR_INTMAT** presult
849 );
850 
855 CMR_EXPORT
857  CMR* cmr,
858  CMR_CHRMAT* matrix,
859  CMR_SUBMAT* submatrix,
860  CMR_CHRMAT** presult
861 );
862 
867 CMR_EXPORT
868 bool CMRdblmatIsBinary(
869  CMR* cmr,
870  CMR_DBLMAT* matrix,
871  double epsilon,
872  CMR_SUBMAT** psubmatrix
873 );
874 
879 CMR_EXPORT
881  CMR* cmr,
882  CMR_DBLMAT* matrix,
883  double epsilon,
884  CMR_SUBMAT** psubmatrix
885 );
886 
891 CMR_EXPORT
892 bool CMRintmatIsBinary(
893  CMR* cmr,
894  CMR_INTMAT* matrix,
895  CMR_SUBMAT** psubmatrix
896 );
897 
902 CMR_EXPORT
903 bool CMRchrmatIsBinary(
904  CMR* cmr,
905  CMR_CHRMAT* matrix,
906  CMR_SUBMAT** psubmatrix
907 );
908 
913 CMR_EXPORT
914 bool CMRdblmatIsTernary(
915  CMR* cmr,
916  CMR_DBLMAT* matrix,
917  double epsilon,
918  CMR_SUBMAT** psubmatrix
919 );
920 
925 CMR_EXPORT
927  CMR* cmr,
928  CMR_DBLMAT* matrix,
929  double epsilon,
930  CMR_SUBMAT** psubmatrix
931 );
932 
937 CMR_EXPORT
938 bool CMRintmatIsTernary(
939  CMR* cmr,
940  CMR_INTMAT* matrix,
941  CMR_SUBMAT** psubmatrix
942 );
943 
948 CMR_EXPORT
949 bool CMRchrmatIsTernary(
950  CMR* cmr,
951  CMR_CHRMAT* matrix,
952  CMR_SUBMAT** psubmatrix
953 );
954 
959 CMR_EXPORT
961  CMR* cmr,
962  CMR_DBLMAT* matrix,
963  double epsilon,
964  CMR_CHRMAT** presult
965 );
966 
971 CMR_EXPORT
973  CMR* cmr,
974  CMR_INTMAT* matrix,
975  CMR_CHRMAT** presult
976 );
977 
982 CMR_EXPORT
984  CMR* cmr,
985  CMR_CHRMAT* matrix,
986  CMR_CHRMAT** presult
987 );
988 
994 CMR_EXPORT
996  CMR* cmr,
997  CMR_DBLMAT* matrix,
998  double epsilon,
999  CMR_CHRMAT** presult
1000 );
1001 
1006 CMR_EXPORT
1008  CMR* cmr,
1009  CMR_INTMAT* matrix,
1010  CMR_CHRMAT** presult
1011 );
1012 
1017 CMR_EXPORT
1019  CMR* cmr,
1020  CMR_CHRMAT* matrix,
1021  CMR_CHRMAT** presult
1022 );
1023 
1028 CMR_EXPORT
1030  CMR* cmr,
1031  CMR_CHRMAT* matrix,
1032  CMR_INTMAT** presult
1033 );
1034 
1041 CMR_EXPORT
1043  CMR* cmr,
1044  CMR_INTMAT* matrix,
1045  CMR_CHRMAT** presult
1046 );
1047 
1054 CMR_EXPORT
1056  CMR* cmr,
1057  CMR_DBLMAT* matrix,
1058  double epsilon,
1059  CMR_CHRMAT** presult
1060 );
1061 
1068 CMR_EXPORT
1070  CMR_DBLMAT* matrix,
1071  size_t row,
1072  size_t column,
1073  size_t* pentry
1074 );
1075 
1082 CMR_EXPORT
1084  CMR_INTMAT* matrix,
1085  size_t row,
1086  size_t column,
1087  size_t* pentry
1088 );
1089 
1097 CMR_EXPORT
1099  CMR_CHRMAT* matrix,
1100  size_t row,
1101  size_t column,
1102  size_t* pentry
1103 );
1104 
1105 #ifdef __cplusplus
1106 }
1107 #endif
1108 
1109 #endif /* CMR_MATRIX_H */
Basic functionality of the software library.
CMR_ERROR
Type for return codes of library functions.
Definition: env.h:32
CMR_EXPORT CMR_ERROR CMRchrmatToInt(CMR *cmr, CMR_CHRMAT *matrix, CMR_INTMAT **presult)
Converts a char matrix to an int matrix.
Definition: matrix.c:2677
CMR_EXPORT CMR_ERROR CMRchrmatCreateFromDenseFile(CMR *cmr, const char *fileName, const char *stdinName, CMR_CHRMAT **presult)
Reads a char matrix from a file name fileName in dense format.
Definition: matrix.c:1748
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:2494
CMR_EXPORT CMR_ERROR CMRdblmatSlice(CMR *cmr, CMR_DBLMAT *matrix, CMR_SUBMAT *submatrix, CMR_DBLMAT **presult)
Slices a submatrix of a double matrix.
Definition: matrix.c:2287
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:2526
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:986
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:2582
CMR_EXPORT char * CMRdblmatConsistency(CMR_DBLMAT *matrix)
Checks a double matrix for consistency.
Definition: matrix.c:2017
CMR_EXPORT char * CMRchrmatConsistency(CMR_CHRMAT *matrix)
Checks a char matrix for consistency.
Definition: matrix.c:2093
CMR_EXPORT CMR_ERROR CMRsubmatFree(CMR *cmr, CMR_SUBMAT **psubmatrix)
Frees a submatrix.
Definition: matrix.c:46
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:1538
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:2135
CMR_EXPORT bool CMRintmatCheckEqual(CMR_INTMAT *matrix1, CMR_INTMAT *matrix2)
Checks whether two int matrices are equal.
Definition: matrix.c:1815
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:1973
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:2779
CMR_EXPORT CMR_ERROR CMRdblmatToChr(CMR *cmr, CMR_DBLMAT *matrix, double epsilon, CMR_CHRMAT **presult)
Converts a double matrix to a char matrix.
Definition: matrix.c:2723
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....
Definition: matrix.c:282
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:796
CMR_EXPORT CMR_ERROR CMRdblmatCreateFromSparseFile(CMR *cmr, const char *fileName, const char *stdinName, CMR_DBLMAT **presult)
Reads a double matrix from a file name fileName in sparse format.
Definition: matrix.c:1370
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:944
CMR_EXPORT CMR_ERROR CMRintmatToChr(CMR *cmr, CMR_INTMAT *matrix, CMR_CHRMAT **presult)
Converts an int matrix to a char matrix.
Definition: matrix.c:2698
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:2211
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:2649
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:2554
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:478
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:34
CMR_EXPORT bool CMRchrmatIsBinary(CMR *cmr, CMR_CHRMAT *matrix, CMR_SUBMAT **psubmatrix)
Checks if a char matrix has only entries in .
Definition: matrix.c:2186
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:1929
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:2805
CMR_EXPORT CMR_ERROR CMRchrmatPrintSparse(CMR *cmr, CMR_CHRMAT *matrix, FILE *stream)
Prints a char matrix in sparse format.
Definition: matrix.c:882
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:750
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:429
CMR_EXPORT CMR_ERROR CMRchrmatSlice(CMR *cmr, CMR_CHRMAT *matrix, CMR_SUBMAT *submatrix, CMR_CHRMAT **presult)
Slices a submatrix of a char matrix.
Definition: matrix.c:2425
CMR_EXPORT CMR_ERROR CMRdblmatFree(CMR *cmr, CMR_DBLMAT **pmatrix)
Frees the memory of a double matrix.
Definition: matrix.c:351
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:902
CMR_EXPORT bool CMRintmatIsTernary(CMR *cmr, CMR_INTMAT *matrix, CMR_SUBMAT **psubmatrix)
Checks if an int matrix has only entries in .
Definition: matrix.c:2237
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:532
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:1285
CMR_EXPORT CMR_ERROR CMRdblmatCreateFromDenseFile(CMR *cmr, const char *fileName, const char *stdinName, CMR_DBLMAT **presult)
Reads a double matrix from a file name fileName in dense format.
Definition: matrix.c:1684
CMR_EXPORT bool CMRchrmatIsTernary(CMR *cmr, CMR_CHRMAT *matrix, CMR_SUBMAT **psubmatrix)
Checks if a double matrix has only entries in .
Definition: matrix.c:2262
CMR_EXPORT CMR_ERROR CMRchrmatTranspose(CMR *cmr, CMR_CHRMAT *matrix, CMR_CHRMAT **presult)
Creates the transpose of a char matrix.
Definition: matrix.c:660
CMR_EXPORT CMR_ERROR CMRsubmatSlice(CMR *cmr, CMR_SUBMAT *base, CMR_SUBMAT *input, CMR_SUBMAT **poutput)
Returns the submatrix input as a submatrix of the base submatrix.
Definition: matrix.c:77
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....
Definition: matrix.c:329
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:2956
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....
Definition: matrix.c:306
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:441
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:2984
CMR_EXPORT CMR_ERROR CMRchrmatFree(CMR *cmr, CMR_CHRMAT **pmatrix)
Frees the memory of a char matrix.
Definition: matrix.c:395
CMR_EXPORT CMR_ERROR CMRchrmatCreateFromSparseFile(CMR *cmr, const char *fileName, const char *stdinName, CMR_CHRMAT **presult)
Reads a char matrix from a file name fileName in sparse format.
Definition: matrix.c:1434
CMR_EXPORT CMR_ERROR CMRintmatPrintSparse(CMR *cmr, CMR_INTMAT *matrix, FILE *stream)
Prints an int matrix in sparse format.
Definition: matrix.c:862
CMR_EXPORT bool CMRdblmatCheckEqual(CMR_DBLMAT *matrix1, CMR_DBLMAT *matrix2)
Checks whether two double matrices are equal.
Definition: matrix.c:1780
CMR_EXPORT CMR_ERROR CMRintmatCreateFromDenseFile(CMR *cmr, const char *fileName, const char *stdinName, CMR_INTMAT **presult)
Reads an int matrix from a file name fileName in dense format.
Definition: matrix.c:1716
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:2621
CMR_EXPORT CMR_ERROR CMRdblmatTranspose(CMR *cmr, CMR_DBLMAT *matrix, CMR_DBLMAT **presult)
Creates the transpose of a double matrix.
Definition: matrix.c:572
CMR_EXPORT CMR_ERROR CMRsubmatUnslice(CMR *cmr, CMR_SUBMAT *base, CMR_SUBMAT *input, CMR_SUBMAT **poutput)
Returns the sub-submatrix input of base as a submatrix of its parent.
Definition: matrix.c:153
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:552
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:1611
CMR_EXPORT CMR_ERROR CMRintmatTranspose(CMR *cmr, CMR_INTMAT *matrix, CMR_INTMAT **presult)
Creates the transpose of an int matrix.
Definition: matrix.c:616
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:512
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:1178
CMR_EXPORT CMR_ERROR CMRintmatFree(CMR *cmr, CMR_INTMAT **pmatrix)
Frees the memory of an int matrix.
Definition: matrix.c:373
CMR_EXPORT CMR_ERROR CMRsubmatTranspose(CMR_SUBMAT *submatrix)
Transposes a submatrix.
Definition: matrix.c:62
CMR_EXPORT CMR_ERROR CMRdblmatPrintSparse(CMR *cmr, CMR_DBLMAT *matrix, FILE *stream)
Prints a double matrix in sparse format.
Definition: matrix.c:842
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:1885
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:1466
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:215
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 fileName by means of lists of row and column indices.
Definition: matrix.c:192
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:2753
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:461
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:494
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:1071
CMR_EXPORT CMR_ERROR CMRintmatSlice(CMR *cmr, CMR_INTMAT *matrix, CMR_SUBMAT *submatrix, CMR_INTMAT **presult)
Slices a submatrix of an int matrix.
Definition: matrix.c:2356
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:417
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:17
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:704
CMR_EXPORT bool CMRintmatIsBinary(CMR *cmr, CMR_INTMAT *matrix, CMR_SUBMAT **psubmatrix)
Checks if an int matrix has only entries in .
Definition: matrix.c:2161
CMR_EXPORT bool CMRchrmatCheckEqual(CMR_CHRMAT *matrix1, CMR_CHRMAT *matrix2)
Checks whether two char matrices are equal.
Definition: matrix.c:1850
CMR_EXPORT char * CMRintmatConsistency(CMR_INTMAT *matrix)
Checks an int matrix for consistency.
Definition: matrix.c:2051
CMR_EXPORT CMR_ERROR CMRintmatCreateFromSparseFile(CMR *cmr, const char *fileName, const char *stdinName, CMR_INTMAT **presult)
Reads an int matrix from a file name fileName in sparse format.
Definition: matrix.c:1402
CMR_EXPORT CMR_ERROR CMRsubmatPrint(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:173
Row-wise representation of sparse char matrix.
Definition: matrix.h:220
size_t * rowSlice
Array mapping each row to the index of its first entry.
Definition: matrix.h:224
size_t * entryColumns
Array mapping each entry to its column.
Definition: matrix.h:225
char * entryValues
Array mapping each entry to its value.
Definition: matrix.h:226
size_t numRows
Number of rows.
Definition: matrix.h:221
size_t numColumns
Number of columns.
Definition: matrix.h:222
size_t numNonzeros
Number of and memory allocated for nonzeros.
Definition: matrix.h:223
Row-wise representation of sparse double matrix.
Definition: matrix.h:172
double * entryValues
Array mapping each entry to its value.
Definition: matrix.h:178
size_t * rowSlice
Array mapping each row to the index of its first entry.
Definition: matrix.h:176
size_t numRows
Number of rows.
Definition: matrix.h:173
size_t numNonzeros
Number of and memory allocated for nonzeros.
Definition: matrix.h:175
size_t numColumns
Number of columns.
Definition: matrix.h:174
size_t * entryColumns
Array mapping each entry to its column.
Definition: matrix.h:177
Definition: env_internal.h:45
Row-wise representation of sparse int matrix.
Definition: matrix.h:196
size_t numColumns
Number of columns.
Definition: matrix.h:198
size_t * entryColumns
Array mapping each entry to its column.
Definition: matrix.h:201
int * entryValues
Array mapping each entry to its value.
Definition: matrix.h:202
size_t * rowSlice
Array mapping each row to the index of its first entry.
Definition: matrix.h:200
size_t numRows
Number of rows.
Definition: matrix.h:197
size_t numNonzeros
Number of and memory allocated for nonzeros.
Definition: matrix.h:199
Row and column indices for a submatrix.
Definition: matrix.h:28
size_t * columns
Array with column indices.
Definition: matrix.h:32
size_t numRows
Number of rows.
Definition: matrix.h:29
size_t * rows
Array with row indices.
Definition: matrix.h:30
size_t numColumns
Number of columns.
Definition: matrix.h:31