03.12.2012 Views

C++ for Scientists - Technische Universität Dresden

C++ for Scientists - Technische Universität Dresden

C++ for Scientists - Technische Universität Dresden

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

266 CHAPTER 14. NUMERICAL EXERCISES<br />

• G is a model of concept glas::VectorExpression.<br />

Next, we write the code <strong>for</strong> the Richardson iteration. We store the variables ui in u and ri in r.<br />

#ifndef athens richardson hpp<br />

#define athens richardson hpp<br />

#include <br />

namespace athens {<br />

template <br />

double richardson( Op const& op, F const& f, U& u, double const& tol, int max it ) {<br />

double resid norm ;<br />

// Create residual vector<br />

glas::dense vector< typename glas::value type::type > r( glas::size(u) ) ;<br />

<strong>for</strong> ( int iter =0; iter

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!