Re: F2CL ODEPACK problems.

Raymond Toy <[email protected]> Wed, 18 Aug 2004 08:13:50 -0400
Newsgroups gmane.lisp.clocc.general
Message-ID <[email protected]>
>>>>> "Raymond" == Raymond Toy <[email protected]> writes:

    Raymond> Marco Antoniotti wrote:
    >> How should I declare the CL array?
    >> X(8, 10) ==> (make-array (* 8 10) ....)
    >> 

    Raymond> Yes, that's right.  All multi-dimensional arrays are 1D arrays with
    Raymond> the same number of elements.

    >> ?
    >> Also, FREF seems quite strange to me.  I tried the following
    >> (defvar arr (make-array (* 8 10) ....)) ;; filled in from 0 to 79.
    >> (f2cl-lib:fref arr (-9 11) ((1 8) (1 10))) ==> 70
    >> What is the meaning of this?

    Raymond> Macroexpand is your friend.  But basically you are trying to access
    Raymond> element arr(-9, 11) which is strictly illegal since the first index is
    Raymond> supposed to be 1 to 8 and the second index is 1 to 10.

    Raymond> (I think there's a variable you can set that will check array bounds.)

    Raymond> But what happens is the real index is computed as (-9 + 1) + 8*(11 -
    Raymond> 1) = 70, so you got element 70 from arr.

No, this is totally wrong.  It should be (-9 - 1) + 8*(11 - 1) = 70.

Ray



-------------------------------------------------------
SF.Net email is sponsored by Shop4tech.com-Lowest price on Blank Media
100pk Sonic DVD-R 4x for only $29 -100pk Sonic DVD+R for only $33
Save 50% off Retail on Ink & Toner - Free Shipping and Free Gift.
http://www.shop4tech.com/z/Inkjet_Cartridges/9_108_r285