Karim Belabas on Wed, 29 Mar 2006 18:25:39 +0200


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

Re: matrix and reference copies


* ramare [2006-03-29 16:53]:
> This one doesn't::
> {
> matDelta(n, r)=
>   local(mymat = matrix(r-1,r-1), too, j, res, s);
>   for(j = 1, r-1,
>      for(t = 1, r-1,
>         if(j <= t, res = 1, res = 0);
>         print(mymat);
>         for(s = t+1, r, res += 2^s);
>         print(res,"/",mymat[j, t],":",j,"-",t);
>         mymat[j, t] = res;));
>   return(mymat)
> }
> In C, I guess the pointer corresponding to the entries of
> matrix(r-1,r-1) haven't been initialized separately (same 0 is used
> in each line).In the first case, they are.

This is now fixed in CVS.

The reason was essentially the one you guessed escape that _columns_ were
shared, not individual entries [ and involved special (weaker, faster)
assignment rules enforced within 'local' ].

Thanks for your report !

    K.B.

P.S: Please use our Bug Tracking System to report bugs. This way they are
all archived together, and easier to refer to, e.g. current CHANGES has

     37- divisors([]) --> SEGV [#441]

(one can then look up Bug 441 in the BTS), whereas it is more difficult to
refer to your current report. See

  http://pari.math.u-bordeaux.fr/Bugs/

An interesting feature: you can report a 'bug' with severity "wishlist",
so that a proposed feature you care about is officially recorded somewhere.
[ The mailing lists are still the proper place to propose and discuss them
of course. ]

-- 
Karim Belabas                  Tel: (+33) (0)5 40 00 26 17
Universite Bordeaux 1          Fax: (+33) (0)5 40 00 69 50
351, cours de la Liberation    http://www.math.u-bordeaux.fr/~belabas/
F-33405 Talence (France)       http://pari.math.u-bordeaux.fr/  [PARI/GP]