Hi folks,

as Paul Brannan says:

""" (if you need further convincing, consider the performance implications

of constructing a new matrix just to change a single cell).
"""

That's the point!

The only way of 'changing' a matrix now (I checked the Matrix class
description
in Ruby in a Nutshell) is with class methods (creation) or with
map/collect,
wich is obviously  inneficient (e.g., one has a 100x100
matrix and wants to modify a single element, somewhere... and can only
trick with map/collect or create a new modified copy row by row?)

I use a lot of matrix stuff in my work: I teach/research  electronic
circuit
test and simulation algorithms. Matrices and other data structures
are 'bread and butter' of the business...

The Ruby matrix class overloaded
operators are OK (but for slowness, due to being implemented
in Ruby, not in C). In fact, it would be nice  that the Matrix class was
brought to the Ruby core, with methods implemented in C.

The Python community is pushing hard to show Python
 can be a very good option to teaching programming to students.
One of the obvious application of Prog. Langs. at basic level is in Math.
The matrix class allows for playing easily with linear systems, for
instance.
Why not turn the Matrix Class into a full featured data Structure
such as Array and Hash? It would be an extra advantage over Perl
and Python core capabilities...


J. Augusto



Paul Brannan wrote:

> On Sun, Mar 03, 2002 at 12:11:13AM +0900, Yukihiro Matsumoto wrote:
> > I asked Keiju, who has been my friend for long time, and he replied
> > that that's because he wanted matrix to be immutable just like other
> > numeric values.
>
> Hmm, I see a matrix as more of a two-dimensional array with arithmetic
> operators redefined for matrix operations.
>
> If an array is mutable, a matrix should be mutable, too.
>
> (if you need further convincing, consider the performance implications
> of constructing a new matrix just to change a single cell).
>
> Paul