- 15 Feb, 2009 7 commits
-
-
Liam Healy authored
Started to include optional unwind-protect in defmfun expansion for allocating foreign cbstruct, but there is a better way to do that I think.
-
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.
-
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.
-
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.
-
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.
-
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.
-
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
-
- 14 Feb, 2009 1 commit
-
-
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.
-
- 11 Feb, 2009 1 commit
-
-
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.
-
- 10 Feb, 2009 1 commit
-
-
Liam Healy authored
Ported one-dimensional minimizer to callbacks-included. Callbacks may be defined either using scalars or marrays. The examples work.
-
- 09 Feb, 2009 2 commits
-
-
Liam Healy authored
New macro #'def-make-callbacks will expand to the appropriate defmethod for make-callback-fn, so that the defmcallbacks are defined appropriately.
-
Liam Healy authored
Ported one-dimensional minimizer to callbacks-included, mostly by cut and paste. The examples work.
-
- 08 Feb, 2009 2 commits
-
-
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.
-
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.
-
- 07 Feb, 2009 3 commits
-
-
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.
-
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.
-
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.
-
- 04 Feb, 2009 1 commit
-
-
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.
-
- 02 Feb, 2009 1 commit
-
-
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.
-
- 01 Feb, 2009 1 commit
-
-
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.
-
- 29 Jan, 2009 1 commit
-
-
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.
-
- 27 Jan, 2009 2 commits
-
-
Liam Healy authored
Placed missing #'mpointer calls, added :input declarations in defmfuns. Fixed #'spline-example to work correctly with marrays, and added a test.
-
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.
-
- 26 Jan, 2009 1 commit
-
-
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.
-
- 25 Jan, 2009 3 commits
-
-
Liam Healy authored
ODE control is now done with GSL objects, including a superclass 'ode-control.
-
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.
-
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.
-
- 24 Jan, 2009 2 commits
-
-
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.
-
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.
-
- 23 Jan, 2009 1 commit
-
-
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.
-
- 22 Jan, 2009 1 commit
-
-
Liam Healy authored
Add series accleration test, which succeeds in SBCL and fails in CCL. Minor cleanup.
-
- 21 Jan, 2009 1 commit
-
-
Liam Healy authored
Defined mobjects 'ode-step and 'ode-evolution; "reset" is the reinitialize-instance method. Test 'ode works.
-
- 20 Jan, 2009 1 commit
-
-
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.
-
- 19 Jan, 2009 2 commits
-
-
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.
-
Liam Healy authored
New definition for defmcallback will now convert C array pointers passed to the function by GSL into individual scalar arguments of the CL function, and will take multiple value returns and assign as elements of the return C arrays. Applied to def-ode-functions and the van der Pol oscillator example. Redefined #'maref-function-picker as a macro from a function, eliminating the need for an eval-when form.
-
- 16 Jan, 2009 2 commits
-
-
Liam Healy authored
GSLL is no longer dependent on cl-utilities, so remove it. Generic function #'name needs to be loaded before the obsolete-gsl-version condition is defined, otherwise CLISP complains. Conditionalize away a couple more 64 bit tests that were overlooked.
-
Liam Healy authored
New directory "calculus" to hold numerical-differentiation, numerical-integeration, and monte-carlo. Converted some return array arguments in BLAS to optional arguments. Define a condition 'obsolete-gsl-version to use in #'complete-definition. Try to incorporate cygwin into init.lisp; needs testing by a cygwin user.
-
- 15 Jan, 2009 2 commits
-
-
Liam Healy authored
New directory "mathematical" has complex.lisp and mathematical.lisp; fix complex function log-modulus.
-
Liam Healy authored
By sending the two parts of a complex as separate doubles (complex double-float), or packing the two parts into a one double-float argument (complex single-float), it is possible to pass complex numbers in GSL function calls. This is very likely to be non-portable, so a test is conducted and the results in *pass-complex-scalar-as-two-reals* determine whether defmfun does this translation or just creates a function that signals an error. The complex tests have been modified so that no longer expect an error: SBCL 64: TOTAL: 1223 assertions passed, 5 failed, 0 execution errors. CCL 64: TOTAL: 1228 assertions passed, 0 failed, 0 execution errors. This also works in 32 bit SBCL.
-
- 13 Jan, 2009 1 commit
-
-
Liam Healy authored
Removed declaration of 'indexed-functions as ignorable in #'with-defmfun-key-args, which now lets SBCL compile with no warnings of any kind. Superficial attempt at modernizing simulated-annealing so that it compiles, but it still fails.
-