- Iterative Template Library
The Iterative Template Library (ITL) is a generic component library that provides iterative methods for solving linear systems. ITL also provides numerous preconditioners which is for MTL. The ITL was written at the
Open Systems Lab ofIndiana University byAndrew Lumsdaine ,Lie-Quan Lee ,Jeremy Seik , and others.ITL uses the abstract interface of matrix–vector, vector–vector, and vector–scalar operations MTL is default to serve those operations. ITL is able to use other packages such as
Blitz++ and BLAS with the same abstract interface provided.Because generic programming encourages simplifying interfaces to only what is required by the logic they support, the ITL algorithms resemble pseudocode, at least when compared with other implementations of the same algorithms. For example, ITL's
conjugate gradient follows: /* required operations: mult,copy,dot_conj,add,scaled */ template < class Matrix, class VectorX, class VectorB, class Preconditioner, class Iteration > int cg(const Matrix& A, VectorX& x, const VectorB& b, const Preconditioner& M, Iteration& iter) { typedef VectorX TmpVec; typename itl_traits::value_type rho(0), rho_1(0), alpha(0), beta(0); TmpVec p(size(x)), q(size(x)), r(size(x)), z(size(x)); itl::mult(A, itl::scaled(x, -1.0), b, r); while (! iter.finished(r)) { itl::solve(M, r, z); rho = itl::dot_conj(r, z); if (iter.first()) itl::copy(z, p); else { beta = rho / rho_1; itl::add(z, itl::scaled(p, beta), p); } itl::mult(A, p, q); alpha = rho / itl::dot_conj(p, q); itl::add(x, itl::scaled(p, alpha), x); itl::add(r, itl::scaled(q, -alpha), r); rho_1 = rho; ++iter; } return iter.error_code(); } ee also
*
Template Numerical Toolkit External links
* [http://www.osl.iu.edu/research/itl/ ITL Home Page]
Wikimedia Foundation. 2010.