"Stephen R. Riese" wrote:
> I then found, unfortunately, that MapBasic cannot handle multi-dimensional
> arrays. So much for inverting a matrix.
Implementing multi-dimensional arrays with one-dimensional arrays
isn't that tough. You could even hide the gnarly bits by using
function calls (but that would slow down an already slow
language.)
dim m, n, mLimit, nLimit as integer
dim a() as float
'define a 2x3 matirx
mLimit = 2
nLimit = 3
redim a(mLimit*nLimit)
'populate index m,n is defined by a((m-1)*nLimit + n)
' | 2 6 3 |
' | 4 7 2 |
m = 1 n = 1
a((m-1) * nLimit + n) = 2
m = 1 n = 2
a((m-1) * nLimit + n) = 6
m = 1 n = 3
a((m-1) * nLimit + n) = 3
m = 2 n = 1
a((m-1) * nLimit + n) = 4
m = 2 n = 2
a((m-1) * nLimit + n) = 7
m = 2 n = 3
a((m-1) * nLimit + n) = 2
'Retreive element a(2, 2), (should be 7)
m = 2 n = 2
print a((m-1) * nLimit + n)
...and so on.
- Bill Thoen
----------------------------------------------------------------------
To unsubscribe from this list, send e-mail to [EMAIL PROTECTED] and put
"unsubscribe MAPINFO-L" in the message body, or contact [EMAIL PROTECTED]