Spin Arrays
mynet43
Posts: 644
Is there a way to declare a two dimensional array in SPIN?
I want to do some matrix arithmetic and this would make it easier.
I couldn't find anything in the manual.
The obvious: long phi doesn't seem to work.
Is there a way to do this or do I have to declare it single dimensioned and then play with the index?
Thanks for your help.
Jim
I want to do some matrix arithmetic and this would make it easier.
I couldn't find anything in the manual.
The obvious: long phi doesn't seem to work.
Is there a way to do this or do I have to declare it single dimensioned and then play with the index?
Thanks for your help.
Jim
Comments
The indexing method is more time/space efficient though, at the cost of code complexity.
- brute force multiplication pos = x*ysize +y (or y*xsize+x - you have the choice)
- intermediate addressvector (preset: arr[noparse][[/noparse]x]:= @arrspace*x*ysize
- sparse matrices using bitvectors, well above this thread I guess...
Alas, there is no such thing as this practical denotation "arr[noparse]/noparse]x][noparse][[/noparse]y]", you have to use something like LONG[noparse][[/noparse]arr[noparse][[/noparse]x[noparse][[/noparse]y]
And don't get confused with longs, words, or bytes...
Note that the LONG I use has nothing to do with the sizing of the "arr" address vector (which could be WORDs as well), but with the size of your element in "arrspace"
I know how to do it, it's just a little trickier to debug.
Jim