LoÃc Grenià on Tue, 02 Apr 2013 21:59:11 +0200


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

Re: slice of matrices


2013/4/2 Bill Allombert <Bill.Allombert@math.u-bordeaux1.fr>
>
> 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 ?

    Would it be much worse to make

M[1]

  valid if M is a 1\times n or an n\times 1 matrix ?

  If you implement your idea, what about M[1..1,1..1]: t_VEC or t_COL ?

       Thanks,

              LoÃc