Woolz Image Processing Version 1.4.0
AlgMatrixCG.c File Reference

Conjugate Gradient iterative method with preconditioning for the solution of linear systems with the form $\mathbf{A} \mathbf{x} = \mathbf{b}$. A must be a symmetric postive definite matrix, i.e. ${\mathbf{x}}^T \mathbf{A} \mathbf{x} < 0$, $\forall \mathbf{x} \not= \mathbf{0}$, $\mathbf{x} \in R^n$. More...

Functions

AlgError AlgMatrixCGSolve (AlgMatrix aM, double *xV, double *bV, AlgMatrix wM, void(*pFn)(void *, AlgMatrix, double *, double *), void *pDat, double tol, int maxItr, double *dstTol, int *dstItr)
 Conjugate Gradient iterative method with preconditioning for the solution of linear systems with the form $\mathbf{A} \mathbf{x} = \mathbf{b}$. $\mathbf{A}$ must be a symmetric postive definite matrix, i.e. ${\mathbf{x}}^T \mathbf{A} \mathbf{x} < 0$, $\forall \mathbf{x} \not= \mathbf{0}$, $\mathbf{x} \in R^n$. Convergence is tested using: $ \frac{\| \mathbf{b} - mathbf{A} \mathbf{x} \|} {\|\mathbf{b}\|} < \delta$. If the preconditioning function pFn is non NULL then it is called, passing the preconditioning data pDat, as: (*pFn)(void *pDat, double **aM, double *r, double *z, int n) to solve $\mathbf{A} \mathbf{z} = \mathbf{r}$ for $\mathbf{z}$ with the solution overwriting the initial contents of z.

Detailed Description

Conjugate Gradient iterative method with preconditioning for the solution of linear systems with the form $\mathbf{A} \mathbf{x} = \mathbf{b}$. A must be a symmetric postive definite matrix, i.e. ${\mathbf{x}}^T \mathbf{A} \mathbf{x} < 0$, $\forall \mathbf{x} \not= \mathbf{0}$, $\mathbf{x} \in R^n$.

Author:
Bill Hill
Date:
March 2003
Version:
Id:
7ef8f6fddbba572290647f5306f079d24a6410dc
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. This code is adapted from CG.f which is described in "Templates for the Solution of Linear Systems: Building Blocks for Iterative Methods", Barrett, Berry, Chan, Demmel, Donato, Dongarra, Eijkhout, Pozo, Romine, and van der Vorst, SIAM Publications, 1993. Also downloadable from http://www.netlib.org/templates/index.html.