
Daniel Oberhoff a écrit :
Now I would like to iterate such expressions efficiently to evaluate assignment expressions like:
C = A(_i,_j) + B(_j,_i*_j-2);
efficiently.
What I want to do is base it around basic "iterators" for each array indexing expression ( i.e. B(_j,_i*_j-2) and A(_i,_j) in the example) that know how to move to a certain setting for the index placeholders and how to advance along the index placeholders (e.g. advance the data pointer for _i -> _i+1, _j -> _j+1). I think I could implement such iterators (not in the STL sense, since I dont use begin/end, but enough for what I need) for the array indexing expressions, but I dont know how to generate the iterator for the complete expression. I would like such an iterator be generated automatically given the individual iterators for the array indexing expressions and be able to call move, advance, and evaluate on such an iterator. You'll need to build an evaluation context that takes an expression and an iterator. In this context, you evaluates each element of the expression for this iterator. Then you'll add an operator= to your array class that take an expression and walk through your iterator and call the eval function on your expression, using a context initialized with the current iterator.
-- ___________________________________________ Joel Falcou - Assistant Professor PARALL Team - LRI - Universite Paris Sud XI Tel : (+33)1 69 15 66 35