1 Jan 01:21 2009

### Re: proto for array expressions

Eric Niebler <eric <at> boost-consulting.com>

2009-01-01 00:21:21 GMT

2009-01-01 00:21:21 GMT

Sorry for the delay, the holidays, you know ... Daniel Oberhoff wrote: > On 2008-12-18 23:46:40 +0100, Eric Niebler <eric <at> boost-consulting.com> > said: > >> Daniel Oberhoff wrote: >>> >>> Now with proto I was wondering how hard it would be to build an et >>> engine for array math. Basically I am interested in general tensor >>> notation, and the resulting expressions should be iteratable >>> efficiently. think (advanced example): >>> >>> a_ij = b_i * (c_j - sum(d_ijk, k = [i-1,1]) >> >> I don't understand your notation. What are a_ij et. al.? > > Sorry, the underscripts where meant to be indices. So a is a 2d array, b > and c are 1d arrays, and d is a 3d array. The statement says: to > calculate a at a given index pair i,j (say 0,0) you substitute for i,j > on the right. And the sum sums over the third index of the 3d array d. > The notation further says that the bounds for the summation depend on > what you substitute for i. So to fill the array a like that you need to > substitute all values in the domian (say both indices run from 0 to 99 > for a 100x100 array), and for efficiency it would be best if the right > hand side would result in an iterator that substitutes subsequent all > values in series. OK, the syntax for your tensor expressions needs work, but I think what you're shooting for is certainly doable. How about a syntax like this:(Continue reading)