CMR  1.3.0
Classes | Functions
matrix.c File Reference
#include <cmr/matrix.h>
#include <assert.h>
#include <stdlib.h>
#include <stdint.h>
#include <math.h>
#include <limits.h>
#include <string.h>
#include "sort.h"
#include "env_internal.h"
#include "listmatrix.h"

Classes

struct  DblNonzero
 
struct  IntNonzero
 
struct  ChrNonzero
 

Functions

CMR_ERROR CMRsubmatCreate (CMR *cmr, size_t numRows, size_t numColumns, CMR_SUBMAT **psubmatrix)
 Creates a submatrix of given size. More...
 
CMR_ERROR CMRsubmatCreate1x1 (CMR *cmr, size_t row, size_t column, CMR_SUBMAT **psubmatrix)
 Creates a 1-by-1 submatrix. More...
 
CMR_ERROR CMRsubmatFree (CMR *cmr, CMR_SUBMAT **psubmatrix)
 Frees a submatrix. More...
 
CMR_ERROR CMRsubmatTranspose (CMR_SUBMAT *submatrix)
 Transposes a submatrix. More...
 
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. More...
 
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. More...
 
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. More...
 
CMR_ERROR CMRsubmatReadFromStream (CMR *cmr, CMR_SUBMAT **psubmatrix, size_t *pnumMatrixRows, size_t *pnumMatrixColumns, FILE *stream)
 Reads the submatrix *psubmatrix from the file stream. More...
 
static int CMRsortSubmatrixCompare (const void *p1, const void *p2)
 
CMR_ERROR CMRsortSubmatrix (CMR *cmr, CMR_SUBMAT *submatrix)
 Sorts the row and column indices of submatrix. More...
 
