File: gmres.h

package info (click to toggle)
blitz%2B%2B 1%3A1.0.1%2Bds-3
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 8,016 kB
  • sloc: cpp: 56,889; python: 1,939; fortran: 1,510; f90: 852; makefile: 828; sh: 309
file content (46 lines) | stat: -rw-r--r-- 2,109 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
/***************************************************************************
 * gmres.cpp  The GMRES iterative algorithm for solving large scale
 *            sparse or band-limited linear systems
 *
 * references: 
 * [1]   Youcef Saad and Martin H. Schultz, "GMRES: a generalized minimal 
 *       residual algorithm for solving nonsymmetric linear systems",
 *       SIAM J. Sci. Stat. Comput., Vol. 7, No. 3, July 1986, pp. 856--869
 * [2]   http://netlib2.cs.utk.edu/linalg/html_templates/Templates.html
 * [3]   http://www.netlib.org/utk/papers/templates/node29.html
 *
 * Also check http://www.netlib.org/utk/papers/iterative-survey/
 *
 *
 * Copyright (C) 2000-2006 Idesbald van den Bosch <vandenbosch.mailinglist@gmail.com>
 *
 * 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.
 *
 * Suggestions:          vandenbosch.mailinglist@gmail.com
 * Bugs:                 vandenbosch.mailinglist@gmail.com
 *
 * For more information, please see the ... Home Page:
 *
 ****************************************************************************/

using namespace blitz;

void gmres(blitz::Array<complex<double>, 1>& x, // OUTPUT: converged solution
           double & error, // OUTPUT: the error
           int & iter, // OUTPUT: number of iterations needed
           int & flag, // OUTPUT: success flag: 0 if OK
           const blitz::Array<complex<double>, 2>& A, // INPUT: complex matrix
           const blitz::Array<complex<double>, 1>& b, // INPUT: right-hand side
           const double tol, // INPUT: tolerance on solution
           const int RESTRT, // INPUT: restart number
           const int MAXITER); // INPUT: max number of iterations