Matrix class?

Richard A. O'Keefe ok at atlas.otago.ac.nz
Thu May 3 04:03:40 UTC 2001


Jeff Shipman <shippy at nmt.edu> wrote:
	Is there a Matrix class available in Squeak? If
	so, where is it in the browser? Thanks.
	
Did you look under "Collections-Arrayed"?

The Array2D class comment says

    Neither storing nor storing (otherwise inherited from ArrayedCollections)
    will work.  Neither comparing nor most accessing methods inherited from
    SequenceableCollection will work.  Actually, it's been a bad idea to
    inherit this class from Collection at all.
    
(This should say "for this class to inherit from Collection", of course.)

There's not actually a lot in that class.  It might be fun for you to
list the full protocol of the class, strip out the methods inherited from
Object, and figure out which other ancestral methods actually work, then
submit a new version that _doesn't_ inherit from Collection.

According to Cmd-N, "There are no Users of Array2D" in the 3.0 base image.

You might find the following method useful.

    Array2D class>>
    width: width height: height from: aCollection
	"Create an Array2D with width places in the first dimension
	 and height places in the second dimension, with initial
	 contents drawn from aCollection"
	^(self width: width height: height) setContents: aCollection copy

Or you might not.

Array2D _does_ have methods like #+ defined on it, but they don't work.
So I guess it doesn't count as a Matrix.






More information about the Squeak-dev mailing list