Clustal Omega  1.2.3
Data Structures | Functions
symmatrix.h File Reference
#include "seq.h"
Include dependency graph for symmatrix.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  symmatrix_t
 symmetric matrix structure More...
 

Functions

int NewSymMatrix (symmatrix_t **symmat, const int nrows, const int ncols)
 Allocates symmat and its members and initialises them. Data will be calloced, i.e. initialised with zeros. More...
 
void SymMatrixSetValue (symmatrix_t *symmat, const int i, const int j, const double value)
 Sets symmat data of given index to given value. More...
 
double SymMatrixGetValue (symmatrix_t *symmat, const int i, const int j)
 Returns element of symmat corresponding to given indices. More...
 
void SymMatrixGetValueP (double **value, symmatrix_t *symmat, const int i, const int j)
 Returns a pointer to an element of symmat corresponding to given indices. More...
 
void FreeSymMatrix (symmatrix_t **symmat)
 Frees memory allocated by data members of symmat and symmat itself. More...
 
void SymMatrixPrint (symmatrix_t *symmat, char **labels, const char *path, bool bPercID)
 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. More...
 
int SymMatrixRead (char *pcFileIn, symmatrix_t **prSymMat_p, mseq_t *prMSeq)
 Read a distance matrix in phylip format. More...
 

Function Documentation

void FreeSymMatrix ( symmatrix_t **  symmat)

Frees memory allocated by data members of symmat and symmat itself.

Parameters
[in]symmatsymmatrix_t to be freed
Note
Use in conjunction with NewSymMatrix()
See also
NewSymMatrix()
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.

Parameters
[out]symmatnewly allocated and initialised symmatrix instance
[in]nrowsnumber of rows
[in]ncolsnumber of columns
Returns
: non-zero on error
See also
FreeSymMatrix()
Note
: symmat data will be of fake shape nrows x ncols
double SymMatrixGetValue ( symmatrix_t symmat,
const int  i,
const int  j 
)

Returns element of symmat corresponding to given indices.

Parameters
[in]symmatsymmatrix_t of question
[in]iindex i
[in]jindex j
Returns
requested value
See also
SymMatrixSetValue()
Note
This is a convenience function that checks index order.
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.

Parameters
[out]valValue to be set
[in]symmatsymmatrix_t of question
[in]iindex i
[in]jindex j
Returns
pointer to value
See also
SymMatrixGetValue()
Note
This is a convenience function that checks index order.
void SymMatrixPrint ( symmatrix_t symmat,
char **  labels,
const char *  path,
bool  bPercID 
)

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.

Parameters
[in]symmatthe symmatrix_t to print
[in]labelssequence/objects labels/names. must be at least of length symmat nrows
[in]pathfilename or NULL. If NULL stdout will be used.
int SymMatrixRead ( char *  pcFileIn,
symmatrix_t **  prSymMat_p,
mseq_t prMSeq 
)

Read a distance matrix in phylip format.

Parameters
[in]pcFileIndistance matrix filename
[in]prMSeqoptional mseq pointer. only used for consistency checking of names/labels
[out]prSymMat_pthe symmatrix_t. will be allocated here.
Returns
: non-zero on error
Note
: FIXME untested code
void SymMatrixSetValue ( symmatrix_t symmat,
const int  i,
const int  j,
const double  value 
)

Sets symmat data of given index to given value.

Parameters
[in]symmatsymmatrix_t whose data is to be set
[in]ifirst index
[in]jsecond index
[in]valuevalue used to set data point
See also
SymMatrixGetValue()
Note
This is a convenience function that checks index order.