Charles Greathouse on Tue, 02 Apr 2013 15:05:22 +0200


[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

Re: slice of matrices


I like the idea of returning t_VEC and t_COL when possible.

Charles Greathouse
Analyst/Programmer
Case Western Reserve University


On Tue, Apr 2, 2013 at 4:47 AM, Bill Allombert <Bill.Allombert@math.u-bordeaux1.fr> wrote:
Dear PARI developers,

We are contemplating a minor change in the semantic of matrix slices.
Currently all matrix slices are t_MAT.

? M=[1,2,3;4,5,6]
%1 = [1,2,3;4,5,6]
? M[1,1..2]
%2 = Mat([1,2])
? M[1..2,1]
%3 = [1;4]

However in this two last cases, the user might legitimely expect that
the following holds:

    M[1,1..2] = M[1,][1..2]
    M[1..2,1] = M[,1][1..2]

Thus it should be:

? M[1,1..2]
%3 = [1,2]
? M[1..2,1]
%2 = [1,4]~

(i.e t_VEC/t_COL and not t_MAT).

Of course
M[1..1,1..2] and M[1..2,1..1] would still return a t_MAT.

Opinions ?

Cheers,
Bill.