On Thu, 4 Mar 2004 [EMAIL PROTECTED] wrote:

>       ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;                             
>    
>       ;; now populate and return the new-array
>       ;; I FEEL THAT THE PROBLEM HAS TO BE RIGHT HERE
>       ;; I've tried eliminating the APPLY and using
>       ;; ROW-MAJOR-AREF on an array displaced to ARRAY...but no help
>       (dotimes (n (array-total-size new-array) new-array)
>       (setf (aref new-array-displaced n)
>             (apply #'aref array (nth n array-indexes)))))))

Yes, that conses like hell, which will kill you.

What I did for my LambdaTensor package when I had this problem two and a 
half years ago was to write a special TENSOR-COUNT macro that did the 
iteration over a vector of indices and allows the specification of a 
side effect function that is called at every counting step with 
extra information which index changed. With this, you can operate on a 
linear array displaced to your higher-rank result array.

see the TENSOR-COUNT macro in

http://www.cip.physik.uni-muenchen.de/~tf/lambdatensor/LambdaTensor1.1.4/doc/tflib.html

[Yes, the interface design may not win a prize for its beauty, but my 
primary concern was getting usable solutions as fast as possible. And it 
turned out to be quite effective nevertheless.]

-- 
regards,               [EMAIL PROTECTED]              (o_
 Thomas Fischbacher -  http://www.cip.physik.uni-muenchen.de/~tf  //\
(lambda (n) ((lambda (p q r) (p p q r)) (lambda (g x y)           V_/_
(if (= x 0) y (g g (- x 1) (* x y)))) n 1))                  (Debian GNU)

Reply via email to