Woolz Image Processing Version 1.4.0
AlgMatrix.c File Reference

Matrix allocation and maintenance functions. More...

Functions

AlgMatrix AlgMatrixNew (AlgMatrixType aType, size_t nR, size_t nC, size_t nE, double tol, AlgError *dstErr)
 Allocates a new matrix or the requested type.
AlgMatrixRectAlgMatrixRectNew (size_t nR, size_t nC, AlgError *dstErr)
 Allocates a new rectangular matrix.
void AlgMatrixFree (AlgMatrix mat)
 Frees a matrix.
void AlgMatrixRectFree (AlgMatrixRect *mat)
 Frees a rectangular matrix.
AlgMatrixSymAlgMatrixSymNew (size_t nN, AlgError *dstErr)
 Allocates a new symmetric matrix.
void AlgMatrixSymFree (AlgMatrixSym *mat)
 Frees a symmetric matrix.
AlgMatrixLLRAlgMatrixLLRNew (size_t nR, size_t nC, size_t nE, double tol, AlgError *dstErr)
 Allocates a new linked list row matrix.
void AlgMatrixLLRFree (AlgMatrixLLR *mat)
 Frees a linked list row matrix.
AlgMatrixLLREAlgMatrixLLRENew (AlgMatrixLLR *mat)
 Gets a linked list row matrix entry from the matrix. The return value may be NULL if none are available and the entries need to be expanded sing AlgMatrixLLRExpand().
void AlgMatrixLLREFree (AlgMatrixLLR *mat, AlgMatrixLLRE *p)
 Returns a linked list row matrix entry to the free stack of the matrix.
AlgError AlgMatrixWriteAscii (AlgMatrix mat, FILE *fP)
 Writes a matrix in numeric ASCI format to the given file file. The rows are on separate lines and the columns of each row are white space seperated.
AlgMatrix AlgMatrixReadAscii (AlgMatrixType mType, double tol, FILE *fP, const char *fSep, size_t recMax, AlgError *dstErr)
 Reads a matrix of the requested type from an ASCII file. If the type is ALG_MATRIX_SYM then only the first half of each row will be used, although all must be given.
AlgError AlgMatrixSet (AlgMatrix mat, size_t row, size_t col, double val)
AlgError AlgMatrixLLRCopyInPlace (AlgMatrixLLR *aM, AlgMatrixLLR *bM)
AlgError AlgMatrixLLRSet (AlgMatrixLLR *mat, size_t row, size_t col, double val)
 This can have one of three actions: 1. If no value exists at the given coordinates then the new value is added with a new entry. 2. If a value exists at the given coordinate and the given value is non-zero then the entry value is replaced with the given value. 3. If a value exists at the given coordinate and the given value is zero then the corresponding entry is removed. Errors can only occur because of a memory allocation failure. These can be avoided by preallocating sufficient entries using AlgMatrixLLRExpand().
double AlgMatrixValue (AlgMatrix mat, size_t row, size_t col)
 Returns the value in the matrix at the given coordinates.
double AlgMatrixLLRValue (AlgMatrixLLR *mat, size_t row, size_t col)
 Returns the value in the matrix at the given coordinates.
AlgError AlgMatrixLLRExpand (AlgMatrixLLR *mat, size_t nE)
 Ensures that there are at least the requested number of free linked list row matrix entries available.
void AlgMatrixRectZero (AlgMatrixRect *mat)
 Sets all elements of the matrix to zero.
void AlgMatrixSymZero (AlgMatrixSym *mat)
 Sets all elements of the matrix to zero.
void AlgMatrixLLRZero (AlgMatrixLLR *mat)
 Sets all elements of the matrix to zero.
void AlgMatrixLLRERemove (AlgMatrixLLR *mat, size_t row, size_t col)
 Removes the entry at the given coordinates.

Detailed Description

Matrix allocation and maintenance functions.

Author:
Bill Hill
Date:
October 2010
Version:
Id:
636284a84f09b33f089284c4bd6e80e3bd49c6c5
Address: MRC Human Genetics Unit, MRC Institute of Genetics and Molecular Medicine, University of Edinburgh, Western General Hospital, Edinburgh, EH4 2XU, UK.
Copyright (C), [2012], The University Court of the University of Edinburgh, Old College, Edinburgh, UK.

This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.


Function Documentation

void AlgMatrixRectFree ( AlgMatrixRect mat)

Frees a rectangular matrix.

Parameters:
matRectangular matrix.

References AlcDouble2Free(), AlcFree(), and _AlgMatrixRect::array.

Referenced by AlgMatrixFree(), AlgMatrixSVSolve(), and AlgPolynomialLSq().

void AlgMatrixSymFree ( AlgMatrixSym mat)

Frees a symmetric matrix.

Parameters:
matsymmetric matrix.

References AlcDouble2Free(), AlcFree(), and _AlgMatrixSym::array.

Referenced by AlgMatrixFree().

void AlgMatrixLLRFree ( AlgMatrixLLR mat)

Frees a linked list row matrix.

Parameters:
matLinked list row matrix.

References AlcFree(), AlcFreeStackFree(), _AlgMatrixLLR::blk, and _AlgMatrixLLR::tbl.

Referenced by AlgMatrixFree(), and AlgMatrixLLRNew().