[gsll-devel] GSL2 switch bug?

Name Name byaakaa at gmail.com
Wed Aug 23 08:58:09 UTC 2017


Hi,

Well, the code says otherwise:

#-gsl2
(defun jacobian (solver)
  ;; Raw pointer, because we presume we're passing it on to another GSL
function.
  (cffi:foreign-slot-value (mpointer solver) '(:struct gsl-fdffit-solver)
'jacobian))

;;; This needs work to make matrix automatically allocated.
#+gsl2
(defmfun jacobian (solver matrix)
  "gsl_multifit_fdfsolver_jac"
  (((mpointer solver) :pointer) ((mpointer matrix) :pointer))
  :return (matrix)
  :documentation
  "The Jacobian matrix for the current iteration of the solver.")

This says that "jacobian" has two arguments when #+gsl2.

(defmfun ls-covariance
    (solver relative-error &optional covariance
   &aux (cov (or covariance
 (grid:make-foreign-array 'double-float
      :dimensions
      (list (dim1 solver) (dim1 solver))))))
  "gsl_multifit_covar"

  (((jacobian solver) :pointer) (relative-error :double) ((mpointer cov)
:pointer))

  ...)

This calls "jacobian" with one argument: "(jacobian solver)".

I can't see how a compiler can be fine with this unless it's set up to be
quite relaxed.
Alternatively, I might be reading the code wrong.

Cheers,
Gaya



On Wed, Aug 23, 2017 at 3:02 AM, Liam Healy <lhealy at common-lisp.net> wrote:

> I have been on v2 for a while now and have not encountered problems.
>
> Liam
>
> On Mon, Aug 21, 2017 at 1:45 AM, Name Name <byaakaa at gmail.com> wrote:
> > Hi,
> >
> > I guess that you have not encountered a problem because you have GSL v.1.
> > This happens on v.2.
> >
> > Thanks for your reply.
> > Gaya
> >
> > On Aug 20, 2017 5:28 AM, "Liam Healy" <lhealy at common-lisp.net> wrote:
> >>
> >> Thanks for the report. You are right that the interface is wrong, but
> >> oddly I have not encountered a problem. I'm not sure what the second
> >> argument should be and unfortunately I haven't had the time to dig into
> it.
> >> I will push a fix when I've figured it out.
> >>
> >>
> >> Liam
> >>
> >> On Wed, Aug 9, 2017 at 11:51 AM, Name Name <byaakaa at gmail.com> wrote:
> >>>
> >>> Hi there,
> >>>
> >>> I'm trying to compile the latest version of GSLL (last commit on master
> >>> branch dd2e7673) and have a compilation error saying that function
> >>> "jacobian" is called with one argument whereas it wants exactly two. It
> >>> happens on the following line:
> >>>
> >>>
> >>> https://gitlab.common-lisp.net/antik/gsll/blob/master/
> solve-minimize-fit/nonlinear-least-squares.lisp#L262
> >>>
> >>> and the compiler has the right to complain as with my GSL2 version the
> >>> signature of the function indeed wants two arguments:
> >>>
> >>>
> >>> https://gitlab.common-lisp.net/antik/gsll/blob/master/
> solve-minimize-fit/nonlinear-least-squares.lisp#L150
> >>>
> >>> This seems like an easy to fix bug but I have no idea about the
> internals
> >>> of this library.
> >>> Could somebody help out?
> >>> For now I just exchanged the call (on line L262) of
> >>>
> >>> "(jacobian solver)"
> >>>
> >>> to
> >>>
> >>> "(jacobian solver cov)"
> >>>
> >>> to have some matrix in there but I don't think that this is the right
> >>> solution.
> >>>
> >>> Thanks in advance!
> >>> Gaya
> >>>
> >>
> >>
> >
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.common-lisp.net/pipermail/gsll-devel/attachments/20170823/57f1b894/attachment.html>


More information about the gsll-devel mailing list