cgsolve.h   cgsolve.h 
// -*- C++ -*-
/************************************************************************** * /************************************************************************** *
* blitz/array/cgsolve.h Basic conjugate gradient solver for linear system s * blitz/array/cgsolve.h Basic conjugate gradient solver for linear system s
* *
* Copyright (C) 1997-2001 Todd Veldhuizen <tveldhui@oonumerics.org> * $Id$
* *
* This program is free software; you can redistribute it and/or * Copyright (C) 1997-2011 Todd Veldhuizen <tveldhui@acm.org>
* modify it under the terms of the GNU General Public License *
* as published by the Free Software Foundation; either version 2 * This file is a part of Blitz.
*
* Blitz is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License
* as published by the Free Software Foundation, either version 3
* of the License, or (at your option) any later version. * of the License, or (at your option) any later version.
* *
* This program is distributed in the hope that it will be useful, * Blitz is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with Blitz. If not, see <http://www.gnu.org/licenses/>.
* *
* Suggestions: blitz-dev@oonumerics.org * Suggestions: blitz-devel@lists.sourceforge.net
* Bugs: blitz-bugs@oonumerics.org * Bugs: blitz-support@lists.sourceforge.net
* *
* For more information, please see the Blitz++ Home Page: * For more information, please see the Blitz++ Home Page:
* http://oonumerics.org/blitz/ * https://sourceforge.net/projects/blitz/
* *
************************************************************************** **/ ************************************************************************** **/
#ifndef BZ_CGSOLVE_H #ifndef BZ_CGSOLVE_H
#define BZ_CGSOLVE_H #define BZ_CGSOLVE_H
BZ_NAMESPACE(blitz) BZ_NAMESPACE(blitz)
template<typename T_numtype> template<typename T_numtype>
void dump(const char* name, Array<T_numtype,3>& A) void dump(const char* name, Array<T_numtype,3>& A)
{ {
T_numtype normA = 0; T_numtype normA = 0;
for (int i=A.lbound(0); i <= A.ubound(0); ++i) for (int i=A.lbound(0); i <= A.ubound(0); ++i)
{ {
for (int j=A.lbound(1); j <= A.ubound(1); ++j) for (int j=A.lbound(1); j <= A.ubound(1); ++j)
{ {
for (int k=A.lbound(2); k <= A.ubound(2); ++k) for (int k=A.lbound(2); k <= A.ubound(2); ++k)
{ {
T_numtype tmp = A(i,j,k); T_numtype tmp = A(i,j,k);
normA += ::fabs(tmp); normA += BZ_MATHFN_SCOPE(fabs)(tmp);
} }
} }
} }
normA /= A.numElements(); normA /= A.numElements();
cout << "Average magnitude of " << name << " is " << normA << endl; cout << "Average magnitude of " << name << " is " << normA << endl;
} }
template<typename T_stencil, typename T_numtype, int N_rank, typename T_BCs > template<typename T_stencil, typename T_numtype, int N_rank, typename T_BCs >
int conjugateGradientSolver(T_stencil stencil, int conjugateGradientSolver(T_stencil stencil,
 End of changes. 8 change blocks. 
10 lines changed or deleted 18 lines changed or added

This html diff was produced by rfcdiff 1.41. The latest version is available from http://tools.ietf.org/tools/rfcdiff/