Fast arrays



Am Donnerstag, den 28.04.2011, 11:49 -0600 schrieb Robert Dodier:
> Well, a "fast array" as created when use_fast_arrays=true is actually
> a Lisp hash table, right? The "fast array" stuff is a replacement for
> the usual Maxima undeclared array which uses its own hashing scheme.

When use_fast_arrays=true, we can generate the following Lisp arrays:

(%i1) use_fast_arrays:true$

(%i2) array(a, fixnum, 2);
(%o2) "{Lisp Array: #(0 0 0)}"

(%i3) array(a, flonum, 2);
(%o3) "{Lisp Array: #(0.0 0.0 0.0)}"

(%i4) array(a, any, 2);
(%o4) "{Lisp Array: #(NIL NIL NIL)}"

(%i5) array(a, hashed);
(%o5) "{Lisp Array: #<HASH-TABLE :TEST EQUAL :COUNT 1 {CBCEB09}>}"

These are the arrays we can generate with MAKE_ARRAY, too. MAKE_ARRAY
knows in addition the type functional (a memoizing fast array). I have
suggested to cut out the memoizing fast array. It never worked in the
past, until I have corrected the implementation.

> I'm in favor of nuking Maxima's hashing scheme and using Lisp hash tables
> in Maxima undeclared arrays (keeping the hash table in a property,
> as it is now, not storing the hash table in the value cell).
> 
> As to the question of whether or not Lisp arrays and hash tables
> should be stored in the value cell or in a property,
> I can see advantages to doing it either way.
> I think we could have a worthwhile discussion about it.
> 
> Given the bugs in the existing implementation of fast arrays,
> we could probably nuke the existing fast array code.
> Hash tables in the value cell could come back later,
> in a non-buggy manner.

Yes, it might be a good idea to improve Maxima arrays in general. At
this time, my suggestion is to allow Lisp arrays via the function
MAKE_ARRAY and to cut out the functionality of USE_FAST_ARRAYS from the
function ARRAY. That is, we do not allow the generation of Lisp arrays
with the function ARRAY. This way we do not mix up the functionality of
Maxima arrays with Lisp arrays, which might confuse the user.

There is one point I have not looked into in detail. I do not know the
usage of "fast arrays" used by the translator.

Dieter Kaiser