On 29 October 2015 at 05:17, Ralf Hemmecke <[email protected]> wrote:
> (7) -> PRETTYPRINT(r)$Lisp
> #(2.0 3.0 17)
> it looks as if a record is internally stored as a lisp vector, no?
No not quite. That is a literal vector in Lisp. But you are right
that this is the actual internal representation of something of type
Record. E.g.
(1) -> VECTOR(1.0::DF,2.0::DF,3)$Lisp pretend Record(a:DF,b:DF,c:Integer)
(1) [a= 1.0,b= 2.0,c= 3]
Type: Record(a: DoubleFloat,b: DoubleFloat,c: Integer)
>
> Concerning (from Alasdair's gsl.lisp)
>
> ; Return multiple values as a list
> (defun integration-qng-list (f a b epsabs epsrel)
> (multiple-value-list (integration-qng f a b epsabs epsrel)))
>
> Maybe it would be easiest for Alasdair to turn the lisp value (that is
> returned from the GSL function integration-png) into such an array.
> I.e. instead of multiple-value-list he should call a function to produce
> the array/record. (Sorry, no idea what that function is.)
>
Of course. Waldek did suggest where to look in the source code for
this, but it is certainly not the easiest option.
> In the .spad file instead of
>
> r:List
> DF:=INTEGRATION_-QNG_-LIST(mkLispFunction1(f@(DF->DF))$Lisp,a,b,epsabs,epsrel)$Lisp
> [r(1),r(2),r(3) pretend Integer]
>
> there would then simply by
>
> R ==> Record(result:DF, abserr:DF, neval:Integer)
> r: R :=
> NTEGRATION_-QNG_-LIST(mkLispFunction1(f@(DF->DF))$Lisp,a,b,epsabs,epsrel)$Lisp
>
Instead of speculating perhaps you should try it first? :)
>> Error detected within library code:
Bug: ridiculous record representation
But you had the right idea. This works:
; gsl.lisp
...
; Return multiple values as a vector (can be interpreted as Axiom Record)
(defun integration-qng-vector (f a b)
(apply #'vector (multiple-value-list (integration-qng f a b))))
-- gsl.spad:
...
gslIntegrationQng: (DF -> DF,DF,DF) -> Record(result:DF, abserr:DF,
neval:Integer)
...
gslIntegrationQng(f,a,b) ==
INTEGRATION_-QNG_-VECTOR(mkLispFunction1(f@(DF->DF))$Lisp,a,b)$Lisp
Bill Page
--
You received this message because you are subscribed to the Google Groups
"FriCAS - computer algebra system" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/fricas-devel.
For more options, visit https://groups.google.com/d/optout.