1. 21 Mar, 2009 2 commits
    • Liam Healy's avatar
      Dynamic callbacks for minimization-multi · 214d5642
      Liam Healy authored
      Argument 'scalarsp added at end of optional arguments to mobject
      maker; it is then passed to reinitialize-instance.  Even though it is
      not specified as an argument there, it is accepted to set the slot of
      that name.  Ported minimization-multi to dynamic callbacks; examples
      all work.  Linear least squares re-enabled in gsll.asd; no changes.
      214d5642
    • Liam Healy's avatar
      Use (parse-callback-static callbacks 'foreign-argument) · 43b04588
      Liam Healy authored
      Use (parse-callback-static callbacks 'foreign-argument) instead of the
      fixed symbol +callback-argument-name+, which has been removed.
      New definition for tests for numerical-differentiation and
      numerical-integration using CL function names directly.  Callback
      tests ported so far pass.
      NUMERICAL-INTEGRATION: 3 assertions passed, 0 failed.
      NUMERICAL-DIFFERENTIATION: 18 assertions passed, 0 failed.
      MONTE-CARLO: 3 assertions passed, 0 failed.
      ROOTS-ONE: 6 assertions passed, 0 failed.
      MINIMIZATION-ONE: 2 assertions passed, 0 failed.
      ROOTS-MULTI: 8 assertions passed, 0 failed.
      43b04588
  2. 20 Mar, 2009 3 commits
    • Liam Healy's avatar
      Fixed arguments to linear least squares functions · e4a26746
      Liam Healy authored
      In both linear-mfit-nosvd and linear-mfit-svd, the arguments
      were in the wrong order, and the there was no #'mpointer call for
      covariance.  There was a 'tolerance argument in the C arglist for
      non-svd function, which should not have been there.  Also, 'weight
      needed to be declared as an input.  This last was the cause of two
      test failures in non-native implementations.  Now
      CCL64: TOTAL: 1454 assertions passed, 2 failed, 0 execution errors.
      SBCL64:TOTAL: 1451 assertions passed, 5 failed, 0 execution errors.
      e4a26746
    • Liam Healy's avatar
      Extend #'copy to copy to or from mpointers · efa2315f
      Liam Healy authored
      Both copy-to-array and copy-making-destination have been extended so
      that an mpointer can occur as the first or second argument.  If the
      first argument, the second argument should be a symbol representing a
      subclass of marray.  If the second argument is not present
      (copy-making-destination), 'vector-double-float is assumed.  If the
      mpointer is the second argument, the marray contents are copied into
      its contents.  These methods are useful for callbacks and GSL
      functions that send raw mpointers.  For example, a callback that uses
      foreign arrays directly can simply copy from and to them.  This has
      been applied in the solve-minimize-fit functions that return a raw
      mpointer, replacing the explicit call to make-marray.  The first
      argument to #'marray can now be either the class name or element-type.
      efa2315f
    • Liam Healy's avatar
      Dynamic callback for roots-multi · 2153dd13
      Liam Healy authored
      Specifications of dimensions with correct depth in
      #'select-dynamic-values.  Add the set1 argument for the function in
      multi-dimensional-root-solver-f.  Fixed Jacobian for
      multi-dimensional-root-solver-fdf; it is square, there is no dim0,
      only dim1.  Added scalarsp argument to
      multi-dimensional-root-solver-fdf maker.  All roots-multi tests pass.
      ROOTS-MULTI: 8 assertions passed, 0 failed.
      2153dd13
  3. 19 Mar, 2009 1 commit
    • Liam Healy's avatar
      Add 'scalarsp, eliminate 'callback-dynamic from callback-included · 88076763
      Liam Healy authored
      Add the slot 'scalarsp and eliminate the slot 'callback-dynamic from
      the class callback-included, and modify the defmobject uses
      accordingly.  All dynamic quantities (function, scalarsp, dimensions)
      will be set from slot values at run time.  This works for the objects
      ported so far:
       (lisp-unit:run-tests chebyshev)
       CHEBYSHEV: 1 assertions passed, 0 failed.
       (lisp-unit:run-tests roots-one)
       ROOTS-ONE: 6 assertions passed, 0 failed.
       (lisp-unit:run-tests minimization-one)
       MINIMIZATION-ONE: 2 assertions passed, 0 failed.
      Started working on roots-multi; it now compiles but does not run.
      88076763
  4. 17 Mar, 2009 1 commit
    • Liam Healy's avatar
      Map marrayp, roots-one and minimization-one work · 2a96cfe3
      Liam Healy authored
      The array-type as given in the callback-argspec is either :cvector or
      :marray.  The functions list-to-arrays and list-to-array expect
      argument 'marrayps or 'marrayp which are T or NIL.  That means I need
      to map the 'marrays argument in #'call-maybe-scalar which is :marray
      or :cvector to T/NIL.  Wrote function #'marrayp to do this.
      Example in one-dimensional-root-solver-fdf
      (roots-one-example-derivative +newton-fdfsolver+ nil)
      now works; in fact all roots-one tests pass:
      (lisp-unit:run-tests roots-one)
      ROOTS-ONE: 6 assertions passed, 0 failed.
      Ported minimization-one, tests pass:
      (lisp-unit:run-tests minimization-one)
      MINIMIZATION-ONE: 2 assertions passed, 0 failed.
      2a96cfe3
  5. 15 Mar, 2009 1 commit
    • Liam Healy's avatar
      Better support for array returns (prototype roots-one), ordering of load · 94bcffd5
      Liam Healy authored
      In roots-one.lisp, added arguments for dynamic callbacks.  This is not
      complete; 
       (roots-one-example-derivative +newton-fdfsolver+ nil)
      causes both SBCL and CCL to crash to low-level debuggers.
      These changes included using a new function list-to-arrays in
      call-maybe-scalar so that multiple arrays can be set. 
      New file callback-compile-defs has definitions that are needed at
      compile time of later files.  Added a call record-callbacks-for-class
      in defmobject, in addition to the expansion in the form, because the
      hash table *callbacks-for-classes* needs to be updated with the class
      being defined for the macro make-cbstruct-object to work.  Added
      comments above defmobject to explain some of the arguments.
      94bcffd5
  6. 26 Feb, 2009 1 commit
  7. 21 Feb, 2009 1 commit
    • Liam Healy's avatar
      Order of arguments in linear-mfit, export symbols, documentation update · 352210f5
      Liam Healy authored
      Swapped the optional arguments 'weight, 'tolerance to linear-mfit on
      the assumption that weighted fits are used more often than SVD.
      Exported symbols for the generic functions defined in generic.lisp
      (note: this will require shadowing when importing both the :gsl
      package and the :iterate package).  Various minor improvements/updates
      to documentation.
      352210f5
  8. 20 Feb, 2009 1 commit
    • Liam Healy's avatar
      Unify linear-mfit; Airy tests from GSL · ed9a001e
      Liam Healy authored
      The linear multi-parameter fitting functions with and without SVD have
      been unified into one function #'linear-fit; the weighted and
      unweighted functions have already been unified.  If tolerance is
      non-nil (double-float) the SVD functions will be called.
      
      Tests of the Airy functions have been replaced by those in GSL's
      gsl-1.11/specfunc/test_airy.c and agree.  Test totals now:
      SBCL 64: TOTAL: 1440 assertions passed, 5 failed, 0 execution errors.
      CCL 64:  TOTAL: 1441 assertions passed, 4 failed, 0 execution errors.
      ed9a001e
  9. 19 Feb, 2009 1 commit
    • Liam Healy's avatar
      GSL features added in version 1.12; fix spelling · cefb7c3f
      Liam Healy authored
      Added faster simplex mininimser using the symbol
      +simplex-nelder-mead+; the old one is now called
      +simplex-nelder-mead-on2+.  Added new functions #'order, #'size,
      #'coefficients for Chebyshev; #'order is a generic function.
      Added methods for vectors with complex elements for elt+, elt-, elt*,
      elt/.  Fix spelling of "paraboloid".
      cefb7c3f
  10. 18 Feb, 2009 1 commit
    • Liam Healy's avatar
      GSL features added in version 1.11; cholesky-solve and linear fit unification · cb88b8db
      Liam Healy authored
      Added +halton+, +reverse-halton+ to random/quasi.lisp. 
      
      Added #'multi-linear-residuals in
      solve-minimize-fit/linear-least-squares.lisp.  Changed +sobol+,
      +niederreiter2+ from *..* apparently overlooked before.
      
      #'cholesky-solve now written so that if x-spec = T, a marray is
      created and the solution put in it and returned.  If it is NIL, the
      solution will replace b.  This required a modification to
      expand-defmfun-generic to remove &aux args from the defgeneric
      arglist.
      
      solve-minimize-fit/linear-least-squares.lisp
      Specify the weight as an optional argument, unifying the weighted and
      unweighted functions:
      linear-fit, multiplier-fit, linear-mfit, linear-mfit-svd.
      This necessitated a change in the order of the arguments.
      Changed call in basis-splines.lisp.
      cb88b8db
  11. 17 Feb, 2009 1 commit
    • Liam Healy's avatar
      GSL features added in version 1.9 · 6e17d879
      Liam Healy authored
      Added definitions for GSL features that were added in version 1.9, and
      one from version 1.10: mminusp, mplusp, non-negative-p,
      +knuthran2002+, +vector-bfgs2+.  Macros defmpar now has key instead of
      optional args.  It and def-rng-type take a gsl-version argument; any
      symbols that are not defined in the user's version of GSL will be
      bound to an instance of 'obsolete-gsl-version but it is not signalled.
      6e17d879
  12. 16 Feb, 2009 1 commit
  13. 15 Feb, 2009 3 commits
    • Liam Healy's avatar
      Make 'single-function "class" for (def-)make-callbacks · e236d8d7
      Liam Healy authored
      Many callback users need just a single function taking and returning
      scalars.  These are all defined the same way.  So I have defined in
      callbacks.lisp a def-make-callbacks for 'single-function.  This works
      for chebyshev, minimization-one, and roots-one, and it should be
      applicable to callbacks sent directly to functions without being
      stored in mobjects.
      e236d8d7
    • Liam Healy's avatar
      Chebyshev ported to callbacks-included and example/test fixed · 84b5a165
      Liam Healy authored
      Chebyshev object now built on callbacks-included.  The example/test
      was generating an error because the calls in integral-chebyshev and
      derivative-chebyshev did not have a needed #'mpointer call.  This has
      been fixed and the test results match the previous result given in
      8d9ce4e8.
      84b5a165
    • Liam Healy's avatar
      ODE evolution ported to callbacks-included · b6561c8e
      Liam Healy authored
      Mobject 'ode-evolution is now made as a subclass of 'callbacks-included-cl, a
      new class that is a subclass of 'callbacks-included, but which stores the
      cbstruct pointer in a CL slot rather than in a foreign struct.  This example is
      correct,
      (integrate-vanderpol 1.0d0 1.d-4 *step-rk4* nil)
      40
      1.0d0
      -1.4568569264026898d0
      -11.547449151779395d0
      b6561c8e
  14. 14 Feb, 2009 1 commit
    • Liam Healy's avatar
      Nonlinear least squares ported to callbacks-included; 'dimension-names · 59d0892f
      Liam Healy authored
      Nonlinear least squares now works using callbacks-included.  This
      necessitated naming the components of dimensions individually 
      (number-of-observations number-of-parameters).  This is done with
      added slot 'dimension-names to the callbacks-included class and an
      argument of the same name to #'def-ci-subclass which defaults to
      '(dimensions).  Because of the default, the other defmobject usage
      need not be changed.
      59d0892f
  15. 11 Feb, 2009 1 commit
    • Liam Healy's avatar
      Make mobjects with :singular arguments · 5df3cc8b
      Liam Healy authored
      Some parameters to the make-* function for mobjects are taken as lists
      (like 'functions, 'dimensions) but for some mobjects it only makes sense
      to supply one.  In these cases, the :singular argument to defmobject
      indicates that that argument is to be put in a list before being
      passed to the next function.
      5df3cc8b
  16. 10 Feb, 2009 1 commit
  17. 09 Feb, 2009 2 commits
  18. 08 Feb, 2009 2 commits
    • Liam Healy's avatar
      One-dimensional root solver ported to callbacks-included · b44593b7
      Liam Healy authored
      The one-dimensional root solvers in roots-one.lisp now works in the
      callbacks-included object, including both examples, with and without
      derivatives.  The no-derivative case has been modified to
      automatically listify the function name given.  For callbacks-included
      classes that do not define 'dimensions (because they are
      one-dimensional), there is a new macro def-ci-subclass-1d that makes
      'dimensions slot a class slot with '(1).  Defined a print-object
      method for callbacks-included classes.
      b44593b7
    • Liam Healy's avatar
      Build 'one-dimensional-root-solver-f on 'callbacks-included · 19dbbe90
      Liam Healy authored
      Now define one-dimensional-root-solver-f on 'callbacks-included.  This
      needs some modification to mobject to add the 'functions slot argument
      and remove 'dimensions from the cbstruct when it is not in the
      allocation arguments.  The :functions argument must be given as a
      list, even though there's only one function.  The example
      (roots-one-example-no-derivative) works.
      19dbbe90
  19. 07 Feb, 2009 3 commits
    • Liam Healy's avatar
      Define callbacks with #'make-callbacks form at top level · 866e84bd
      Liam Healy authored
      Defined a new macro #'make-callbacks that is invoked at top level.  It
      is given the mobject class name, the function name(s), dimension(s)
      and whether it should assume scalar input/output.  It will define the
      appropriate callbacks for use in the mobject.  This eliminates the
      need for defun* and should work with all CL implementations.  Tested
      on both roots-multi only.
      866e84bd
    • Liam Healy's avatar
      Use new 'callback-included classes for all roots-multi · 5079794d
      Liam Healy authored
      Converted roots solver using the derivative to the new class
      definition based on 'callback-included.  Now example
      #'roots-multi-example-derivative works.  Removed unneeded
      definitions.
      5079794d
    • Liam Healy's avatar
      Class 'callback-included has slots with struct information · 42e73fd8
      Liam Healy authored
      The class 'callback-included has the following slots:
      cbstruct-name, array-type, callback-labels, functions, dimensions;
      the first three will be :allocation :class in all subclasses.
      This has been implemented and tested with the 
      'multi-dimensional-root-solver-f object in roots-multi.lisp.  The
      example #'roots-multi-example-no-derivative works.
      42e73fd8
  20. 04 Feb, 2009 1 commit
    • Liam Healy's avatar
      Hacked changes define cbstruct in mobject maker · 0dbbb5e4
      Liam Healy authored
      Have the mobject maker build the cbstruct.  This is now hacked in and
      works with roots-multi in #'roots-multi-example-no-derivative, but
      with #'make-multi-dimensional-root-solver-f having a hardwired
      dimension of 2.  No clear way to communicate the dimension(s) from the
      other part of the defmobject form.  Started to think/write a subclass
      'callback-included of 'mobject, but this may be overkill as all
      variables except 'dimensions are exclusive to the cbstruct maker
      itself so don't really need to be class slots.
      0dbbb5e4
  21. 02 Feb, 2009 1 commit
    • Liam Healy's avatar
      Split up definition of defmobject, add definition of defun* · 7b9eb8c5
      Liam Healy authored
      The definition of defmobject has become too large so the parts that
      are responsible for construction of the various functions are broken
      out as functions:
        make-initialize-instance
        make-reinitialize-instance
        mobject-maker
      
      The definition of callbacks for GSL will be changed so that the
      callback function (defmcallback) is defined at the time the function
      is defined, and the callback GSL structure is made (defcbstruct) at
      the time the corresponding defmobject is made, along with a freeing
      function to add to the finalizers.  (For callbacks used in functions
      without mobjects, the struct will be allocated before and then freed
      after the call.)  As a first step toward this organization, defun* is
      defined to handle in one form the definition of a CL function and of a
      callback.
      7b9eb8c5
  22. 27 Jan, 2009 1 commit
    • Liam Healy's avatar
      Non-native and :callback-toplevel-only fixes · 86da4ec7
      Liam Healy authored
      Fixed several bugs that affected non-native implementations, where
      :inputs, :outputs, or both were not properly declared.  According to
      the CFFI manual, "Portability note: defcallback will not work
      correctly on some Lisps if it's not a top-level form." Evidently, this
      includes Clozure CL, so a new symbol :callback-toplevel-only has been
      pushed onto *features* if openmcl.  This changes examples with
      callbacks to define the callbacks in a separate defparameter rather
      than in-line when the mobject is made of the function is called.  As a
      result of both these changes, the only errors left in CCL tests were
      ones seen previously.  
      CCL 64: TOTAL: 1259 assertions passed, 3 failed, 0 execution errors.
      SBCL 64: TOTAL: 1257 assertions passed, 5 failed, 0 execution errors.
      86da4ec7
  23. 25 Jan, 2009 2 commits
    • Liam Healy's avatar
      Keyword arguments to defmobject · cd6a85f8
      Liam Healy authored
      Change optional arguments to defmobject to keyword arguments, and add
      :gsl-version argument that will create the maker function to signal an
      error if the installed version of GSL is too old.
      cd6a85f8
    • Liam Healy's avatar
      Use lambda forms in callbacks · b134ed94
      Liam Healy authored
      It is possible to use lambda forms as well as function names in
      callback definers; this is demonstrated in the Monte Carlo example.
      Eliminated make-mfunction and folded its functionality into
      make-solver-functions.  Added a section to the documentation to
      explain how function definitions work.
      b134ed94
  24. 24 Jan, 2009 2 commits
    • Liam Healy's avatar
      Define callbacks by returning the struct pointer, without setting specials · f0c7ecec
      Liam Healy authored
      Macro defcbstruct and all the macros built on it now simply return the
      C struct needed by GSL functions instead of binding a special whose
      name is then passed to the GSL functions.  Specials can still be used
      of course in the standard way like defparameter, but the results can
      also be bound locally with a let or passed in directly.  The name of a
      callback passed to defmcallback and to defcbstruct in all the macros
      that expand both is now gensymmed (since it is used only long enough
      to put in a slot of the cbstruct) instead of taken to be the name of
      the CL function, in order to make clear the different objects.
      Unfortunately, there is appears to be a bug in CFFI using defcallback
      with an uninterned symbol in CCL, so I have put a workaround in.
      However, there is still another error even with this workaround.
      Thus test results are:
      SBCL 64: TOTAL: 1248 assertions passed, 5 failed, 0 execution errors.
      CCL 64: TOTAL: 1229 assertions passed, 2 failed, 6 execution errors.
      f0c7ecec
    • Liam Healy's avatar
      Relocate definition, optional arguments, nonlinear least squares streamline · 42cf5a7b
      Liam Healy authored
      Moved gsl-mfunction, def-mfunction, and gsl-mfunction-fdf from
      roots-multi.lisp to generic.lisp because they are common to several
      files in the solve-minimize-fit module.  Made arguments default
      instead of required in #'linear-mfit, linear-mfit-svd,
      weighted-linear-mfit, weighted-linear-mfit-svd.  Most of these do not
      have examples, so untested.  This required new functions
      #'default-covariance, #'default-lls-workspace.  Renamed examples to
      #'linear-least-squares-univariate-example and
      #'linear-least-squares-multivariate-example, and changed to
      'print-details.  Revised definitions in nonlinear least squares to
      streamline data flow; there is no setup function or global
      pre-declaration of the number of parameters or observations required
      anymore.  The example function now called
      nonlinear-least-squares-example will take the number of observations
      and the fitter method as optional arguments.
      42cf5a7b
  25. 23 Jan, 2009 1 commit
    • Liam Healy's avatar
      Minimization will take scalar functions, added tests, optional printing · 78b88074
      Liam Healy authored
      The minimization functions may now take and return scalars or marrays.
      The examples take optional arguments with the solver method and
      whether to print the steps.  They are now part of the #'examples and
      test suite.  Use maref instead of cl-array in
      #'roots-multi-example-no-derivative.  Add optional solver method to
      roots one and roots multi, and add tests for all solvers.
      78b88074
  26. 22 Jan, 2009 1 commit
  27. 20 Jan, 2009 1 commit
    • Liam Healy's avatar
      Least squares added to tests, make arguments optional · f755beaf
      Liam Healy authored
      Coverted required args to optional args defmfun weighted-linear-mfit
      and replaced 'parameters with 'parameters-or-size.  Added print-steps
      options for several more examples, and put the newline at the end of
      the format string.  Added tests; CCL 64 bit now fails one of the
      linear least squares (returns zeros) and the nonlinear least squares
      (good to 6 or so significant figures).
      SBCL 64: TOTAL: 1231 assertions passed, 5 failed, 0 execution errors.
      CCL 64: TOTAL: 1234 assertions passed, 2 failed, 0 execution errors.
      f755beaf
  28. 19 Jan, 2009 1 commit
    • Liam Healy's avatar
      More callbacks take and return scalars · f15ffdda
      Liam Healy authored
      More usage of callbacks using or computing multiple quantities
      now do so on scalars because the macros in GSLL pull out the
      individual elements of foreign arrays, and accept multiple values and
      put them into the right foreign arrays.  In roots-multi,
      #'multiroot-slot takes a mobject and extracts the mpointer before
      calling the foreign slot value.  Several examples in
      solve-minimize-fit now have optional 'print-steps argument.  These
      examples are now the basis for additional tests.
      f15ffdda
  29. 03 Jan, 2009 1 commit
    • Liam Healy's avatar
      Generic functions for solve-minimize-fit · f6c5e260
      Liam Healy authored
      Introduced in generic.lisp the generic functions iterate, solution,
      function-value, last-step.  These replace regular functions with
      solver-specific names.
      f6c5e260