Re: Bizarre semantic of Mat
Loïc Grenié <[email protected]> Thu, 18 Jan 2024 09:40:00 +0100
| Newsgroups | gmane.comp.mathematics.pari.devel |
|---|---|
| Message-ID | <CAMLkfFSetcqzoCghgQDqkFxUe5yhLNhawxQYXdguMcNvTuc9Kg@mail.gmail.com> |
On Thu Jan 18th, 2024, at 08:19, Ilya Zakharevich wrote:
> On Wed, Jan 17, 2024 at 11:31:39AM +0100, Bill Allombert wrote:
> > > 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]~])
>
> Hmm? It seems that this is “another ‘cute special case’” — which
> requires PRIOR KNOWLEDGE about the nature of elements of the vector.
> Does not it?
>
I don't know what you intend to do. However if you have a column
C the content of which is unknown, then you have two reasonable ways
to transform it in a #C\times1 matrix:
matrix(#C,1,a,b,C[b])
Mat(vector(1,a,C))
You don't want the first and you name the second ugly, that's your
call. Just don't expect the developers of pari/gp to write the function
you wish.
Observe that the condition "I don't know what is in my column vector
but I want a column-matrix out of it" is not the typical situation;
usually
one *knows* what is in the column (and can decide what to do). Observe
also that the first solution is completely reasonable, documented. I think
you are wasting time and bandwidth on this one.
Loïc