Woolz Image Processing Version 1.4.0
AlgMatrixMath.c File Reference

Functions for basic arithmatic with matricies. More...

Functions

void AlgMatrixAdd (AlgMatrix aM, AlgMatrix bM, AlgMatrix cM)
 Computes the sum of two matricies and returns the result in a third supplied matrix:

\[ \mathbf{A} = \mathbf{B} + \mathbf{C} \]

The dimensions of the all three matricies must be nR, nC. It is safe to supply the same matrix as any combination of aM, bM and cM.

void AlgMatrixSub (AlgMatrix aM, AlgMatrix bM, AlgMatrix cM)
 Subtracts on matrix from another and returns the result in a third supplied matrix:

\[ \mathbf{A} = \mathbf{B} - \mathbf{C} \]

The dimensions of the all three matricies must be nR, nC. It is safe to supply the same matrix as any combination of aM, bM and cM.

void AlgMatrixMul (AlgMatrix aM, AlgMatrix bM, AlgMatrix cM)
 Computes the product of two matricies and returns the result in a third supplied matrix:

\[ \mathbf{A} = \mathbf{B} \mathbf{C} \]

The dimensions of the result matrix (aM) must be cR, bC. All the matrices must be valid and of the same type except in the case of multiplying tow symmetric matrices when the result matrix must be rectangular (because in general the product of two symmetric matrices is not symmetric).

double AlgMatrixTrace (AlgMatrix aM)
 Computes the trace of the given matrix.
void AlgMatrixTranspose (AlgMatrix aM, AlgMatrix bM)
 Computes the transpose of the given matrix:

\[ \mathbf{A} = \mathbf{B^T} \]

aM = transpose(bM). The dimensions of the result matrix (aM) must be aR == bC, aC == bR.

void AlgMatrixCopy (AlgMatrix aM, AlgMatrix bM)
 Copies the values of the matrix bM to the result matric aM:

\[ \mathbf{A} = \mathbf{B} \]

.

void AlgMatrixScale (AlgMatrix aM, AlgMatrix bM, double sv)
 Multiplies the given matrix by the given scalar:

\[ \mathbf{A} = s \mathbf{B} \]

.

void AlgMatrixScaleAdd (AlgMatrix aM, AlgMatrix bM, AlgMatrix cM, double sv)
 Multiplies the a matrix by a scalar and then adds another matrix:

\[ \mathbf{A} = \mathbf{B} + s \mathbf{C}. \]

All the matrices must have the same dimensions.

void AlgMatrixScalar (AlgMatrix aM, double sv)
 Sets the elements of the given square matrix so that it is a scalar matrix:

\[ \mathbf{A} = s \mathbf{I} \]

.

void AlgMatrixZero (AlgMatrix mat)
 Sets the elements of the given matrix to zero.
void AlgMatrixVectorMul (double *aV, AlgMatrix bM, double *cV)
 Multiplies the matrix $\mathbf{B}$ by the vector $\mathbf{c}$:

\[ \mathbf{a} = \mathbf{B} \mathbf{c} \]

.

void AlgMatrixVectorMulAdd (double *aV, AlgMatrix bM, double *cV, double *dV)
 Multiplies the matrix $\mathbf{B}$ by the vector $\mathbf{c}$ and adds the vector $\mathbf{d}$:

\[ \mathbf{a} = \mathbf{B} \mathbf{c} + \mathbf{d} \]

.

void AlgMatrixVectorMulWAdd (double *aV, AlgMatrix bM, double *cV, double *dV, double s, double t)
 Multiplies the matrix $\mathbf{B}$ by the vector $\mathbf{c}$ and adds the vector $\mathbf{d}$ using the given weights $s$ and $t$:

\[ \mathbf{a} = s \mathbf{B} \mathbf{c} + t \mathbf{d} \]

.

void AlgMatrixTVectorMul (double *aV, AlgMatrix bM, double *cV)
 Multiplies the transpose of matrix $\mathbf{B}$ by the vector $\mathbf{c}$:

\[ \mathbf{a} = \mathbf{B}^T \mathbf{c} \]

.

void AlgMatrixTVectorMulAdd (double *aV, AlgMatrix bM, double *cV, double *dV)
 Multiplies the transpose of matrix $\mathbf{B}$ by the vector $\mathbf{c}$:

\[ \mathbf{a} = \mathbf{B}^T \mathbf{c} + \mathbf{d} \]

.

AlgError AlgMatrixRawInv2x2 (double *a00, double *a01, double *a10, double *a11)
 Inverts a raw 2 x 2 matrix. All matrix values are passed using pointers and their values are set to those of the inverse matrix on return. If the given matrix is singular the ALG_ERR_MATRIX_SINGULAR error code is returned and no values are changed.
AlgError AlgMatrixRawInv3x3 (double *a00, double *a01, double *a02, double *a10, double *a11, double *a12, double *a20, double *a21, double *a22)
 Inverts a raw 2 x 2 matrix. All matrix values are passed using pointers and their values are set to those of the inverse matrix on return. If the given matrix is singular the ALG_ERR_MATRIX_SINGULAR error code is returned and no values are changed.

Detailed Description

Functions for basic arithmatic with matricies.

Author:
Bill Hill
Date:
June 2001
Version:
Id:
a5f1ff3e30c0af3c68dc0b4f62bf851e9eb7542e
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.