#include <stdlib.h>
#include <stdio.h>
#include <ctype.h>
#include <string.h>
#include <assert.h>
#include "symmatrix.h"
Defines | |
#define | MAX_BUF_SIZE 65536 |
Functions | |
int | NewSymMatrix (symmatrix_t **symmat, int nrows, int ncols) |
Allocates symmat and its members and initialises them. Data will be calloced, i.e. initialised with zeros. | |
void | SymMatrixSetValue (symmatrix_t *symmat, const int i, const int j, const double value) |
Sets symmat data of given index to given value. | |
double | SymMatrixGetValue (symmatrix_t *symmat, const int i, const int j) |
Returns element of symmat corresponding to given indices. | |
void | SymMatrixGetValueP (double **val, symmatrix_t *symmat, const int i, const int j) |
Returns a pointer to an element of symmat corresponding to given indices. | |
void | FreeSymMatrix (symmatrix_t **symmat) |
Frees memory allocated by data members of symmat and symmat itself. | |
void | SymMatrixPrint (symmatrix_t *symmat, char **labels, const char *path) |
Print out a symmat in phylip style. Distances are printed on one line per sequence/object. Since we also support matrices with rows<cols, the first line can also be nrows by ncolumns instead of just nrows. | |
int | SymMatrixRead (char *pcFileIn, symmatrix_t **prSymMat_p) |
Read a distance matrix in phylip format. |
#define MAX_BUF_SIZE 65536 |
void FreeSymMatrix | ( | symmatrix_t ** | symmat | ) |
Frees memory allocated by data members of symmat and symmat itself.
[in] | symmat | symmatrix_t to be freed |
int NewSymMatrix | ( | symmatrix_t ** | symmat, | |
int | nrows, | |||
int | ncols | |||
) |
Allocates symmat and its members and initialises them. Data will be calloced, i.e. initialised with zeros.
[out] | symmat | newly allocated and initialised symmatrix instance |
[in] | nrows | number of rows |
[in] | ncols | number of columns |
double SymMatrixGetValue | ( | symmatrix_t * | symmat, | |
const int | i, | |||
const int | j | |||
) |
Returns element of symmat corresponding to given indices.
[in] | symmat | symmatrix_t of question |
[in] | i | index i |
[in] | j | index j |
void SymMatrixGetValueP | ( | double ** | val, | |
symmatrix_t * | symmat, | |||
const int | i, | |||
const int | j | |||
) |
Returns a pointer to an element of symmat corresponding to given indices.
[out] | val | Value to be set |
[in] | symmat | symmatrix_t of question |
[in] | i | index i |
[in] | j | index j |
void SymMatrixPrint | ( | symmatrix_t * | symmat, | |
char ** | labels, | |||
const char * | path | |||
) |
Print out a symmat in phylip style. Distances are printed on one line per sequence/object. Since we also support matrices with rows<cols, the first line can also be nrows by ncolumns instead of just nrows.
[in] | symmat | the symmatrix_t to print |
[in] | labels | sequence/objects labels/names. must be at least of length symmat nrows |
[in] | path | filename or NULL. If NULL stdout will be used. |
int SymMatrixRead | ( | char * | pcFileIn, | |
symmatrix_t ** | prSymMat_p | |||
) |
Read a distance matrix in phylip format.
[in] | pcFileIn | distance matrix filename |
[out] | prSymMat_p | the symmatrix_t. will be allocated here. |
void SymMatrixSetValue | ( | symmatrix_t * | symmat, | |
const int | i, | |||
const int | j, | |||
const double | value | |||
) |
Sets symmat data of given index to given value.
[in] | symmat | symmatrix_t whose data is to be set |
[in] | i | first index |
[in] | j | second index |
[in] | value | value used to set data point |