CMR_ERROR CMRdblmatCreate (CMR *cmr, CMR_DBLMAT **matrix, 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. More...
 
CMR_ERROR CMRintmatCreate (CMR *cmr, CMR_INTMAT **matrix, 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. More...
 
CMR_ERROR CMRchrmatCreate (CMR *cmr, CMR_CHRMAT **matrix, 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. More...
 
CMR_ERROR CMRdblmatFree (CMR *cmr, CMR_DBLMAT **pmatrix)
 Frees the memory of a double matrix. More...
 
CMR_ERROR CMRintmatFree (CMR *cmr, CMR_INTMAT **pmatrix)
 Frees the memory of an int matrix. More...
 
CMR_ERROR CMRchrmatFree (CMR *cmr, CMR_CHRMAT **pmatrix)
 Frees the memory of a char matrix. More...
 
CMR_ERROR CMRdblmatChangeNumNonzeros (CMR *cmr, CMR_DBLMAT *matrix, size_t newNumNonzeros)
 Changes the number of nonzeros and reallocates corresponding arrays. More...
 
CMR_ERROR CMRintmatChangeNumNonzeros (CMR *cmr, CMR_INTMAT *matrix, size_t newNumNonzeros)
 Changes the number of nonzeros and reallocates corresponding arrays. More...
 
CMR_ERROR CMRchrmatChangeNumNonzeros (CMR *cmr, CMR_CHRMAT *matrix, size_t newNumNonzeros)
 Changes the number of nonzeros and reallocates corresponding arrays. More...
 
static int compareEntries (const void **pa, const void **pb)
 
CMR_ERROR CMRdblmatSortNonzeros (CMR *cmr, CMR_DBLMAT *matrix)
 Sorts the nonzeros of a double matrix by column in ascending order. More...
 
CMR_ERROR CMRintmatSortNonzeros (CMR *cmr, CMR_INTMAT *matrix)
 Sorts the nonzeros of an int matrix by column in ascending order. More...
 
CMR_ERROR CMRchrmatSortNonzeros (CMR *cmr, CMR_CHRMAT *matrix)
 Sorts the nonzeros of a char matrix by column in ascending order. More...
 
CMR_ERROR CMRdblmatCopy (CMR *cmr, CMR_DBLMAT *matrix, CMR_DBLMAT **presult)
 Copies a double matrix to a newly allocated one. More...
 
CMR_ERROR CMRintmatCopy (CMR *cmr, CMR_INTMAT *matrix, CMR_INTMAT **presult)
 Copies an int matrix to a newly allocated one. More...
 
CMR_ERROR CMRchrmatCopy (CMR *cmr, CMR_CHRMAT *matrix, CMR_CHRMAT **presult)
 Copies a char matrix to a newly allocated one. More...
 
CMR_ERROR CMRdblmatTranspose (CMR *cmr, CMR_DBLMAT *matrix, CMR_DBLMAT **presult)
 Creates the transpose of a double matrix. More...
 
CMR_ERROR CMRintmatTranspose (CMR *cmr, CMR_INTMAT *matrix, CMR_INTMAT **presult)
 Creates the transpose of an int matrix. More...
 
CMR_ERROR CMRchrmatTranspose (CMR *cmr, CMR_CHRMAT *matrix, CMR_CHRMAT **presult)
 Creates the transpose of a char matrix. More...
 
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. More...
 
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. More...
 
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. More...
 
CMR_ERROR CMRdblmatPrintSparse (CMR *cmr, CMR_DBLMAT *matrix, FILE *stream)
 Prints a double matrix in sparse format. More...
 
CMR_ERROR CMRintmatPrintSparse (CMR *cmr, CMR_INTMAT *matrix, FILE *stream)
 Prints an int matrix in sparse format. More...
 
CMR_ERROR CMRchrmatPrintSparse (CMR *cmr, CMR_CHRMAT *matrix, FILE *stream)
 Prints a char matrix in sparse format. More...
 
CMR_ERROR CMRdblmatPrintDense (CMR *cmr, CMR_DBLMAT *matrix, FILE *stream, char zeroChar, bool header)
 Prints a double matrix in dense format. More...
 
CMR_ERROR CMRintmatPrintDense (CMR *cmr, CMR_INTMAT *matrix, FILE *stream, char zeroChar, bool header)
 Prints an int matrix in dense format. More...
 
CMR_ERROR CMRchrmatPrintDense (CMR *cmr, CMR_CHRMAT *matrix, FILE *stream, char zeroChar, bool header)
 Prints a char matrix in dense format. More...
 
static int compareDblNonzeros (const void *pa, const void *pb)
 
CMR_ERROR CMRdblmatCreateFromSparseStream (CMR *cmr, FILE *stream, CMR_DBLMAT **presult)
 Reads a double matrix from a file stream in sparse format. More...
 
static int compareIntNonzeros (const void *pa, const void *pb)
 
CMR_ERROR CMRintmatCreateFromSparseStream (CMR *cmr, FILE *stream, CMR_INTMAT **presult)
 Reads an int matrix from a file stream in sparse format. More...
 
static int compareChrNonzeros (const void *pa, const void *pb)
 
CMR_ERROR CMRchrmatCreateFromSparseStream (CMR *cmr, FILE *stream, CMR_CHRMAT **presult)
 Reads a char matrix from a file stream in sparse format. More...
 
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. More...
 
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. More...
 
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. More...
 
CMR_ERROR CMRdblmatCreateFromDenseStream (CMR *cmr, FILE *stream, CMR_DBLMAT **presult)
 Reads a double matrix from a file stream in dense format. More...
 
CMR_ERROR CMRintmatCreateFromDenseStream (CMR *cmr, FILE *stream, CMR_INTMAT **presult)
 Reads an int matrix from a file stream in dense format. More...
 
CMR_ERROR CMRchrmatCreateFromDenseStream (CMR *cmr, FILE *stream, CMR_CHRMAT **presult)
 Reads a char matrix from a file stream in dense format. More...
 
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. More...
 
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. More...
 
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. More...
 
bool CMRdblmatCheckEqual (CMR_DBLMAT *matrix1, CMR_DBLMAT *matrix2)
 Checks whether two double matrices are equal. More...
 
bool CMRintmatCheckEqual (CMR_INTMAT *matrix1, CMR_INTMAT *matrix2)
 Checks whether two int matrices are equal. More...
 
bool CMRchrmatCheckEqual (CMR_CHRMAT *matrix1, CMR_CHRMAT *matrix2)
 Checks whether two char matrices are equal. More...
 
CMR_ERROR CMRdblmatCheckTranspose (CMR *cmr, CMR_DBLMAT *matrix1, CMR_DBLMAT *matrix2, bool *pareTranspose)
 Checks whether two double matrices are transposes of each other. More...
 
CMR_ERROR CMRintmatCheckTranspose (CMR *cmr, CMR_INTMAT *matrix1, CMR_INTMAT *matrix2, bool *pareTranspose)
 Checks whether two int matrices are transposes of each other. More...
 
CMR_ERROR CMRchrmatCheckTranspose (CMR *cmr, CMR_CHRMAT *matrix1, CMR_CHRMAT *matrix2, bool *pareTranspose)
 Checks whether two char matrices are transposes of each other. More...
 
char * CMRdblmatConsistency (CMR_DBLMAT *matrix)
 Checks a double matrix for consistency. More...
 
char * CMRintmatConsistency (CMR_INTMAT *matrix)
 Checks an int matrix for consistency. More...
 
char * CMRchrmatConsistency (CMR_CHRMAT *matrix)
 Checks a char matrix for consistency. More...
 
bool CMRdblmatIsBinary (CMR *cmr, CMR_DBLMAT *matrix, double epsilon, CMR_SUBMAT **psubmatrix)
 Checks if a double matrix has only entries in \( \{0,1\} \) with absolute error tolerance epsilon. More...
 
bool CMRintmatIsBinary (CMR *cmr, CMR_INTMAT *matrix, CMR_SUBMAT **psubmatrix)
 Checks if an int matrix has only entries in \( \{0,1\} \). More...
 
bool CMRchrmatIsBinary (CMR *cmr, CMR_CHRMAT *matrix, CMR_SUBMAT **psubmatrix)
 Checks if a char matrix has only entries in \( \{0,1\} \). More...
 
bool CMRdblmatIsTernary (CMR *cmr, CMR_DBLMAT *matrix, double epsilon, CMR_SUBMAT **psubmatrix)
 Checks if a double matrix has only entries in \( \{-1,0,+1\} \) with absolute error tolerance epsilon. More...
 
bool CMRintmatIsTernary (CMR *cmr, CMR_INTMAT *matrix, CMR_SUBMAT **psubmatrix)
 Checks if an int matrix has only entries in \( \{-1,0,+1\} \). More...
 
bool CMRchrmatIsTernary (CMR *cmr, CMR_CHRMAT *matrix, CMR_SUBMAT **psubmatrix)
 Checks if a double matrix has only entries in \( \{-1,0,+1\} \). More...
 
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. More...
 
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. More...
 
CMR_ERROR CMRchrmatFilter (CMR *cmr, CMR_CHRMAT *matrix, size_t numRows, size_t *rows, size_t numColumns, size_t *columns, CMR_CHRMAT **presult)
 Creates a numRows \( \times \) numColumns submatrix of the char matrix indexed by rows and columns. More...
 
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. More...
 
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 epsilon. More...
 
CMR_ERROR CMRintmatSupport (CMR *cmr, CMR_INTMAT *matrix, CMR_CHRMAT **presult)
 Creates the (binary) support matrix of an int matrix as a char matrix. More...
 
CMR_ERROR CMRchrmatSupport (CMR *cmr, CMR_CHRMAT *matrix, CMR_CHRMAT **presult)
 Creates the (binary) support matrix of a char matrix as a char matrix. More...
 
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 tolerance epsilon. More...
 
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. More...
 
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. More...
 
CMR_ERROR CMRchrmatToInt (CMR *cmr, CMR_CHRMAT *matrix, CMR_INTMAT **presult)
 Converts a char matrix to an int matrix. More...
 
CMR_ERROR CMRintmatToChr (CMR *cmr, CMR_INTMAT *matrix, CMR_CHRMAT **presult)
 Converts an int matrix to a char matrix. More...
 
CMR_ERROR CMRdblmatFindEntry (CMR_DBLMAT *matrix, size_t row, size_t column, size_t *pentry)
 Finds a specific entry of a double matrix. More...
 
CMR_ERROR CMRintmatFindEntry (CMR_INTMAT *matrix, size_t row, size_t column, size_t *pentry)
 Finds a specific entry of an int matrix. More...
 
CMR_ERROR CMRchrmatFindEntry (CMR_CHRMAT *matrix, size_t row, size_t column, size_t *pentry)
 Finds a specific entry of a char matrix. More...
 
static size_t findMaximum (size_t *array, size_t length, size_t *pmaxIndex)
 
static CMR_ERROR findBadSubmatrixByMaximum (CMR *cmr, ListMat8 *listmatrix, CMR_SUBMAT **psubmatrix)
 
CMR_ERROR CMRdblmatFindBinarySubmatrix (CMR *cmr, CMR_DBLMAT *matrix, double epsilon, CMR_SUBMAT **psubmatrix)
 Finds a large binary submatrix with absolute error tolerance epsilon. More...
 
CMR_ERROR CMRdblmatFindTernarySubmatrix (CMR *cmr, CMR_DBLMAT *matrix, double epsilon, CMR_SUBMAT **psubmatrix)
 Finds a large ternary submatrix with absolute error tolerance epsilon. More...
 

Function Documentation

◆ CMRchrmatChangeNumNonzeros()

CMR_ERROR CMRchrmatChangeNumNonzeros ( CMR cmr,
CMR_CHRMAT matrix,
size_t  newNumNonzeros 
)

Changes the number of nonzeros and reallocates corresponding arrays.

Parameters
cmrCMR environment.
matrixA matrix.
newNumNonzerosNew number of nonzeros.

◆ CMRchrmatCheckEqual()

bool CMRchrmatCheckEqual ( CMR_CHRMAT matrix1,
CMR_CHRMAT matrix2 
)

Checks whether two char matrices are equal.

Parameters
matrix1First matrix.
matrix2Second matrix.

◆ CMRchrmatCheckTranspose()

CMR_ERROR CMRchrmatCheckTranspose ( CMR cmr,
CMR_CHRMAT matrix1,
CMR_CHRMAT matrix2,
bool *  pareTranspose 
)

Checks whether two char matrices are transposes of each other.

Parameters
cmrCMR environment.
matrix1First matrix
matrix2Second matrix
pareTransposePointer for storing whether matrix1 and matrix2 are tranposes of each other.

◆ CMRchrmatConsistency()

char* CMRchrmatConsistency ( CMR_CHRMAT matrix)

Checks a char matrix for consistency.

Checks whether the entries of a row are sorted by column in ascending order. Checks for duplicate entries. Checks for zero entries.

Returns
NULL if consistent. Otherwise, an explanation string is returned, which must free'd with free().
See also
CMRconsistencyAssert() for checking the returned string and aborting in case of inconsistency.
Parameters
matrixA matrix.

◆ CMRchrmatCopy()

CMR_ERROR CMRchrmatCopy ( CMR cmr,
CMR_CHRMAT matrix,
CMR_CHRMAT **  presult 
)

Copies a char matrix to a newly allocated one.

Parameters
cmrCMR environment.
matrixA matrix.
presultPointer for storing a copy of matrix.

◆ CMRchrmatCreate()

CMR_ERROR CMRchrmatCreate ( CMR cmr,
CMR_CHRMAT **  matrix,
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.

Parameters
cmrCMR environment.
matrixPointer for storing the created matrix.
numRowsNumber of rows.
numColumnsNumber of columns.
numNonzerosNumber of nonzeros.

◆ CMRchrmatCreateFromDenseFile()

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.

Returns CMR_ERROR_INPUT in case of errors. In this case, *presult will be NULL. Expects that the file contains only the matrix and no additional data.

Parameters
cmrCMR environment.
fileNameFile stream to read from.
stdinNameIf not NULL, indicates which file name represents stdin.
presultPointer for storing the matrix.

◆ CMRchrmatCreateFromDenseStream()

CMR_ERROR CMRchrmatCreateFromDenseStream ( CMR cmr,
FILE *  stream,
CMR_CHRMAT **  presult 
)

Reads a char matrix from a file stream in dense format.

Returns CMR_ERROR_INPUT in case of errors. In this case, *presult will be NULL.

Parameters
cmrCMR environment.
streamFile stream to read from.
presultPointer for storing the matrix.

◆ CMRchrmatCreateFromSparseFile()

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.

Returns CMR_ERROR_INPUT in case of errors. In this case, *presult will be NULL. Expects that the file contains only the matrix and no additional data.

Parameters
cmrCMR environment.
fileNameFile stream to read from.
stdinNameIf not NULL, indicates which file name represents stdin.
presultPointer for storing the matrix.

◆ CMRchrmatCreateFromSparseStream()

CMR_ERROR CMRchrmatCreateFromSparseStream ( CMR cmr,
FILE *  stream,
CMR_CHRMAT **  presult 
)

Reads a char matrix from a file stream in sparse format.

Returns CMR_ERROR_INPUT in case of errors. In this case, *presult will be NULL.

Parameters
cmrCMR environment.
streamFile stream to read from.
presultPointer for storing the matrix.

◆ CMRchrmatFilter()

CMR_ERROR CMRchrmatFilter ( CMR cmr,
CMR_CHRMAT matrix,
size_t  numRows,
size_t *  rows,
size_t  numColumns,
size_t *  columns,
CMR_CHRMAT **  presult 
)

Creates a numRows \( \times \) numColumns submatrix of the char matrix indexed by rows and columns.

Parameters
cmrCMR environment.
matrixMatrix.
numRowsNumber of rows of submatrix.
rowsRows of matrix to be copied into the submatrix.
numColumnsNumber of columns of submatrix.
columnsColumns of matrix to be copied into the submatrix.
presultPointer for storing the created submatrix.

◆ CMRchrmatFindEntry()

CMR_ERROR CMRchrmatFindEntry ( CMR_CHRMAT matrix,
size_t  row,
size_t  column,
size_t *  pentry 
)

Finds a specific entry of a char matrix.

Searches for the entry at (row, column) using binary search. If an entry is zero, then *pentry is set to SIZE_MAX.

Parameters
matrixInput matrix.
rowA row.
columnA column.
pentryPointer for storing the entry at row, column, or SIZE_MAX if it is zero.

◆ CMRchrmatFree()

CMR_ERROR CMRchrmatFree ( CMR cmr,
CMR_CHRMAT **  pmatrix 
)

Frees the memory of a char matrix.

Parameters
cmrCMR environment.
pmatrixPointer to matrix.

◆ CMRchrmatIsBinary()

bool CMRchrmatIsBinary ( CMR cmr,
CMR_CHRMAT matrix,
CMR_SUBMAT **  psubmatrix 
)

Checks if a char matrix has only entries in \( \{0,1\} \).

Parameters
cmrCMR environment.
matrixA matrix.
psubmatrixPointer for storing a non-binary entry as a submatrix (may be NULL).

◆ CMRchrmatIsTernary()

bool CMRchrmatIsTernary ( CMR cmr,
CMR_CHRMAT matrix,
CMR_SUBMAT **  psubmatrix 
)

Checks if a double matrix has only entries in \( \{-1,0,+1\} \).

Parameters
cmrCMR environment.
matrixA matrix.
psubmatrixPointer for storing a non-ternary entry as a submatrix (may be NULL).

◆ CMRchrmatPermute()

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.

Parameters
cmrCMR environment.
matrixGiven matrix.
rowsMapping from new rows to rows of matrix (may be NULL for identity).
columnsMapping from new columns to columns of matrix (may be NULL for identity).
presultPointer for storing the permuted matrix.

◆ CMRchrmatPrintDense()

CMR_ERROR CMRchrmatPrintDense ( CMR cmr,
CMR_CHRMAT matrix,
FILE *  stream,
char  zeroChar,
bool  header 
)

Prints a char matrix in dense format.

Parameters
cmrCMR environment.
matrixA matrix.
streamFile stream to print to.
zeroCharCharacter to print for a zero.
headerWhether to print row and column indices.

◆ CMRchrmatPrintSparse()

CMR_ERROR CMRchrmatPrintSparse ( CMR cmr,
CMR_CHRMAT matrix,
FILE *  stream 
)

Prints a char matrix in sparse format.

Parameters
cmrCMR environment.
matrixA matrix.
streamFile stream to print to.

◆ CMRchrmatSignedSupport()

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.

Parameters
cmrCMR environment.
matrixDouble matrix
presultPointer for storing the signed support matrix of matrix.

◆ CMRchrmatSortNonzeros()

CMR_ERROR CMRchrmatSortNonzeros ( CMR cmr,
CMR_CHRMAT matrix 
)

Sorts the nonzeros of a char matrix by column in ascending order.

Parameters
cmrCMR environment.
matrixA matrix.

◆ CMRchrmatSupport()

CMR_ERROR CMRchrmatSupport ( CMR cmr,
CMR_CHRMAT matrix,
CMR_CHRMAT **  presult 
)

Creates the (binary) support matrix of a char matrix as a char matrix.

Parameters
cmrCMR environment.
matrixDouble matrix
presultPointer for storing the support matrix of matrix.

◆ CMRchrmatToInt()

CMR_ERROR CMRchrmatToInt ( CMR cmr,
CMR_CHRMAT matrix,
CMR_INTMAT **  presult 
)

Converts a char matrix to an int matrix.

Parameters
cmrCMR environment.
matrixInput matrix.
presultPointer for storing the output matrix.

◆ CMRchrmatTranspose()

CMR_ERROR CMRchrmatTranspose ( CMR cmr,
CMR_CHRMAT matrix,
CMR_CHRMAT **  presult 
)

Creates the transpose of a char matrix.

Parameters
cmrCMR environment.
matrixGiven matrix.
presultPointer for storing the transpose of matrix.

◆ CMRchrmatZoomSubmat()

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.

Parameters
cmrCMR environment.
matrixA matrix
submatrixA submatrix of matrix.
presultPointer for storing the resulting double matrix.

◆ CMRdblmatChangeNumNonzeros()

CMR_ERROR CMRdblmatChangeNumNonzeros ( CMR cmr,
CMR_DBLMAT matrix,
size_t  newNumNonzeros 
)

Changes the number of nonzeros and reallocates corresponding arrays.

Parameters
cmrCMR environment.
matrixGiven matrix.
newNumNonzerosNew number of nonzeros.

◆ CMRdblmatCheckEqual()

bool CMRdblmatCheckEqual ( CMR_DBLMAT matrix1,
CMR_DBLMAT matrix2 
)

Checks whether two double matrices are equal.

Parameters
matrix1First matrix.
matrix2Second matrix.

◆ CMRdblmatCheckTranspose()

CMR_ERROR CMRdblmatCheckTranspose ( CMR cmr,
CMR_DBLMAT matrix1,
CMR_DBLMAT matrix2,
bool *  pareTranspose 
)

Checks whether two double matrices are transposes of each other.

Parameters
cmrCMR environment.
matrix1First matrix.
matrix2Second matrix.
pareTransposePointer for storing whether matrix1 and matrix2 are tranposes of each other.

◆ CMRdblmatConsistency()

char* CMRdblmatConsistency ( CMR_DBLMAT matrix)

Checks a double matrix for consistency.

Checks whether the entries of a row are sorted by column in ascending order. Checks for duplicate entries. Checks for zero entries.

Returns
NULL if consistent. Otherwise, an explanation string is returned, which must free'd with free().
See also
CMRconsistencyAssert() for checking the returned string and aborting in case of inconsistency.
Parameters
matrixA matrix.

◆ CMRdblmatCopy()

CMR_ERROR CMRdblmatCopy ( CMR cmr,
CMR_DBLMAT matrix,
CMR_DBLMAT **  presult 
)

Copies a double matrix to a newly allocated one.

Parameters
cmrCMR environment.
matrixA matrix.
presultPointer for storing a copy of matrix.

◆ CMRdblmatCreate()

CMR_ERROR CMRdblmatCreate ( CMR cmr,
CMR_DBLMAT **  matrix,
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.

Parameters
cmrCMR environment.
matrixPointer for storing the created matrix.
numRowsNumber of rows.
numColumnsNumber of columns.
numNonzerosNumber of nonzeros.

◆ CMRdblmatCreateFromDenseFile()

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.

Returns CMR_ERROR_INPUT in case of errors. In this case, *presult will be NULL. Expects that the file contains only the matrix and no additional data.

Parameters
cmrCMR environment.
fileNameFile stream to read from.
stdinNameIf not NULL, indicates which file name represents stdin.
presultPointer for storing the matrix.

◆ CMRdblmatCreateFromDenseStream()

CMR_ERROR CMRdblmatCreateFromDenseStream ( CMR cmr,
FILE *  stream,
CMR_DBLMAT **  presult 
)

Reads a double matrix from a file stream in dense format.

Returns CMR_ERROR_INPUT in case of errors. In this case, *presult will be NULL.

Parameters
cmrCMR environment.
streamFile stream to read from.
presultPointer for storing the matrix.

◆ CMRdblmatCreateFromSparseFile()

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.

Returns CMR_ERROR_INPUT in case of errors. In this case, *presult will be NULL. Expects that the file contains only the matrix and no additional data.

Parameters
cmrCMR environment.
fileNameFile stream to read from.
stdinNameIf not NULL, indicates which file name represents stdin.
presultPointer for storing the matrix.

◆ CMRdblmatCreateFromSparseStream()

CMR_ERROR CMRdblmatCreateFromSparseStream ( CMR cmr,
FILE *  stream,
CMR_DBLMAT **  presult 
)

Reads a double matrix from a file stream in sparse format.

Returns CMR_ERROR_INPUT in case of errors. In this case, *presult will be NULL.

Parameters
cmrCMR environment.
streamFile stream to read from.
presultPointer for storing the matrix.

◆ CMRdblmatFindBinarySubmatrix()

CMR_ERROR CMRdblmatFindBinarySubmatrix ( CMR cmr,
CMR_DBLMAT matrix,
double  epsilon,
CMR_SUBMAT **  psubmatrix 
)

Finds a large binary submatrix with absolute error tolerance epsilon.

Parameters
cmrCMR environment.
matrixA matrix.
epsilonAbsolute error tolerance.
psubmatrixPointer for storing a large binary submatrix.

◆ CMRdblmatFindEntry()

CMR_ERROR CMRdblmatFindEntry ( CMR_DBLMAT matrix,
size_t  row,
size_t  column,
size_t *  pentry 
)

Finds a specific entry of a double matrix.

Searches for the entry at (row, column) using binary search.

Parameters
matrixInput matrix.
rowA row.
columnA column.
pentryPointer for storing the entry at row, column, or SIZE_MAX if it is zero.

◆ CMRdblmatFindTernarySubmatrix()

CMR_ERROR CMRdblmatFindTernarySubmatrix ( CMR cmr,
CMR_DBLMAT matrix,
double  epsilon,
CMR_SUBMAT **  psubmatrix 
)

Finds a large ternary submatrix with absolute error tolerance epsilon.

Parameters
cmrCMR environment.
matrixA matrix.
epsilonAbsolute error tolerance.
psubmatrixPointer for storing a large binary submatrix.

◆ CMRdblmatFree()

CMR_ERROR CMRdblmatFree ( CMR cmr,
CMR_DBLMAT **  pmatrix 
)

Frees the memory of a double matrix.

Parameters
cmrCMR environment.
pmatrixPointer to matrix.

◆ CMRdblmatIsBinary()

bool CMRdblmatIsBinary ( CMR cmr,
CMR_DBLMAT matrix,
double  epsilon,
CMR_SUBMAT **  psubmatrix 
)

Checks if a double matrix has only entries in \( \{0,1\} \) with absolute error tolerance epsilon.

Parameters
cmrCMR environment.
matrixA matrix.
epsilonAbsolute error tolerance.
psubmatrixPointer for storing a non-binary entry as a submatrix (may be NULL).

◆ CMRdblmatIsTernary()

bool CMRdblmatIsTernary ( CMR cmr,
CMR_DBLMAT matrix,
double  epsilon,
CMR_SUBMAT **  psubmatrix 
)

Checks if a double matrix has only entries in \( \{-1,0,+1\} \) with absolute error tolerance epsilon.

Parameters
cmrCMR environment.
matrixA matrix.
epsilonAbsolute error tolerance.
psubmatrixPointer for storing a non-ternary entry as a submatrix (may be NULL).

◆ CMRdblmatPermute()

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.

Parameters
cmrCMR environment.
matrixGiven matrix.
rowsMapping from new rows to rows of matrix (may be NULL for identity).
columnsMapping from new columns to columns of matrix (may be NULL for identity).
presultPointer for storing the permuted matrix.

◆ CMRdblmatPrintDense()

CMR_ERROR CMRdblmatPrintDense ( CMR cmr,
CMR_DBLMAT matrix,
FILE *  stream,
char  zeroChar,
bool  header 
)

Prints a double matrix in dense format.

Parameters
cmrCMR environment.
matrixA matrix.
streamFile stream to print to.
zeroCharCharacter to print for a zero.
headerWhether to print row and column indices.

◆ CMRdblmatPrintSparse()

CMR_ERROR CMRdblmatPrintSparse ( CMR cmr,
CMR_DBLMAT matrix,
FILE *  stream 
)

Prints a double matrix in sparse format.

Parameters
cmrCMR environment.
matrixA matrix.
streamFile stream to print to.

◆ CMRdblmatSignedSupport()

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 tolerance epsilon.

Parameters
cmrCMR environment.
matrixDouble matrix
epsilonAbsolute error tolerance.
presultPointer for storing the support matrix of matrix.

◆ CMRdblmatSortNonzeros()

CMR_ERROR CMRdblmatSortNonzeros ( CMR cmr,
CMR_DBLMAT matrix 
)

Sorts the nonzeros of a double matrix by column in ascending order.

Parameters
cmrCMR environment.
matrixA matrix.

◆ CMRdblmatSupport()

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 epsilon.

Parameters
cmrCMR environment.
matrixDouble matrix
epsilonAbsolute error tolerance.
presultPointer for storing the support matrix of matrix.

◆ CMRdblmatTranspose()

CMR_ERROR CMRdblmatTranspose ( CMR cmr,
CMR_DBLMAT matrix,
CMR_DBLMAT **  presult 
)

Creates the transpose of a double matrix.

Parameters
cmrCMR environment.
matrixA matrix.
presultPointer for storing the transpose of matrix.

◆ CMRdblmatZoomSubmat()

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.

Parameters
cmrCMR environment.
matrixA matrix
submatrixA submatrix of matrix.
presultPointer for storing the resulting matrix.

◆ CMRintmatChangeNumNonzeros()

CMR_ERROR CMRintmatChangeNumNonzeros ( CMR cmr,
CMR_INTMAT matrix,
size_t  newNumNonzeros 
)

Changes the number of nonzeros and reallocates corresponding arrays.

Parameters
cmrCMR environment.
matrixA matrix.
newNumNonzerosNew number of nonzeros.

◆ CMRintmatCheckEqual()

bool CMRintmatCheckEqual ( CMR_INTMAT matrix1,
CMR_INTMAT matrix2 
)

Checks whether two int matrices are equal.

Parameters
matrix1First matrix.
matrix2Second matrix.

◆ CMRintmatCheckTranspose()

CMR_ERROR CMRintmatCheckTranspose ( CMR cmr,
CMR_INTMAT matrix1,
CMR_INTMAT matrix2,
bool *  pareTranspose 
)

Checks whether two int matrices are transposes of each other.

Parameters
cmrCMR environment.
matrix1First matrix
matrix2Second matrix
pareTransposePointer for storing whether matrix1 and matrix2 are tranposes of each other.

◆ CMRintmatConsistency()

char* CMRintmatConsistency ( CMR_INTMAT matrix)

Checks an int matrix for consistency.

Checks whether the entries of a row are sorted by column in ascending order. Checks for duplicate entries. Checks for zero entries.

Returns
NULL if consistent. Otherwise, an explanation string is returned, which must free'd with free().
See also
CMRconsistencyAssert() for checking the returned string and aborting in case of inconsistency.
Parameters
matrixA matrix.

◆ CMRintmatCopy()

CMR_ERROR CMRintmatCopy ( CMR cmr,
CMR_INTMAT matrix,
CMR_INTMAT **  presult 
)

Copies an int matrix to a newly allocated one.

Parameters
cmrCMR environment.
matrixA matrix.
presultPointer for storing a copy of matrix.

◆ CMRintmatCreate()

CMR_ERROR CMRintmatCreate ( CMR cmr,
CMR_INTMAT **  matrix,
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.

Parameters
cmrCMR environment.
matrixPointer for storing the created matrix.
numRowsNumber of rows.
numColumnsNumber of columns.
numNonzerosNumber of nonzeros.

◆ CMRintmatCreateFromDenseFile()

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.

Returns CMR_ERROR_INPUT in case of errors. In this case, *presult will be NULL. Expects that the file contains only the matrix and no additional data.

Parameters
cmrCMR environment.
fileNameFile stream to read from.
stdinNameIf not NULL, indicates which file name represents stdin.
presultPointer for storing the matrix.

◆ CMRintmatCreateFromDenseStream()

CMR_ERROR CMRintmatCreateFromDenseStream ( CMR cmr,
FILE *  stream,
CMR_INTMAT **  presult 
)

Reads an int matrix from a file stream in dense format.

Returns CMR_ERROR_INPUT in case of errors. In this case, *presult will be NULL.

Parameters
cmrCMR environment.
streamFile stream to read from.
presultPointer for storing the matrix.

◆ CMRintmatCreateFromSparseFile()

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.

Returns CMR_ERROR_INPUT in case of errors. In this case, *presult will be NULL. Expects that the file contains only the matrix and no additional data.

Parameters
cmrCMR environment.
fileNameFile stream to read from.
stdinNameIf not NULL, indicates which file name represents stdin.
presultPointer for storing the matrix.

◆ CMRintmatCreateFromSparseStream()

CMR_ERROR CMRintmatCreateFromSparseStream ( CMR cmr,
FILE *  stream,
CMR_INTMAT **  presult 
)

Reads an int matrix from a file stream in sparse format.

Returns CMR_ERROR_INPUT in case of errors. In this case, *presult will be NULL.

Parameters
cmrCMR environment.
streamFile stream to read from.
presultPointer for storing the matrix.

◆ CMRintmatFindEntry()

CMR_ERROR CMRintmatFindEntry ( CMR_INTMAT matrix,
size_t  row,
size_t  column,
size_t *  pentry 
)

Finds a specific entry of an int matrix.

Searches for the entry at (row, column) using binary search.

Parameters
matrixInput matrix.
rowA row.
columnA column.
pentryPointer for storing the entry at row, column, or SIZE_MAX if it is zero.

◆ CMRintmatFree()

CMR_ERROR CMRintmatFree ( CMR cmr,
CMR_INTMAT **  pmatrix 
)

Frees the memory of an int matrix.

Parameters
cmrCMR environment.
pmatrixPointer to matrix.

◆ CMRintmatIsBinary()

bool CMRintmatIsBinary ( CMR cmr,
CMR_INTMAT matrix,
CMR_SUBMAT **  psubmatrix 
)

Checks if an int matrix has only entries in \( \{0,1\} \).

Parameters
cmrCMR environment.
matrixA matrix.
psubmatrixPointer for storing a non-binary entry as a submatrix (may be NULL).

◆ CMRintmatIsTernary()

bool CMRintmatIsTernary ( CMR cmr,
CMR_INTMAT matrix,
CMR_SUBMAT **  psubmatrix 
)

Checks if an int matrix has only entries in \( \{-1,0,+1\} \).

Parameters
cmrCMR environment.
matrixA matrix.
psubmatrixPointer for storing a non-ternary entry as a submatrix (may be NULL).

◆ CMRintmatPermute()

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.

Parameters
cmrCMR environment.
matrixGiven matrix.
rowsMapping from new rows to rows of matrix (may be NULL for identity).
columnsMapping from new columns to columns of matrix (may be NULL for identity).
presultPointer for storing the permuted matrix.

◆ CMRintmatPrintDense()

CMR_ERROR CMRintmatPrintDense ( CMR cmr,
CMR_INTMAT matrix,
FILE *  stream,
char  zeroChar,
bool  header 
)

Prints an int matrix in dense format.

Parameters
cmrCMR environment.
matrixA matrix.
streamFile stream to print to.
zeroCharCharacter to print for a zero.
headerWhether to print row and column indices.

◆ CMRintmatPrintSparse()

CMR_ERROR CMRintmatPrintSparse ( CMR cmr,
CMR_INTMAT matrix,
FILE *  stream 
)

Prints an int matrix in sparse format.

Parameters
cmrCMR environment.
matrixA matrix.
streamFile stream to print to.

◆ CMRintmatSignedSupport()

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.

Parameters
cmrCMR environment.
matrixDouble matrix
presultPointer for storing the signed support matrix of matrix.

◆ CMRintmatSortNonzeros()

CMR_ERROR CMRintmatSortNonzeros ( CMR cmr,
CMR_INTMAT matrix 
)

Sorts the nonzeros of an int matrix by column in ascending order.

Parameters
cmrCMR environment.
matrixA matrix.

◆ CMRintmatSupport()

CMR_ERROR CMRintmatSupport ( CMR cmr,
CMR_INTMAT matrix,
CMR_CHRMAT **  presult 
)

Creates the (binary) support matrix of an int matrix as a char matrix.

Parameters
cmrCMR environment.
matrixDouble matrix
presultPointer for storing the support matrix of matrix.

◆ CMRintmatToChr()

CMR_ERROR CMRintmatToChr ( CMR cmr,
CMR_INTMAT matrix,
CMR_CHRMAT **  presult 
)

Converts an int matrix to a char matrix.

Returns
CMR_ERROR_OVERFLOW in case of overflow.
Parameters
cmrCMR environment.
matrixInput matrix.
presultPointer for storing the output matrix.

◆ CMRintmatTranspose()

CMR_ERROR CMRintmatTranspose ( CMR cmr,
CMR_INTMAT matrix,
CMR_INTMAT **  presult 
)

Creates the transpose of an int matrix.

Parameters
cmrCMR environment.
matrixGiven matrix.
presultPointer for storing the transpose of matrix.

◆ CMRintmatZoomSubmat()

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.

Parameters
cmrCMR environment.
matrixA matrix
submatrixA submatrix of matrix.
presultPointer for storing the resulting matrix.

◆ CMRsortSubmatrix()

CMR_ERROR CMRsortSubmatrix ( CMR cmr,
CMR_SUBMAT submatrix 
)

Sorts the row and column indices of submatrix.

Parameters
cmrCMR environment.
submatrixThe submatrix.

◆ CMRsortSubmatrixCompare()

static int CMRsortSubmatrixCompare ( const void *  p1,
const void *  p2 
)
static

◆ CMRsubmatCreate()

CMR_ERROR CMRsubmatCreate ( CMR cmr,
size_t  numRows,
size_t  numColumns,
CMR_SUBMAT **  psubmatrix 
)

Creates a submatrix of given size.

Only allocates the memory. Use rows and columns attributes of *psubmatrix to actually set the row and column indices, respectively.

Parameters
cmrCMR environment.
numRowsNumber of rows
numColumnsNumber of columns
psubmatrixPointer to where the submatrix is to be stored.

◆ CMRsubmatCreate1x1()

CMR_ERROR CMRsubmatCreate1x1 ( CMR cmr,
size_t  row,
size_t  column,
CMR_SUBMAT **  psubmatrix 
)

Creates a 1-by-1 submatrix.

Parameters
cmrCMR environment.
rowRow of entry
columnColumn of entry
psubmatrixPointer to submatrix

◆ CMRsubmatFree()

CMR_ERROR CMRsubmatFree ( CMR cmr,
CMR_SUBMAT **  psubmatrix 
)

Frees a submatrix.

Parameters
cmrCMR environment.
psubmatrixPointer to submatrix.

◆ CMRsubmatPrint()

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.

In the stream, row and column indices start at 1 while they start at 0 in submatrix.

Parameters
cmrCMR environment.
submatrixReference submatrix.
numRowsNumber of rows of original matrix.
numColumnsNumber of columns of original matrix.
streamFile stream to save submatrix to.

◆ CMRsubmatReadFromStream()

CMR_ERROR CMRsubmatReadFromStream ( CMR cmr,
CMR_SUBMAT **  psubmatrix,
size_t *  pnumMatrixRows,
size_t *  pnumMatrixColumns,
FILE *  stream 
)

Reads the submatrix *psubmatrix from the file stream.

In the stream, row and column indices start at 1 while they start at 0 in submatrix.

Parameters
cmrCMR environment.
psubmatrixPointer for storing the submatrix.
pnumMatrixRowsPointer for storing the number of rows of the original matrix; may be NULL.
pnumMatrixColumnsPointer for storing the number of rows of the original matrix; may be NULL.
streamFile stream to save submatrix to.

◆ CMRsubmatTranspose()

CMR_ERROR CMRsubmatTranspose ( CMR_SUBMAT submatrix)

Transposes a submatrix.

Parameters
submatrixSubmatrix to transpose.

◆ CMRsubmatWriteToFile()

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.

In the file, row and column indices start at 1 while they start at 0 in submatrix.

Parameters
cmrCMR environment.
submatrixReference submatrix.
numRowsNumber of rows of original matrix.
numColumnsNumber of columns of original matrix.
fileNameFile name to save submatrix to; NULL indicates stdout.

◆ CMRsubmatZoomSubmat()

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.

Assumes that input is a sub-submatrix of references, i.e., each row/column of input must also appear in reference.

Parameters
cmrCMR environment.
referenceReference submatrix.
inputInput submatrix.
poutputPointer for storing the output submatrix.

◆ compareChrNonzeros()

static int compareChrNonzeros ( const void *  pa,
const void *  pb 
)
static

◆ compareDblNonzeros()

static int compareDblNonzeros ( const void *  pa,
const void *  pb 
)
static

◆ compareEntries()

static int compareEntries ( const void **  pa,
const void **  pb 
)
static

◆ compareIntNonzeros()

static int compareIntNonzeros ( const void *  pa,
const void *  pb 
)
static

◆ findBadSubmatrixByMaximum()

static CMR_ERROR findBadSubmatrixByMaximum ( CMR cmr,
ListMat8 listmatrix,
CMR_SUBMAT **  psubmatrix 
)
static

◆ findMaximum()

static size_t findMaximum ( size_t *  array,
size_t  length,
size_t *  pmaxIndex 
)
static