Ilya Zakharevich on Sun, 05 May 2024 02:40:45 +0200


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

Yet another type of Huge arrays in gp/PARI


On Sat, May 04, 2024 at 05:30:05PM -0700, Ilya Zakharevich wrote:
> IIRC, initially, when the bit operations were added to PARI (maybe
> even by myself), the purpose was to have cheap huge arrays.

In fact, the proposal above might be considered as a stopgap measure
before a more logical approach is implemented:

  In addition to Vecsmall() (or as subtypes), add 2–4 new (sub)types:

     In what follows, Vecsmall() is considered as a bitmap
     (possibly/optionally modified by the GEN⸣s sign bit to allow
     infinitely many 1⸣s at end).

     I’m almost sure that similar constructs are already used by PARI
     internally, without exposing the UI as public functions.

 • Allow v[n] access the n⸣th group of W bits (with W specified at
   creation time).  Moreover, v[n] should be an lvalue.

   [This may be optimized (or limited in the initial implementation)
   to bitsize which is a multiple or a factor of bitness.]

 • (Optional) Allow the value formed by this n⸣th group to be
   considered as an unsigned integer.  (This probably should be the
   default if W=1…)

 • (Optional) Consider this value mod B (here the base B should be
   specified at the creation time). 

Hope this helps,
Ilya