Karim Belabas on Sun, 10 Mar 2024 13:36:49 +0100


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

Re: Vecsize?


Hi John,

* John Cremona [2024-03-10 13:03]:
> Libpari has a function matsize which gives the pair [nrows,ncols] of a
> matrix but I could not find a similar vecsize for vectors. This is for use
> in a C program, I know that you can use # in GP. My solution is to use
> matsize anyway and ignore one of the numbers it gives (which is 1).

lg(M) - 1

cf subsection 4.5.14 (in section 4.5 Implementation of the PARI types)

> I also could not find a function which would create an nxn matrix of
> integers, ready to be filled with C ints in a double loop, but creating a
> zero matrix of the right size works ok.

zero_Flm_copy()

> I spent a long time searching
> through the manual, where the relevant information and functions are very
> scattered (and with few examples).

General information is given in chapter 4 and 5, more detailed information in
chapter 6 and following. Chapger 6 is for integers and reals, chapter 7
is for low level functions operating on more general containers
(polynomials, vectors, matrices)  grouped according to the kind of objects
they take as input or produce [ read "7.1 Naming scheme" for details ]
The rest is for more specialized topics.

If you read 7.1, you should come to the conclusion that you want a "zm" 
function; these are described in 7.5.4. And zero_zm() is not hard to find
there. Unfortunately, it's not what you want: the zero_zm() description says
it's the same as zero_Flm() which won't work for you (if you modify
one column, you modify them all). The next function is zero_Flm_copy(),
which will work.

But the short answer is: this function you are looking for does not
exist, it's not needed anywhere in libpari. You probably don't need it
either !

Please provide more details about what exactly you what to achieve.
As usual for libpari: the true documentation is the source code
(and all examples are here :-).

Cheers,

    K.B.
-- 
Pr. Karim Belabas, U. Bordeaux, Vice-président en charge du Numérique
Institut de Mathématiques de Bordeaux UMR 5251 - (+33) 05 40 00 29 77
http://www.math.u-bordeaux.fr/~kbelabas/