[GOODIE] Matrix-raok

Bert Freudenberg bert at isg.cs.uni-magdeburg.de
Mon Nov 25 11:19:09 UTC 2002


On Mon, 25 Nov 2002, Richard A. O'Keefe wrote:

> Bert Freudenberg <bert at isg.cs.uni-magdeburg.de>
> asked how my Matrix class (described by me as basically a minor cleanup
> of Array2D) compares with Croquet's Matrix class.
> 
> I couldn't even print the Croquet manual (the first page came out;
> what Acrobat Reader did with the rest I cannot imagine) and so have
> not looked at Croquet.  I can only reply based on the specific
> examples in Bert Freudenberg's message.

It's not in the manual, only in the code. Just run the Croquet image and 
fire up a browser on class Matrix.

> 
> 		"Create a new array"
> 		a := Matrix[3, 3] fill: #(1 2 3 4 5 6 7 8 9). 
> 	
> Not possible in plain Squeak syntax.

Yep, they added a neat compiler hack. It compiles to

	a := (Matrix matrixAt: 3 at: 3) fill: #(1 2 3 4 5 6 7 8 9).

which you can see by looking at the decompiled code. Having the index 
syntax makes code look so much nicer ... :-)

> For consistency with #(1 2 3) * #(4 5 6), it is important that the
> symbol for matrix multiplication should NOT be *.

Why? #* means component-wise multiplication, period. "Real" matrix 
multiplication should use something different.

-- Bert





More information about the Squeak-dev mailing list