CMR
1.3.0
|
#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 | CMRsubmatSlice (CMR *cmr, CMR_SUBMAT *base, CMR_SUBMAT *input, CMR_SUBMAT **poutput) |
Returns the submatrix input as a submatrix of the base submatrix. More... | |
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. 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 | CMRdblmatSlice (CMR *cmr, CMR_DBLMAT *matrix, CMR_SUBMAT *submatrix, CMR_DBLMAT **presult) |
Slices a submatrix of a double matrix. More... | |
CMR_ERROR | CMRintmatSlice (CMR *cmr, CMR_INTMAT *matrix, CMR_SUBMAT *submatrix, CMR_INTMAT **presult) |
Slices a submatrix of an int matrix. More... | |
CMR_ERROR | CMRchrmatSlice (CMR *cmr, CMR_CHRMAT *matrix, CMR_SUBMAT *submatrix, CMR_CHRMAT **presult) |
Slices a submatrix of a char 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 | CMRdblmatToChr (CMR *cmr, CMR_DBLMAT *matrix, double epsilon, CMR_CHRMAT **presult) |
Converts a double 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... | |
CMR_ERROR CMRchrmatChangeNumNonzeros | ( | CMR * | cmr, |
CMR_CHRMAT * | matrix, | ||
size_t | newNumNonzeros | ||
) |
Changes the number of nonzeros and reallocates corresponding arrays.
cmr | CMR environment. |
matrix | A matrix. |
newNumNonzeros | New number of nonzeros. |
bool CMRchrmatCheckEqual | ( | CMR_CHRMAT * | matrix1, |
CMR_CHRMAT * | matrix2 | ||
) |
Checks whether two char matrices are equal.
matrix1 | First matrix. |
matrix2 | Second matrix. |
CMR_ERROR CMRchrmatCheckTranspose | ( | CMR * | cmr, |
CMR_CHRMAT * | matrix1, | ||
CMR_CHRMAT * | matrix2, | ||
bool * | pareTranspose | ||
) |
Checks whether two char matrices are transposes of each other.
cmr | CMR environment. |
matrix1 | First matrix |
matrix2 | Second matrix |
pareTranspose | Pointer for storing whether matrix1 and matrix2 are tranposes of each other. |
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.
NULL
if consistent. Otherwise, an explanation string is returned, which must free'd with free()
.matrix | A matrix. |
CMR_ERROR CMRchrmatCopy | ( | CMR * | cmr, |
CMR_CHRMAT * | matrix, | ||
CMR_CHRMAT ** | presult | ||
) |
Copies a char matrix to a newly allocated one.
cmr | CMR environment. |
matrix | A matrix. |
presult | Pointer for storing a copy of matrix . |
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.
cmr | CMR environment. |
matrix | Pointer for storing the created matrix. |
numRows | Number of rows. |
numColumns | Number of columns. |
numNonzeros | Number of nonzeros. |
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.
cmr | CMR environment. |
fileName | File stream to read from. |
stdinName | If not NULL , indicates which file name represents stdin. |
presult | Pointer for storing the matrix. |
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
.
cmr | CMR environment. |
stream | File stream to read from. |
presult | Pointer for storing the matrix. |
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.
cmr | CMR environment. |
fileName | File stream to read from. |
stdinName | If not NULL , indicates which file name represents stdin. |
presult | Pointer for storing the matrix. |
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
.
cmr | CMR environment. |
stream | File stream to read from. |
presult | Pointer for storing the matrix. |
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
.
matrix | Input matrix. |
row | A row. |
column | A column. |
pentry | Pointer for storing the entry at row , column , or SIZE_MAX if it is zero. |
CMR_ERROR CMRchrmatFree | ( | CMR * | cmr, |
CMR_CHRMAT ** | pmatrix | ||
) |
Frees the memory of a char matrix.
cmr | CMR environment. |
pmatrix | Pointer to matrix. |
bool CMRchrmatIsBinary | ( | CMR * | cmr, |
CMR_CHRMAT * | matrix, | ||
CMR_SUBMAT ** | psubmatrix | ||
) |
Checks if a char matrix has only entries in \( \{0,1\} \).
cmr | CMR environment. |
matrix | A matrix. |
psubmatrix | Pointer for storing a non-binary entry as a submatrix (may be NULL ). |
bool CMRchrmatIsTernary | ( | CMR * | cmr, |
CMR_CHRMAT * | matrix, | ||
CMR_SUBMAT ** | psubmatrix | ||
) |
Checks if a double matrix has only entries in \( \{-1,0,+1\} \).
cmr | CMR environment. |
matrix | A matrix. |
psubmatrix | Pointer for storing a non-ternary entry as a submatrix (may be NULL ). |
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.
cmr | CMR environment. |
matrix | Given matrix. |
rows | Mapping from new rows to rows of matrix (may be NULL for identity). |
columns | Mapping from new columns to columns of matrix (may be NULL for identity). |
presult | Pointer for storing the permuted matrix. |
CMR_ERROR CMRchrmatPrintDense | ( | CMR * | cmr, |
CMR_CHRMAT * | matrix, | ||
FILE * | stream, | ||
char | zeroChar, | ||
bool | header | ||
) |
Prints a char matrix in dense format.
cmr | CMR environment. |
matrix | A matrix. |
stream | File stream to print to. |
zeroChar | Character to print for a zero. |
header | Whether to print row and column indices. |
CMR_ERROR CMRchrmatPrintSparse | ( | CMR * | cmr, |
CMR_CHRMAT * | matrix, | ||
FILE * | stream | ||
) |
Prints a char matrix in sparse format.
cmr | CMR environment. |
matrix | A matrix. |
stream | File stream to print to. |
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.
cmr | CMR environment. |
matrix | Double matrix |
presult | Pointer for storing the signed support matrix of matrix . |
CMR_ERROR CMRchrmatSlice | ( | CMR * | cmr, |
CMR_CHRMAT * | matrix, | ||
CMR_SUBMAT * | submatrix, | ||
CMR_CHRMAT ** | presult | ||
) |
Slices a submatrix
of a char matrix.
cmr | CMR environment. |
matrix | A matrix |
submatrix | A submatrix of matrix . |
presult | Pointer for storing the resulting double matrix. |
CMR_ERROR CMRchrmatSortNonzeros | ( | CMR * | cmr, |
CMR_CHRMAT * | matrix | ||
) |
Sorts the nonzeros of a char matrix by column in ascending order.
cmr | CMR environment. |
matrix | A matrix. |
CMR_ERROR CMRchrmatSupport | ( | CMR * | cmr, |
CMR_CHRMAT * | matrix, | ||
CMR_CHRMAT ** | presult | ||
) |
Creates the (binary) support matrix of a char matrix as a char matrix.
cmr | CMR environment. |
matrix | Double matrix |
presult | Pointer for storing the support matrix of matrix . |
CMR_ERROR CMRchrmatToInt | ( | CMR * | cmr, |
CMR_CHRMAT * | matrix, | ||
CMR_INTMAT ** | presult | ||
) |
Converts a char matrix to an int matrix.
cmr | CMR environment. |
matrix | Input matrix. |
presult | Pointer for storing the output matrix. |
CMR_ERROR CMRchrmatTranspose | ( | CMR * | cmr, |
CMR_CHRMAT * | matrix, | ||
CMR_CHRMAT ** | presult | ||
) |
Creates the transpose of a char matrix.
cmr | CMR environment. |
matrix | Given matrix. |
presult | Pointer for storing the transpose of matrix . |
CMR_ERROR CMRdblmatChangeNumNonzeros | ( | CMR * | cmr, |
CMR_DBLMAT * | matrix, | ||
size_t | newNumNonzeros | ||
) |
Changes the number of nonzeros and reallocates corresponding arrays.
cmr | CMR environment. |
matrix | Given matrix. |
newNumNonzeros | New number of nonzeros. |
bool CMRdblmatCheckEqual | ( | CMR_DBLMAT * | matrix1, |
CMR_DBLMAT * | matrix2 | ||
) |
Checks whether two double matrices are equal.
matrix1 | First matrix. |
matrix2 | Second matrix. |
CMR_ERROR CMRdblmatCheckTranspose | ( | CMR * | cmr, |
CMR_DBLMAT * | matrix1, | ||
CMR_DBLMAT * | matrix2, | ||
bool * | pareTranspose | ||
) |
Checks whether two double matrices are transposes of each other.
cmr | CMR environment. |
matrix1 | First matrix. |
matrix2 | Second matrix. |
pareTranspose | Pointer for storing whether matrix1 and matrix2 are tranposes of each other. |
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.
NULL
if consistent. Otherwise, an explanation string is returned, which must free'd with free()
.matrix | A matrix. |
CMR_ERROR CMRdblmatCopy | ( | CMR * | cmr, |
CMR_DBLMAT * | matrix, | ||
CMR_DBLMAT ** | presult | ||
) |
Copies a double matrix to a newly allocated one.
cmr | CMR environment. |
matrix | A matrix. |
presult | Pointer for storing a copy of matrix . |
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.
cmr | CMR environment. |
matrix | Pointer for storing the created matrix. |
numRows | Number of rows. |
numColumns | Number of columns. |
numNonzeros | Number of nonzeros. |
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.
cmr | CMR environment. |
fileName | File stream to read from. |
stdinName | If not NULL , indicates which file name represents stdin. |
presult | Pointer for storing the matrix. |
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
.
cmr | CMR environment. |
stream | File stream to read from. |
presult | Pointer for storing the matrix. |
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.
cmr | CMR environment. |
fileName | File stream to read from. |
stdinName | If not NULL , indicates which file name represents stdin. |
presult | Pointer for storing the matrix. |
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
.
cmr | CMR environment. |
stream | File stream to read from. |
presult | Pointer for storing the matrix. |
CMR_ERROR CMRdblmatFindBinarySubmatrix | ( | CMR * | cmr, |
CMR_DBLMAT * | matrix, | ||
double | epsilon, | ||
CMR_SUBMAT ** | psubmatrix | ||
) |
Finds a large binary submatrix with absolute error tolerance epsilon
.
cmr | CMR environment. |
matrix | A matrix. |
epsilon | Absolute error tolerance. |
psubmatrix | Pointer for storing a large binary submatrix. |
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.
matrix | Input matrix. |
row | A row. |
column | A column. |
pentry | Pointer for storing the entry at row , column , or SIZE_MAX if it is zero. |
CMR_ERROR CMRdblmatFindTernarySubmatrix | ( | CMR * | cmr, |
CMR_DBLMAT * | matrix, | ||
double | epsilon, | ||
CMR_SUBMAT ** | psubmatrix | ||
) |
Finds a large ternary submatrix with absolute error tolerance epsilon
.
cmr | CMR environment. |
matrix | A matrix. |
epsilon | Absolute error tolerance. |
psubmatrix | Pointer for storing a large binary submatrix. |
CMR_ERROR CMRdblmatFree | ( | CMR * | cmr, |
CMR_DBLMAT ** | pmatrix | ||
) |
Frees the memory of a double matrix.
cmr | CMR environment. |
pmatrix | Pointer to matrix. |
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
.
cmr | CMR environment. |
matrix | A matrix. |
epsilon | Absolute error tolerance. |
psubmatrix | Pointer for storing a non-binary entry as a submatrix (may be NULL ). |
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
.
cmr | CMR environment. |
matrix | A matrix. |
epsilon | Absolute error tolerance. |
psubmatrix | Pointer for storing a non-ternary entry as a submatrix (may be NULL ). |
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.
cmr | CMR environment. |
matrix | Given matrix. |
rows | Mapping from new rows to rows of matrix (may be NULL for identity). |
columns | Mapping from new columns to columns of matrix (may be NULL for identity). |
presult | Pointer for storing the permuted matrix. |
CMR_ERROR CMRdblmatPrintDense | ( | CMR * | cmr, |
CMR_DBLMAT * | matrix, | ||
FILE * | stream, | ||
char | zeroChar, | ||
bool | header | ||
) |
Prints a double matrix in dense format.
cmr | CMR environment. |
matrix | A matrix. |
stream | File stream to print to. |
zeroChar | Character to print for a zero. |
header | Whether to print row and column indices. |
CMR_ERROR CMRdblmatPrintSparse | ( | CMR * | cmr, |
CMR_DBLMAT * | matrix, | ||
FILE * | stream | ||
) |
Prints a double matrix in sparse format.
cmr | CMR environment. |
matrix | A matrix. |
stream | File stream to print to. |
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
.
cmr | CMR environment. |
matrix | Double matrix |
epsilon | Absolute error tolerance. |
presult | Pointer for storing the support matrix of matrix . |
CMR_ERROR CMRdblmatSlice | ( | CMR * | cmr, |
CMR_DBLMAT * | matrix, | ||
CMR_SUBMAT * | submatrix, | ||
CMR_DBLMAT ** | presult | ||
) |
Slices a submatrix
of a double matrix.
cmr | CMR environment. |
matrix | A matrix |
submatrix | A submatrix of matrix . |
presult | Pointer for storing the resulting matrix. |
CMR_ERROR CMRdblmatSortNonzeros | ( | CMR * | cmr, |
CMR_DBLMAT * | matrix | ||
) |
Sorts the nonzeros of a double matrix by column in ascending order.
cmr | CMR environment. |
matrix | A matrix. |
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
.
cmr | CMR environment. |
matrix | Double matrix |
epsilon | Absolute error tolerance. |
presult | Pointer for storing the support matrix of matrix . |
CMR_ERROR CMRdblmatToChr | ( | CMR * | cmr, |
CMR_DBLMAT * | matrix, | ||
double | epsilon, | ||
CMR_CHRMAT ** | presult | ||
) |
Converts a double matrix to a char matrix.
cmr | CMR environment. |
matrix | Input matrix. |
epsilon | Expected accuracy. |
presult | Pointer for storing the output matrix. |
CMR_ERROR CMRdblmatTranspose | ( | CMR * | cmr, |
CMR_DBLMAT * | matrix, | ||
CMR_DBLMAT ** | presult | ||
) |
Creates the transpose of a double matrix.
cmr | CMR environment. |
matrix | A matrix. |
presult | Pointer for storing the transpose of matrix . |
CMR_ERROR CMRintmatChangeNumNonzeros | ( | CMR * | cmr, |
CMR_INTMAT * | matrix, | ||
size_t | newNumNonzeros | ||
) |
Changes the number of nonzeros and reallocates corresponding arrays.
cmr | CMR environment. |
matrix | A matrix. |
newNumNonzeros | New number of nonzeros. |
bool CMRintmatCheckEqual | ( | CMR_INTMAT * | matrix1, |
CMR_INTMAT * | matrix2 | ||
) |
Checks whether two int matrices are equal.
matrix1 | First matrix. |
matrix2 | Second matrix. |
CMR_ERROR CMRintmatCheckTranspose | ( | CMR * | cmr, |
CMR_INTMAT * | matrix1, | ||
CMR_INTMAT * | matrix2, | ||
bool * | pareTranspose | ||
) |
Checks whether two int matrices are transposes of each other.
cmr | CMR environment. |
matrix1 | First matrix |
matrix2 | Second matrix |
pareTranspose | Pointer for storing whether matrix1 and matrix2 are tranposes of each other. |
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.
NULL
if consistent. Otherwise, an explanation string is returned, which must free'd with free()
.matrix | A matrix. |
CMR_ERROR CMRintmatCopy | ( | CMR * | cmr, |
CMR_INTMAT * | matrix, | ||
CMR_INTMAT ** | presult | ||
) |
Copies an int matrix to a newly allocated one.
cmr | CMR environment. |
matrix | A matrix. |
presult | Pointer for storing a copy of matrix . |
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.
cmr | CMR environment. |
matrix | Pointer for storing the created matrix. |
numRows | Number of rows. |
numColumns | Number of columns. |
numNonzeros | Number of nonzeros. |
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.
cmr | CMR environment. |
fileName | File stream to read from. |
stdinName | If not NULL , indicates which file name represents stdin. |
presult | Pointer for storing the matrix. |
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
.
cmr | CMR environment. |
stream | File stream to read from. |
presult | Pointer for storing the matrix. |
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.
cmr | CMR environment. |
fileName | File stream to read from. |
stdinName | If not NULL , indicates which file name represents stdin. |
presult | Pointer for storing the matrix. |
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
.
cmr | CMR environment. |
stream | File stream to read from. |
presult | Pointer for storing the matrix. |
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.
matrix | Input matrix. |
row | A row. |
column | A column. |
pentry | Pointer for storing the entry at row , column , or SIZE_MAX if it is zero. |
CMR_ERROR CMRintmatFree | ( | CMR * | cmr, |
CMR_INTMAT ** | pmatrix | ||
) |
Frees the memory of an int matrix.
cmr | CMR environment. |
pmatrix | Pointer to matrix. |
bool CMRintmatIsBinary | ( | CMR * | cmr, |
CMR_INTMAT * | matrix, | ||
CMR_SUBMAT ** | psubmatrix | ||
) |
Checks if an int matrix has only entries in \( \{0,1\} \).
cmr | CMR environment. |
matrix | A matrix. |
psubmatrix | Pointer for storing a non-binary entry as a submatrix (may be NULL ). |
bool CMRintmatIsTernary | ( | CMR * | cmr, |
CMR_INTMAT * | matrix, | ||
CMR_SUBMAT ** | psubmatrix | ||
) |
Checks if an int matrix has only entries in \( \{-1,0,+1\} \).
cmr | CMR environment. |
matrix | A matrix. |
psubmatrix | Pointer for storing a non-ternary entry as a submatrix (may be NULL ). |
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.
cmr | CMR environment. |
matrix | Given matrix. |
rows | Mapping from new rows to rows of matrix (may be NULL for identity). |
columns | Mapping from new columns to columns of matrix (may be NULL for identity). |
presult | Pointer for storing the permuted matrix. |
CMR_ERROR CMRintmatPrintDense | ( | CMR * | cmr, |
CMR_INTMAT * | matrix, | ||
FILE * | stream, | ||
char | zeroChar, | ||
bool | header | ||
) |
Prints an int matrix in dense format.
cmr | CMR environment. |
matrix | A matrix. |
stream | File stream to print to. |
zeroChar | Character to print for a zero. |
header | Whether to print row and column indices. |
CMR_ERROR CMRintmatPrintSparse | ( | CMR * | cmr, |
CMR_INTMAT * | matrix, | ||
FILE * | stream | ||
) |
Prints an int matrix in sparse format.
cmr | CMR environment. |
matrix | A matrix. |
stream | File stream to print to. |
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.
cmr | CMR environment. |
matrix | Double matrix |
presult | Pointer for storing the signed support matrix of matrix . |
CMR_ERROR CMRintmatSlice | ( | CMR * | cmr, |
CMR_INTMAT * | matrix, | ||
CMR_SUBMAT * | submatrix, | ||
CMR_INTMAT ** | presult | ||
) |
Slices a submatrix
of an int matrix.
cmr | CMR environment. |
matrix | A matrix |
submatrix | A submatrix of matrix . |
presult | Pointer for storing the resulting matrix. |
CMR_ERROR CMRintmatSortNonzeros | ( | CMR * | cmr, |
CMR_INTMAT * | matrix | ||
) |
Sorts the nonzeros of an int matrix by column in ascending order.
cmr | CMR environment. |
matrix | A matrix. |
CMR_ERROR CMRintmatSupport | ( | CMR * | cmr, |
CMR_INTMAT * | matrix, | ||
CMR_CHRMAT ** | presult | ||
) |
Creates the (binary) support matrix of an int matrix as a char matrix.
cmr | CMR environment. |
matrix | Double matrix |
presult | Pointer for storing the support matrix of matrix . |
CMR_ERROR CMRintmatToChr | ( | CMR * | cmr, |
CMR_INTMAT * | matrix, | ||
CMR_CHRMAT ** | presult | ||
) |
Converts an int matrix to a char matrix.
cmr | CMR environment. |
matrix | Input matrix. |
presult | Pointer for storing the output matrix. |
CMR_ERROR CMRintmatTranspose | ( | CMR * | cmr, |
CMR_INTMAT * | matrix, | ||
CMR_INTMAT ** | presult | ||
) |
Creates the transpose of an int matrix.
cmr | CMR environment. |
matrix | Given matrix. |
presult | Pointer for storing the transpose of matrix . |
CMR_ERROR CMRsortSubmatrix | ( | CMR * | cmr, |
CMR_SUBMAT * | submatrix | ||
) |
Sorts the row and column indices of submatrix
.
cmr | CMR environment. |
submatrix | The submatrix. |
|
static |
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.
cmr | CMR environment. |
numRows | Number of rows |
numColumns | Number of columns |
psubmatrix | Pointer to where the submatrix is to be stored. |
CMR_ERROR CMRsubmatCreate1x1 | ( | CMR * | cmr, |
size_t | row, | ||
size_t | column, | ||
CMR_SUBMAT ** | psubmatrix | ||
) |
Creates a 1-by-1 submatrix.
cmr | CMR environment. |
row | Row of entry |
column | Column of entry |
psubmatrix | Pointer to submatrix |
CMR_ERROR CMRsubmatFree | ( | CMR * | cmr, |
CMR_SUBMAT ** | psubmatrix | ||
) |
Frees a submatrix.
cmr | CMR environment. |
psubmatrix | Pointer to submatrix. |
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
.
cmr | CMR environment. |
submatrix | Reference submatrix. |
numRows | Number of rows of original matrix. |
numColumns | Number of columns of original matrix. |
stream | File stream to save submatrix to. |
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
.
cmr | CMR environment. |
psubmatrix | Pointer for storing the submatrix. |
pnumMatrixRows | Pointer for storing the number of rows of the original matrix; may be NULL . |
pnumMatrixColumns | Pointer for storing the number of rows of the original matrix; may be NULL . |
stream | File stream to save submatrix to. |
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.
Assumes that each row/column of input
also appear inbase
. After the call *poutput
will refer to the same rows/columns but from the viewpoint of base
. Otherwise, CMR_ERROR_INPUT is returned.
cmr | CMR environment. |
base | Reference submatrix. |
input | Input submatrix. |
poutput | Pointer for storing the output submatrix. |
CMR_ERROR CMRsubmatTranspose | ( | CMR_SUBMAT * | submatrix | ) |
Transposes a submatrix.
submatrix | Submatrix to transpose. |
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.
The rows/columns of input
are interpreted as those of base
. After the call *poutput
will refer to the saem rows/columns but as those of the parent.
cmr | CMR environment. |
base | Reference submatrix. |
input | Input submatrix. |
poutput | Pointer for storing the output submatrix. |
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
.
cmr | CMR environment. |
submatrix | Reference submatrix. |
numRows | Number of rows of original matrix. |
numColumns | Number of columns of original matrix. |
fileName | File name to save submatrix to; NULL indicates stdout. |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |