Karim BELABAS on Fri, 19 Mar 1999 14:02:26 +0100 (MET)


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

Re: (no subject)


[Florian Lengyel:]
> My problem concerns a portion of a simple script (attached) that runs
> under two versions of UNIX (on a Sun Workstation Sparc 5) and under
> DEC-OSF 3.2D on an (oldish) Alpha 1000. There is no problem with the
> script under UNIX. Under DOS, however, the appears not to be converting
> vectors to strings correctly.
> 
> 
> Generate subgroups of index 2 in Z2(+) ... (+) Z2

You could produce them in a simpler way:

   subgrouplist(vector(N,i,2), 2)

[this function is not very efficient, but I'll comment on that in a separate
message]

The script would look nicer if you removed the '\' in your multi-line
expression, and enclosed the whole of it between braces ( {  } )

Also the triple loop:

> for ( i = 1,14, \
>    for ( j = i+1, 14, \
>       for (k = j+1, 14,\

can be conveniently (and more efficiently) written:

forvec(v=vector(3,i,[1,14]), 
  i = v[1]; j = v[2]; k = v[3];
  ...
, 2)

> /* The debugging output lines are for the pari-dev list.
>    Note the difference between SetOfSubgroups under DOS, where it
>    evaluates to the strange set ["["] and SetOfSubgroups under UNIX,
>    where SetOfSubgroups contains 8 groups, each one a set containing
>    a quoted set of quoted mod 2 bitvectors.
> */

Hum, I haven't tried your script on a DOS box (during the week end if I have
time) but, offhand, I can't see them being treated differently on this
architecture (e.g. shell quoting shouldn't apply). This is weird.

However, recursive stringification is not really cleverly handled. A string
is evaluated simply by sending it to the parser, so you'll end up with valid
objects (internal structure is OK) which can't be evaluated...

(13:44) gp > Set([Set([["a"]])])
%1 = ["["["a"]"]"]
(13:44) gp > eval(%)
  ***   ; or ] expected: ["["a"]"]

So, I would evaluate a group before stringifying it, so as to always have a
single level of embedded strings (besides, operations will be slightly more
efficient).

Karim.
--
Karim Belabas                    email: Karim.Belabas@math.u-psud.fr
Dep. de Mathematiques, Bat. 425
Universite Paris-Sud             Tel: (00 33) 1 69 15 57 48
F-91405 Orsay (France)           Fax: (00 33) 1 69 15 60 19
--
PARI/GP Home Page: http://hasse.mathematik.tu-muenchen.de/ntsw/pari/