Matrix class?
Richard A. O'Keefe
ok at atlas.otago.ac.nz
Fri May 4 00:15:34 UTC 2001
Declare matrices A, B, and C of NXN integers elements and carry out the
following operations:
i) C := A X B (store the multiplication of A and B in C)
ii) sum := summation of the C elements, column-order.
--
Array2D is rather muddled in its terminology.
It talks about width/height, row/col, and x/y.
The best that can be said for it is that it already exists.
Beware that it is
array2d at: col at: row
NOT array2d at: row at: col
Does
(1 to: c width) collect: [:col| (c atCol: col) sum]
do what you want for ii)? For i), consider the expression
((c atRow: i) * (c atCol: j)) sum
More information about the Squeak-dev
mailing list
|