From: Navneet D. <Nav...@in...> - 2004-05-11 12:23:30
|
Hi Amit, Blitz has tensor notation for such computations. Look at documentation for detail. However, when I tried your example with tensor mechanism, blitz expression template complains about array C being a 1D array. So I don't think that your example will compile without writing for loops. If any one has better ideas, you are welcome. In precisely these kind of situtations, one would like to use blitz iterators. However, blitz iterators are associated with array class. So this makes them cumbersome to use in these kind of expresions -- should one use 3 different iterators in this example or one singe iterator with position function to access other elements. For these kind of situations, I wrote DomainIter class some months back. I have been using it for quite some time now. So Julian, may we should add this class to blitz cvs repository. I am attaching required files and an example file showing the common use. For details, you may like to look at documentation in the file. I hope this helps -navneet On Monday 10 May 2004 19:16, Ami...@se... wrote: > Hi, > > I am trying to implement something on the following lines: > > Array<float,3> A, B; //size Nx*Ny*Nz > Array<int,3> index; // size Nx*Ny*Nz > Array<float,1> C; // A look up table > .. > .. > .. > for(k=0; k<Nz; k++) > for(j=0; j<Ny; j++) > for(i=0; i<Nx; i++) > A(i,j,k)+=B(i,j,k)*C(index(i,j,k)); > > Can I use an efficient simple statement in Blitz using "Range" ? > > eg: > > For range objects I, J, K > > A(I,J,K)+=B(I,J,K)*________ > > I do not know what to fill in the blanks !! C(index(I,J,K)) does not work. > > Thanks > > Rgds, > Amit > > > > _______________________________________________ > Blitz-support mailing list > Bli...@oo... > http://www.oonumerics.org/mailman/listinfo.cgi/blitz-support -- Navneet DALAL http://lear.inrialpes.fr/people/Dalal INRIA Rhone-Alpes Ph : +33 (0)476 61 54 97 ZIRST-655, av. de l'Europe - 38334 FAX : +33 (0)476 61 54 54 Montbonnot St. Martin, FRANCE Cell : +33 (0)677 54 33 33 |