LA_library/conjgrad.h

15 lines
518 B
C
Raw Normal View History

2005-02-04 15:31:42 +01:00
#include "vec.h"
#include "smat.h"
#include "mat.h"
#include "sparsemat.h"
#include "nonclass.h"
//conjugate gradient solution of a linear system
//matrix can be any class which has nrows(), ncols(), diagonalof() and NRVec::gemv() available
//does not even have to be explicitly stored
template<typename T, typename Matrix>
extern void conjgrad(const Matrix &bigmat, const NRVec<T> &b, NRVec<T> &x, const bool doguess, const double tol, const int itmax, const bool verbose, bool issquare,const bool precondition);