[PYTHON MATRIX-SIG] Let's get going

James Hugunin jjh@mama-bear.lcs.mit.edu
Wed, 13 Sep 95 17:01:31 -0400


I've got to run to a meeting, but I wanted to reply to your points.

I'm not at all sure that we disagree on the implementation of slices.  Let  
me ask two simple questions.  Let's say A is a slice taken from a matrix,  
and B is a contiguous matrix.

1) Should I be able to say C = A+B, and have the obvious thing happen  
(assuming that dimensions line up, etc.)?

I'd say yes, and I have a few performance optimizations to make this fast  
in certain cases and nobody needs to worry about those.


2) Should I be able to say fft(A) where fft is an in-place FFT routine?   
Should it be expected to modify the memory referred to by A, or only to  
return a brand-new matrix which corresponds to the fft of A?

I'm not sure what the right answer to this one is.


> > > Hm. Does this operate in-place or return a value?
> >
> > In-place.  In fact, I am tempted to try and make all of the methods on  
> > matrices operate "in-place" in order to be in line with list objects.
>
> I'm not sure what you mean by this.  Surely, you aren't trying to
> make:
>
>    m=[[1,2,3],[4,5,6],[7,8,9]]
>    b=[11,22,33]
>    m=[1]=b
>    b[1]=99
>
> cause m[1][1] to equal 99? Are you?

Not at all!  All I meant by this is that methods on list objects (like  
insert or append) actually change the list object that they are operating  
on, whereas operations like concatenation return a new object.  In that  
vein, I feel that m.byteswap() should operate in-place on m and cause the  
memory associated with m to be byte-swapped.  This is as opposed to having  
it return a new matrix in with the same dimensions as m, but with all values  
byte-swapped.

=================
MATRIX-SIG  - SIG on Matrix Math for Python

send messages to: matrix-sig@python.org
administrivia to: matrix-sig-request@python.org
=================