Re: Bizarre semantic of Mat

Loïc Grenié <[email protected]> Wed, 17 Jan 2024 11:43:02 +0100
Newsgroups gmane.comp.mathematics.pari.devel
Message-ID <CAMLkfFTyZkWDW9kd76j0PV8t9Xp+kM-aiPg27-63R9DpoNyiRA@mail.gmail.com>
On Wed Jan 17th, 2024, at 11:31, Bill wrote:

> On Tue, Jan 16, 2024 at 06:36:52PM -0800, Ilya Zakharevich wrote:
> > Today I (finally) looked through the documentation of Mat() — and it
> > seems to be very convenient for interactive usage!  On the other hand,
> > such “cute” semantics have a tendency to become a limiting factor when
> > one wants to write down general-purpose algorithms…
> >
> > Is there a simple way to convert a vector-column into a 1 column
> > matrix (without using matrix())?  Mat() is almost there — except for
> > bizarre special-cases — which are impossible to switch off!
>
> There is a trick:
>
> ? V=[[1]~,[2]~,[3]~]
> %28 = [[1]~,[2]~,[3]~]
> ? Mat(V~)~
> %29 = Mat([[1]~,[2]~,[3]~])
> ? V=[[1],[2],[3]]~
> %30 = [[1],[2],[3]]~
> ? Mat(V~)~
> %31 = [[1];[2];[3]]
>

? V=[[1]~,[2]~,[3]~]
%28 = [[1]~,[2]~,[3]~]
? Mat(concat(V))
%29 =
[1]

[2]

[3]

     Loïc