[squeak-dev] representing matrix as two dimensional array in Slang

Igor Stasenko siguctua at gmail.com
Tue Sep 30 02:35:36 UTC 2008


2008/9/29 Ang Beepeng <beepeng86 at yahoo.com>:
>
> I want to create a plugin on Gaussian elimination on matrix. The examples of
> gaussian elimination in C code are mostly taking in the matrix as two
> dimensional array. How can I write it in Slang? How to represent 2
> dimensional float matrix in Slang? Are there any examples in Slang?
>
Hardware does not supports 2 dimensional arrays :)
Therefore, when you write something like:
z := array [x,y]  , compiler decomposing this code to following:

z:= singleDimentionArrayPointer[x*numCols + y]

in same way, in slang you can use a linear buffer of floats, and write
access routine which taking two indexes, but then translating them to
single index in your buffer, and voila - you have a two-dimentional
matrices :)



> Thanks for help.
> Ang Beepeng
> --
> View this message in context: http://www.nabble.com/representing-matrix-as-two-dimensional-array-in-Slang-tp19728457p19728457.html
> Sent from the Squeak - Dev mailing list archive at Nabble.com.
>

-- 
Best regards,
Igor Stasenko AKA sig.



More information about the Squeak-dev mailing list