
DE wrote:
looks smart and tricky but i don't see any advantages over computed indeces but only wasted spaces and time (for allocating additiona storage for pointers)
This si a trade-off. Beware that's only the allocating is slightly slower as the malloc itslef takes more time than the small loop.
at the same time dereferencing a pointer is like computing an index Look at generated assembly and you'll see what happen. At worst it's the same. At best, it replace all the idnex computation by a single LEA on INTEL. Also, it ease writing code that need to deal with multiple idnex.
Index computation with dim > 2 becomes impractical when you ned to do thign like extarcting non rectangular area or doing tile blocking. -- ___________________________________________ Joel Falcou - Assistant Professor PARALL Team - LRI - Universite Paris Sud XI Tel : (+33)1 69 15 66 35