Fast Array Addition
BlitzPlus Forums/BlitzPlus Programming/Fast Array Addition
| ||
Hi folks. I used to know of a very quick method of incrementing each value in an array without using a loop. Has anyone got this code? example (old way)..... Dim Alien(1000,2) for a = 1 to 1000 Alien(a,1)=Alien(a,1)+1 Alien(a,2)=Alien(a,2)+1 next Any help would be great. Thanks. |
| ||
Forget the post above. I've sorted it. |
| ||
er...What was your 'very quick method of incrementing each value in an array without using a loop'? |
| ||
Sorry, it doesn't :/ Just tried it and it doesn't work in Blitz because you cannot use an array by just using its brackets. It used to work in fortran (and probably other languages) where you could say.... a[]=a[]+1 and that would increment each element by 1. I think the only way to do it in Blitz is to copy a block of memory onto another block of memory using a mask. I'm working on it.... |
| ||
What's wrong with using a loop? I'm not sure that you can find a faster way... |