Blitz logo

Blitz Support :

From: Fernando Perez (fperez_at_[hidden])
Date: 2003-08-29 10:52:37


Matthias Schillinger wrote:
> declare j as thirdIndex and it should work, I think.
> See also the user guide on page 57.

Thanks a lot! It does indeed work correctly. Even though I read the docs
several times, I just misunderstood something.

However, perhaps more detail on the semantics of these magical index objects
might be worth having in the manual, since I still find it quite confusing.

The manual says:

"There is a distinct index placeholder type associated with each dimension of
an array. The types are called firstIndex, secondIndex, thirdIndex, ...,
tenthIndex, eleventhIndex."

This is fine when all your objects have the same rank. But for example, the
4d version of my code (which thanks to your comments now works correctly), reads:

// 4d version
void mat_ten_inner0(Array<double,2>& M,
                   Array<double,4>& T, Array<double,4>& U ) {
        firstIndex i1;
        secondIndex i2;
        thirdIndex i3;
        fourthIndex i4;

        fifthIndex j;

        U = sum(M(i1,j)*T(i2,i3,i4,j),j);
}

j has to be declared as a fifthIndex, even though nothing is 5-dimensional
here. And i2,i3,i4 play the role of the 2nd, 3rd and 4th dimension for U, but
one less each for T.

So exactly what the semantics of these objects is, remains a bit of a mistery
to me. I'd love to understand it, though, as they make the code an absolute
joy to write (once it works ;)

Many thanks again for your help.

Regards,

Fernando.