1. 16 Feb, 2009 3 commits
    • Liam Healy's avatar
      Rename constants to +...+ · b28a6a5a
      Liam Healy authored
      Rename constant pointers into the GSL library to +...+ from *...*.
      b28a6a5a
    • Liam Healy's avatar
      Merge in dynamically generated callbacks. · 26de0158
      Liam Healy authored
      Merge branch 'refactoring-callbacks'
      26de0158
    • 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
  2. 15 Feb, 2009 8 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
      Direct use of callbacks in functions · 575fe965
      Liam Healy authored
      Simple function passing to functions which don't use mobjects is
      possible with some modifications to defmfun which treat the C argument
      'callback and the CL argument 'function specially, generating a
      callback structure based on 'gsl-function and filling it
      appropriately.  Ported numerical-differentiation and
      numerical-integration.  Also simplified calls in numerical-integration
      by making the workspace argument optional and at the end of the
      arglist; it defaults to the right size based on 'limit.  Changed one
      of the tests for numerical-integration because the limit test doesn't
      make sense with the workspace automatically allocated.
      575fe965
    • 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
      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
      Consistent apply-step, apply-evolution function names and arguments · f4489bf4
      Liam Healy authored
      The arguments have been changed in apply-step, apply-evolution so that
      they match for the first three arguments.  The function name
      apply-step was changed so the two are similar.  The macro
      with-ode-integration defines a local function #'next-step instead of a
      symbol macro 'make-next-step because symbols in the body of a simple
      loop violate the CL standard.  Some documentation has been updated
      with the contribution of Mirko Vikovic.
      f4489bf4
    • Liam Healy's avatar
      Callback struct stored in ode-stepper slot · 47ce1e4a
      Liam Healy authored
      Changed the code so that the callback struct is now in ode-stepper
      instead of ode-evolution, because all solvers need stepper but only
      variable step integrators need evolution.  The ode examples/tests
      work.
      47ce1e4a
    • 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
  3. 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
  4. 13 Feb, 2009 2 commits
    • Liam Healy's avatar
      Array copy tests 64-bit conditionalize · 462cecdc
      Liam Healy authored
      Conditionalize the array copy 64-bit tests matrix-copy-to-cl-and-back.lisp
      and vector-copy-to-cl-and-back.lisp with #+int64 so they don't run on
      32 bit computers.
      462cecdc
    • Liam Healy's avatar
      Copying tests · 7fa63f90
      Liam Healy authored
      Tests of copying marrays to and from CL.
      7fa63f90
  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 2 commits
    • Liam Healy's avatar
      Make marray using CL arrays generated with make-ffa · 4670733d
      Liam Healy authored
      In #'make-marray, :cl-array argument will build that marray out of a
      CL array.  This CL array should have been generated with #'make-ffa;
      this symbol 'make-ffa is now exported for users.
      4670733d
    • 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. 10 Feb, 2009 1 commit
  8. 09 Feb, 2009 2 commits
  9. 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
  10. 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
  11. 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
  12. 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
  13. 01 Feb, 2009 1 commit
    • Liam Healy's avatar
      Polynomial uses #'evaluate · cbcc15dd
      Liam Healy authored
      Polynomial evaluation is now done with a method of #'evaluate.  We
      can't do complex evaluation because the return value would be complex,
      and there is no way to handle that in CFFI yet.  Evaluation with
      divided differences is a keyword switched part of the same method; it
      works but gives an puzzling style warning in SBCL about the keyword.
      The use of an marray in an optional/key argument necessitated a change
      to defmfun that redefined #'body-expand from #'body-no-optional-arg,
      made #'body-no-optional-arg a new function that wraps necessary
      array-handling forms around the expanded unswitched body form from
      body-expand.
      cbcc15dd
  14. 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
  15. 27 Jan, 2009 2 commits
    • Liam Healy's avatar
      Interpolation fixes · 078abffa
      Liam Healy authored
      Placed missing #'mpointer calls, added :input declarations in
      defmfuns.  Fixed #'spline-example to work correctly with marrays, and
      added a test.
      078abffa
    • 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
  16. 26 Jan, 2009 1 commit
    • Liam Healy's avatar
      New macro with-ode-integration, new ODE tests · b6d90200
      Liam Healy authored
      The macro with-ode-integration has been significantly altered, using
      marrays and symbol macros to make integration forms easier.  There are
      now 10 ode tests, one for each of the supplied steppers.
      b6d90200
  17. 25 Jan, 2009 3 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
    • 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
  18. 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
  19. 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
  20. 22 Jan, 2009 1 commit
  21. 21 Jan, 2009 1 commit