1 /*********************************************************************
2 * Clustal Omega - Multiple sequence alignment
4 * Copyright (C) 2010 University College Dublin
6 * Clustal-Omega is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License as
8 * published by the Free Software Foundation; either version 2 of the
9 * License, or (at your option) any later version.
11 * This file is part of Clustal-Omega.
13 ********************************************************************/
16 * RCS $Id: symmatrix.h 216 2011-03-19 10:11:53Z andreas $
20 * Functions for symmetric (square) matrices including diagonal.
22 * Supports the notion of non-square sub-matrices of a symmetric
23 * matrix, i.e. where |rows|<|cols| and the corresponding full matrix
24 * would be |cols|x|cols|
26 * Instead of making this one big chunk of memory we keep pointers to
27 * pointers, so that we can easily realloc (the project where this file
28 * originated from needed this for growing a "seed" matrix).
30 * FIXME Allocating one big chunk of memory is probably
31 * much faster and also easier to maintain.
36 #ifndef CLUSTALO_SYMMATRIX_H
37 #define CLUSTALO_SYMMATRIX_H
41 * @brief symmetric matrix structure
44 int nrows; /**< number of rows */
45 int ncols; /**< number of columns */
49 * @note indices range: [i][j-i] i<=j. use getvalue() and
50 * setvalue() instead of accessing directly
52 * @see SymMatrixGetValue(), SymMatrixSetValue()
60 NewSymMatrix(symmatrix_t **symmat, const int nrows, const int ncols);
63 SymMatrixSetValue(symmatrix_t *symmat, const int i, const int j, const double value);
66 SymMatrixGetValue(symmatrix_t *symmat, const int i, const int j);
69 SymMatrixGetValueP(double **value, symmatrix_t *symmat, const int i, const int j);
72 FreeSymMatrix(symmatrix_t **symmat);
75 SymMatrixPrint(symmatrix_t *symmat, char **labels, const char *path);
78 SymMatrixRead(char *pcFileIn, symmatrix_t **prSymMat_p);