1. 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
  2. 16 Feb, 2009 2 commits
    • Liam Healy's avatar
      Suppress spurious style-warnings from SBCL in generic function &key · 05428839
      Liam Healy authored
      SBCL gets confused about what &key arguments are acceptable for
      generic functions, so &allow-other-keys is added for SBCL only in the
      defgeneric of #'evaluate.
      05428839
    • Liam Healy's avatar
      Monte Carlo uses direct function callbacks · bcf61476
      Liam Healy authored
      Direct function callbacks may now be used with GSL structs other than
      'gsl-function, and will set the 'dimension slot as well by looking at
      the arglist of the function sent.  This uses an #'arglist borrowed
      from CLOCC:port.  Rewrite make-callbacks based on a hash table rather
      than a generic function.  All the usualy tests pass.
      SBCL 64:
      TOTAL: 1259 assertions passed, 5 failed, 0 execution errors.
      CCL 64:
      TOTAL: 1260 assertions passed, 4 failed, 0 execution errors.
      bcf61476
  3. 15 Feb, 2009 3 commits
    • Liam Healy's avatar
      Define functions and macro to help direct use of callbacks in defmfun · 3d57ef40
      Liam Healy authored
      As a way of making it easier to use something other than a
      gsl-function and with additional slots set, and to make more clear
      where specific variable names are treated specially, define and use:
        callback-arg-p
        callback-replace-arg
        callback-remove-arg
        callback-set-slots
      Also split off #'set-cbstruct which #'make-cbstruct and
      callback-set-slots both use.
      3d57ef40
    • Liam Healy's avatar
      Finalizer for callback structure in CL slot · ea176adc
      Liam Healy authored
      Define a finalizer for callback structure in CL slot, so that when the
      object is garbage collected, the foreign space for the callback is
      also removed.  Deleted duplicate definition of make-cbstruct-object.
      ea176adc
    • 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
  4. 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
  5. 12 Feb, 2009 1 commit
    • Liam Healy's avatar
      Copy to and from CL arrays · 6a685571
      Liam Healy authored
      The function #'copy will now copy contents between marrays and CL
      arrays.  The destination array can be supplied literally, or created
      by this function by specifying the desired type: when copying from a
      marray to a CL array, specify 'array; when copying from a CL array to
      a marray, specify the element type of the marray.  For example,
      (COPY
         (COPY
          (MAKE-MARRAY '(COMPLEX DOUBLE-FLOAT) :INITIAL-CONTENTS
                       '((-34.5 8.24 3.29 -8.93 34.12 -6.15)
                         (-8.93 34.12 -6.15 49.27 -13.49 32.5)
                         (49.27 -13.49 32.5 42.73 -17.24 43.31)))
          'ARRAY)
         '(COMPLEX DOUBLE-FLOAT))
      copies from the matrix-complex-double-float made in the make-marray
      form to a CL array, then copies the contents to a new
      matrix-complex-double-float.
      6a685571
  6. 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
  7. 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
  8. 07 Feb, 2009 2 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
      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
  9. 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
  10. 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
  11. 29 Jan, 2009 1 commit
    • Liam Healy's avatar
      Generic functions, fix interpolation · 04f30601
      Liam Healy authored
      Turned many functions, particularly those having to do with
      interpolation, into generic functions and methods, and thus renamed
      them and changed their arglists.  Added test for basis spline; it
      works in SBCL but does not in CCL.
      04f30601
  12. 25 Jan, 2009 2 commits
    • Liam Healy's avatar
      ODE control objects · 4e83fcc4
      Liam Healy authored
      ODE control is now done with GSL objects, including a superclass
      'ode-control.
      4e83fcc4
    • 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
  13. 22 Jan, 2009 1 commit
  14. 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
  15. 12 Jan, 2009 1 commit
    • Liam Healy's avatar
      Redefine #'copy · 419e70d4
      Liam Healy authored
      Redefine #'copy so that it has one required argument (source) and one
      optional argument (destination).  For marrays, create a destination
      using make-marray, if one was not given, and then use the memcpy
      functions to fill the values.  For all other mobjects, copy will copy
      objects by calling one of two generic functions, #'copy-to-destination
      and #'copy-making-destination, depending on whether a destination was
      supplied.  The former is defined if a GSL _memcpy function exists.
      The latter will look for a GSL _clone function, then make a CL
      instance with the pointer returned as mpointer.  If there is no clone
      function, it will attempt to make a new object using make-load-form,
      so will fail if that method has not been defined.
      
      Added a check to defmfun that signals an error if a variable is used
      in the C arguments other than top-level that is not used in the CL
      arglist.  This should not happen and is usually an indication of a
      typo.
      419e70d4
  16. 30 Dec, 2008 1 commit
  17. 29 Dec, 2008 3 commits
    • Liam Healy's avatar
      Better support for non-native implementations · c01366d6
      Liam Healy authored
      Testing with Clozure reveals more details on the stack overflow
      problem than what CLISP reveals.  This is fixed by using #'slot-value
      instead of #'cl-array in  #'copy-c-to-cl and #'copy-cl-to-c.
      Non-complex arrays were not handled correctly in
      #'copy-array-from-pointer; fixed.  There is a dependency of
      permutation and combination on the definition of #'data-class-name
      through defmfun.  Test results:
      CCL: TOTAL: 1143 assertions passed, 52 failed, 3 execution errors.
      CLISP: TOTAL: 996 assertions passed, 149 failed, 11 execution errors.
      SBCL: TOTAL: 1208 assertions passed, 0 failed, 0 execution errors.
      (But only the second time it's run in SLIME.)
      Variable *print-contents* to disable printing of marray contents in
      print-object; this is helpful for debugging.
      c01366d6
    • Liam Healy's avatar
      Port to non-native implementation and CLISP · b3c65d75
      Liam Healy authored
      Make functional for non-native CL implementation, with allocation of C
      arrays and correct copying between CL and C sides.  Testbed for this
      is CLISP, but CLISP has several problems which may be a problem with
      the GSLL code or may be in CLISP:
       - need to set sys::*inhibit-floating-point-underflow*
       - CLISP doesn't see defconstant defined when it's used in the same file
       - many tests give "Program stack overflow" error and debugging
          procedure not clear
       - failure on amd64 bit platform
      b3c65d75
    • Liam Healy's avatar
      GSL arrays created by GSL functions · 38ddfa1a
      Liam Healy authored
      Made the generic function #'contents-from-pointer that takes a pointer
      to a GSL struct and produces a list of the contents suitable for the
      :initial-contents argument to #'make-marray.  Added an argument
      :from-pointer to #'make-marray that then creates a new marray with the
      same contents.  Some functions in solve-minimize-fit return a pointer
      to a GSL vector with double-floats.  Copying in this way is necessary
      because GSL has malloced the data in a non-CL place.  Sometimes, this
      results in the copying of data whose only further use will be to
      extract a pointer to pass to another GSL function.  Added a method
      to #'mpointer that permits directly passing a pointer, but this isn't
      useful for arrays because there are many element types so the
      functions have been defined as methods.
      38ddfa1a
  18. 27 Dec, 2008 2 commits
  19. 26 Dec, 2008 4 commits
    • Liam Healy's avatar
      Calling mobjects with #'mpointer, generic function #'name · 297c08b2
      Liam Healy authored
      GSL functions that take GSL objects as arguments must have #'mpointer
      called on each argument.  Created a generic function #'name and
      changed all the *-name (or name-*) functions that acted on mobjects to
      this function.
      297c08b2
    • Liam Healy's avatar
      Full use of defmobject; elimination of letm · b09dc9d2
      Liam Healy authored
      All GSL objects are full CL objects with garbage collection.  There is
      no need to manually free the associated memory.  All objects may be
      assigned in the normal CL way, e.g. let, so there is not #'letm macro
      anymore.  Everything compiles cleanly in gsll, but nothing has been
      tested.
      b09dc9d2
    • Liam Healy's avatar
      New class foreign-array, new names: marray, make-marray, mobject.lisp · 7c66d57b
      Liam Healy authored
      New class foreign-array represents foreign (C) arrays, without GSL or
      mobject superclass.  New class name 'marray was 'gsl-data,
      representing arrays in GSL.  These objects are made by #'make-marray,
      formerely #'make-array*.  New file names: init/mobject.lisp was
      init/gsl-objects.lisp and data/marray.lisp was data/data.lisp.
      7c66d57b
    • Liam Healy's avatar
      Permit alternate origin of mpointer; #'clone · 38d9c4f4
      Liam Healy authored
      Redesign #'defmobject so that a new method #'allocate is defined that
      calls the standard GSL allocate function for each object.  Shrink the
      initialize-instance :after method to call #'allocate if the mpointer
      isn't given, and then set the finalizer.  This way, an :mpointer made
      by something other than the allocate function may be supplied to the
      make-instance, and the object will be made correctly.  This is used by
      #'clone functions in histogram and random number generators.  Not
      compiled or tested, but macroexpansions look right.
      38d9c4f4
  20. 25 Dec, 2008 1 commit
  21. 24 Dec, 2008 1 commit
    • Liam Healy's avatar
      GSL object makers with mixed arguments · adbbbbcd
      Liam Healy authored
      GSL objects made with defmobject and that have use at least one
      argument in some way for both initialization and reinitialization, or
      for using functions of those arguments, are accomodated with an
      optional argument 'arglists-function to defmobject.  This should be a
      function that produces three arglists: for the maker, the
      initialization method, and the reinitialization method.  The order of
      arguments generated for other cases is now preserved with :from-end in
      #'variables-used-in-c-arguments.  Examples for interpolation and
      acceleration (lookup), still commented out.
      adbbbbcd
  22. 22 Dec, 2008 1 commit
    • Liam Healy's avatar
      New class mobject, new hierarchy, clean up files · 9b588763
      Liam Healy authored
      Redefine 'mobject from 'gsl-object.  The class 'gsl-data in data.lisp
      is now a subclass of it, and does not explicitly have the mpointer
      slot, because mobject does.  Adapted #'defmobject to work with objects
      that have no "setter" (initialization).  This expands correctly for
      basis-splines (no setter) and hankel (setter).  The basis-splines
      defintions rely on the new mobjects.
      9b588763
  23. 16 Dec, 2008 1 commit
  24. 15 Dec, 2008 1 commit
    • Liam Healy's avatar
      Prototype defmobject · ed5ce113
      Liam Healy authored
      In gsl-objects, define a prototype defmobject which defines:
       - the class for the gsl object
       - initialize-instance :after method to correspond to GSL
        "alloc" and attach the finalizer,
       - define reinitialize-instance :after method to correspond to a setter
        or intialize in GSL,
       - define a make-<class-name> function that will be the customary user
        interface, and will call make-instance and possibly
        reinitialize-instance if defined.
      Worked up example in hankel.lisp.  This compiles successfully and
      looks correct, but has not been tested.
      ed5ce113
  25. 31 Aug, 2008 1 commit
    • Liam Healy's avatar
      Clean up several compilation problems · 134132bc
      Liam Healy authored
      Several bugs with small fixes, modifications to eliminate warnings:
      - Bad names for argument variables in maref fixed.
      - Add depenedencies in gsll.asd to avoid warnings.
      - Histogram needs #'assign-pointer function which was previously
        eliminated.
      - #'scale is a generic function, change defun to defmethod in
        histogram.
      - New #'variables-used-in-c-arguments replaces #'c-arguments in
        defmfun, now is a simplistic code walker but goes to arbitrary
        depth.  This will do for current uses of defmfun.
      - Export and defgenerics for #'alloc, #'free which are used by
        histogram and random.  In gsl-objects.lisp for lack of a better
        place.
      System now completely compiles from scratch with only one warning 
      "Implicitly creating new generic function BIND-GENERATE-BINDINGS."
      which is from metabang-bind.  No new testing.
      134132bc
  26. 24 Aug, 2008 1 commit
    • Liam Healy's avatar
      Method #'cl-array for pointers (gsl-vector-c doubles) · 9bf385d1
      Liam Healy authored
      Define '+foreign-pointer-class+ to be the class name for foreign
      pointers, which will be assumed to be GSL vectors or matrix pointers.
      Use in new method #'cl-array to return a CL array from a pure GSL
      vector double pointer, such as is returned by several functions in
      solve-minimize-fit.
      9bf385d1
  27. 25 Jul, 2008 2 commits