Adaptagrams
conjugate_gradient.h
1 /*
2  * vim: ts=4 sw=4 et tw=0 wm=0
3  *
4  * libcola - A library providing force-directed network layout using the
5  * stress-majorization method subject to separation constraints.
6  *
7  * Copyright (C) 2006-2008 Monash University
8  *
9  * This library is free software; you can redistribute it and/or
10  * modify it under the terms of the GNU Lesser General Public
11  * License as published by the Free Software Foundation; either
12  * version 2.1 of the License, or (at your option) any later version.
13  * See the file LICENSE.LGPL distributed with the library.
14  *
15  * This library is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
18  *
19 */
20 
21 #ifndef _CONJUGATE_GRADIENT_H
22 #define _CONJUGATE_GRADIENT_H
23 
24 #include <valarray>
25 
26 double
27 inner(std::valarray<double> const &x,
28  std::valarray<double> const &y);
29 
30 void
31 conjugate_gradient(std::valarray<double> const &A,
32  std::valarray<double> &x,
33  std::valarray<double> const &b,
34  unsigned const n, double const tol,
35  unsigned const max_iterations);
36 #endif // _CONJUGATE_GRADIENT_H