The patch below should fix this. Here are some remarks.
1) Note that $FILLARRAY won't care about the type of an array, i.e. it
will happily fill a maxima array of, say, type FLOAT with FIXNUMs.
(C1) array(xxx,float,2,3);
(D1) xxx
(C2) array(yyy,fixnum,1,1);
(D2) yyy
(C3) :lisp(symbol-plist '|$xxx|)
(ARRAY-MODE $FLOAT MPROPS (NIL ARRAY $xxx) ARRAY
#2A((0.0 0.0 0.0 0.0) (0.0 0.0 0.0 0.0) (0.0 0.0 0.0 0.0)))
(C3) :lisp(symbol-plist '|$yyy|)
(ARRAY-MODE $FIXNUM MPROPS (NIL ARRAY $yyy) ARRAY #2A((0 0) (0 0)))
(C3) fillarray(xxx,yyy);
(D3) xxx
(C4) :lisp(symbol-plist '|$xxx|)
(ARRAY-MODE $FLOAT MPROPS (NIL ARRAY $xxx) ARRAY
#2A((0 0 0 0) (0 0 0 0) (0 0 0 0)))
(C4)
Since I haven't investigated the implications of such an array type
declaration in maxima I just don't know if it is supposed to do
anything special in this case.
2) $FILLARRAY essentially just calls FILLARRAY (in clmacs), which
means that it shares its limitation to a maximum of 3 dimensions for
the array to be filled. Eventually, it might be better to get rid of
any such hard-coded limitation but, meanwhile, the second patch below
takes the limit to the officially supported 5 dimensions (cf. the
description of ARRAY in the info documentation).
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ cut ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Index: marray.lisp
===================================================================
RCS file: /cvsroot/maxima/maxima/src/marray.lisp,v
retrieving revision 1.2
diff -C2 -r1.2 marray.lisp
*** marray.lisp 24 Feb 2001 02:21:59 -0000 1.2
--- marray.lisp 5 Jul 2002 16:22:35 -0000
***************
*** 15,18 ****
--- 15,35 ----
;;; Macsyma User array utilities originally due to CFFK.
+ ;;; Note that on the lisp level we regard as an array either
+ ;;; (1) a symbol whose ARRAY property is a common lisp array
+ ;;; [i.e., (symbol-array 'symbol)
+ ;;; == (get 'symbol 'array) => some array] or
+ ;;; (2) a common lisp array.
+ ;;; On the maxima level a declared array not of type HASH or FUNCTIONAL
+ ;;; is either
+ ;;; (1m) a symbol whose ARRAY mproperty is of type (1)
+ ;;; [i.e., (symbol-array (mget 'symbol 'array)) => some array] or
+ ;;; (2m) it is of type (2) (and then called a `fast' array).
+ ;;; Such an array is of type (1m) iff it was created with ARRAY
+ ;;; with USE_FAST_ARRAYS being set to FALSE.
+ ;;;
+ ;;; Curiously enough, ARRAY(...,TYPE,...) (which currently can only be
+ ;;; used for USE_FAST_ARRAYS:FALSE) results in an array which is
+ ;;; simultaneously of type (1) and (1m).
+
(defun $listarray (ary)
(Cons '(mlist)
***************
*** 40,47 ****
(and (arrayp ary1) ary1)
(merror "First argument to FILLARRAY must be a declared array:~%~M" ary1))))
! (replace
ary
(cond (($listp ary2) (cdr ary2))
! ((mget ary2 'array))
#+cl
((arrayp ary2) ary2)
--- 57,64 ----
(and (arrayp ary1) ary1)
(merror "First argument to FILLARRAY must be a declared array:~%~M" ary1))))
! (fillarray
ary
(cond (($listp ary2) (cdr ary2))
! ((get (mget ary2 'array) 'array))
#+cl
((arrayp ary2) ary2)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ cut ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Index: clmacs.lisp
===================================================================
RCS file: /cvsroot/maxima/maxima/src/clmacs.lisp,v
retrieving revision 1.5
diff -C2 -r1.5 clmacs.lisp
*** clmacs.lisp 6 May 2001 18:27:49 -0000 1.5
--- clmacs.lisp 5 Jul 2002 16:22:58 -0000
***************
*** 368,373 ****
(defvar *acursor* nil)
(defun set-up-cursor (ar)
! (or *acursor* (setf *acursor* (make-array 10 :element-type 'fixnum
:initial-element 0)))
(let ((lis (array-dimensions ar)))
--- 368,378 ----
(defvar *acursor* nil)
+ ;; Format of *acursor*.
+ ;; 0 1 2 3 4 5 6 7 8 9 10
+ ;; dim i1 i2 i3 i4 i5 d1 d2 d3 d4 d5
+ ;; array dimension current index maximal index
+
(defun set-up-cursor (ar)
! (or *acursor* (setf *acursor* (make-array 11 :element-type 'fixnum
:initial-element 0)))
(let ((lis (array-dimensions ar)))
***************
*** 382,386 ****
(1 (setf (aref ar (aref curs 1)) val))
(2 (setf (aref ar (aref curs 1) (aref curs 2)) val))
! (3 (setf (aref ar (aref curs 1) (aref curs 2) (aref curs 3)) val)))
(sloop for j downfrom (aref curs 0)
do (cond ((< (aref curs j) (aref curs (f+ 5 j)))
--- 387,396 ----
(1 (setf (aref ar (aref curs 1)) val))
(2 (setf (aref ar (aref curs 1) (aref curs 2)) val))
! (3 (setf (aref ar (aref curs 1) (aref curs 2) (aref curs 3)) val))
! (4 (setf (aref ar (aref curs 1) (aref curs 2) (aref curs 3)
! (aref curs 4)) val))
! (5 (setf (aref ar (aref curs 1) (aref curs 2) (aref curs 3)
! (aref curs 4) (aref curs 5)) val)))
! ;; set the index (`cursor') for the next call to ASET-BY-CURSOR
(sloop for j downfrom (aref curs 0)
do (cond ((< (aref curs j) (aref curs (f+ 5 j)))
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ cut ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Wolfgang
--
wjenkner@inode.at