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

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

14.1. COMPUTING AN EIGENFUNCTION OF THE POISSON EQUATION 269<br />

First, we set conceptual conditions on all arguments.<br />

• Op is a model of BinaryFunction, i.e. the following are valid expressions <strong>for</strong> op of type Op:<br />

– op(x,y) where x and y are instances of type X where X is a model of the concept<br />

glas::DenseVectorCollection.<br />

• DenseVectorCollection is a model of glas::DenseVectorCollection.<br />

• Float is a concept of real numbers, i.e. it is float, double, or long double.<br />

The implementation <strong>for</strong> inverse iteration could be as follows:<br />

#ifndef athens inverse iteration hpp<br />

#define athens inverse iteration hpp<br />

#include <br />

#include <br />

namespace athens {<br />

template <br />

void inverse iteration( Op const& op, DenseVectorCollection& x, int m, Float& lambda ) {<br />

glas::dense vector< typename glas::value type::type > y( glas::size(x) ) ;<br />

x = x / norm 2( x ) ; // 2.<br />

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

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

Saved successfully!

Ooh no, something went wrong!