Liam Healy [Sun, 28 Nov 2010 03:50:04 +0000]
Eliminate complex-to-cl; require FSBV
Using fsbv:defcstruct defines conversion between foreign and Lisp for
complex types, so a separate complex-to-cl is no longer necessary.
This means that FSBV is required. If FSBV's convert.lisp is separated
from FSBV and loaded by itself, then only defconvert may be used and
(the rest of) FSBV will not be necessary.
Liam Healy [Sat, 27 Nov 2010 18:53:50 +0000]
Rewrite complex-to-cl using the complex component type
Rewrite the function complex-to-cl to properly use complex component
type instead of always using double float. This fixes two errors in
GSLL which do calculations on (complex single-float). The body of the
function is based on the form that FSBV generates for
foreign-object-components. Function relocated from
number-conversion.lisp to complex-types.lisp
Liam Healy [Thu, 25 Nov 2010 15:45:00 +0000]
Updated documentation to include declarations and using quicklisp to install
Liam M. Healy [Mon, 22 Nov 2010 15:44:29 +0000]
Fix grid:gsetf macro
Liam Healy [Sun, 21 Nov 2010 04:30:40 +0000]
Define faref and set-faref macros to expand array element access
The macros faref and set-faref are defined to expand array element
access most efficiently. They take an explicit 'type-declaration
argument, which may be nil. If nil, they expand to forms with
run-time evaluated values. If there is a non-nil type given, they
expand to the appropriate cffi:mem-aref. These are used by all gref,
gref*, (setf gref) and (setf gref*) methods, general and specific, and
by compiler macros that look for declarations. It is not clear if and
how the setf macros are being expanded properly, but it is hoped that
the 'gsetf macro (which could be a shadow of cl:setf) will help insure
that maximum use is made of any declarations.
Liam M. Healy [Fri, 19 Nov 2010 22:13:19 +0000]
Fix error in type specification for complex types
Liam M. Healy [Mon, 15 Nov 2010 23:20:43 +0000]
Author: Liam M. Healy <lnp@healy.washington.dc.us>
--- log message follows this line ---
Start macro faref for direct access the foreign arrays
Liam M. Healy [Mon, 15 Nov 2010 15:32:37 +0000]
Remove some &key and &rest arguments to avoid unused variable warnings
Liam Healy [Mon, 15 Nov 2010 03:23:12 +0000]
Add a (setf gref*) compiler macro and timing test
A compiler macro is now defined for (setf gref*); however, it will not
be invoked for the common case of using the setf macro. Instead, it
is necessary to funcall #'(setf gref*) at least in SBCL because the
setf macro gets expanded in new variables which are then not declared.
Added a foreign-array timing test.
Liam Healy [Sun, 14 Nov 2010 22:57:49 +0000]
Compiler macro for gref that expands to gref*
The compiler macro for gref that expands to gref* now is specific to a
foreign-array type and thus requires a declaration, because it's
probably not good for CL arrays. It also now works on matrix types,
linearizing the array appropriately according to the declared
dimensions. There is now a helper function using-declared-type used
in the compiler macros for gref and gref*.
Liam Healy [Sun, 14 Nov 2010 00:30:12 +0000]
Put declarations in gref* and (setf gref*) definitions
Added declarations of inputs and outputs and intermediate quantities
in gref* and (setf gref*).
Liam Healy [Sat, 13 Nov 2010 01:38:02 +0000]
Map element type to CFFI form for complex types
Liam M. Healy [Mon, 8 Nov 2010 16:35:33 +0000]
Fix error in reading declaration of foreign array
Fixed an error in declared-type-dimensions which had an assumption
that the declaration is a list. Declare forms do work in SBCL
1.0.43.79.
Example form:
(defun foreign-array-test (dim)
"Test for foreign-array speed, adapted from Sebastian Sturm's code."
(let ((input (grid:make-foreign-array
'double-float :dimensions dim
:initial-element 1.0d0))
(output (grid:make-foreign-array 'double-float :dimensions dim)))
(declare (type grid:vector-double-float input output))
(let ((tv0 0.0d0) (tv1 0.0d0))
(declare (type double-float tv0 tv1))
(iter (for i from 0 below dim)
(setf tv0 0.0d0)
(iter (for m from 0 to i)
(iter (for n from i below dim)
(setf tv1 0.0d0)
(iter (for k from m to n)
(incf tv1 (the double-float (grid:gref input k))))
(incf tv0 (expt tv1 -2))))
(setf (grid:gref output i)
(- (the double-float (grid:gref input i)) tv0))))))
Results
(time (foreign-array-test 100))
Evaluation took:
0.125 seconds of real time
0.124008 seconds of total run time (0.124008 user, 0.000000 system)
99.20% CPU
382,132,350 processor cycles
8,240 bytes consed
Liam Healy [Mon, 8 Nov 2010 03:39:20 +0000]
Move compiler macros applicable to foreign-array only to that system
Liam Healy [Sun, 7 Nov 2010 22:47:19 +0000]
Type declarations for foreign-arrays
Accept 'the type declarations for foreign arrays subtypes for speed
improvement of gref*. This currently works on gref* and not (setf
gref*), and produces approximately 30x speed improvement. Also added
ability to read a traditional declaration, e.g. (type
vector-double-float zvector), which relies on the CLtL2 function
variable-information and thus is not portable (SBCL only at present);
however, this function always returns nil for the third value (type
declaration) when tested.
Liam Healy [Sun, 7 Nov 2010 20:34:23 +0000]
Accelerate foreign-array computations
By defining gref methods specific to each class
(e.g. vector-double-float) that then calls cffi:mem-aref with an
explicit element type, the speed of gref and (setf gref) are greatly
increased. Also, define a compiler macro that turns the gref into
gref* for vectors; speed improvement results from this
appear inexplicably minimal.
Liam Healy [Fri, 27 Aug 2010 03:31:42 +0000]
Definition of stride selection
Select elements by stride from a grid. For example
(grid:stride #(1 2 3 4 5 6 7 8) 3)
#(1 4 7)
Liam Healy [Mon, 23 Aug 2010 02:13:33 +0000]
Extend lisp-unit tests to include foreign-arrays
Liam M. Healy [Thu, 19 Aug 2010 20:42:41 +0000]
Improved docstring for copy-to.
Liam M. Healy [Fri, 13 Aug 2010 18:02:24 +0000]
Change split-sequence package to split-sequence
Liam M. Healy [Thu, 22 Jul 2010 21:54:54 +0000]
Default grid type, zero non-diagonal elements of identity, combine destination
Functions that take an explicit grid type as an argument now default
to *default-grid-type* instead of 'array. Set :initial-element to
non-diagonal elements of the identity-matrix to zero. Default
combine-destination to T in map-n-grids if an :initial-element is
supplied.
Liam M. Healy [Tue, 20 Jul 2010 21:53:38 +0000]
Fix initialization of complex when not done through static-vectors
The logic was wrong on initialize-instance :after foreign-array when
static-vectors are not used and complex arrays (regardless of whether
static-vectors is supported on the implementation). So now CCL 64 has
a reasonably good pass rate:
TOTAL: 4002 assertions passed, 18 failed, 0 execution errors.
Liam M. Healy [Tue, 20 Jul 2010 21:05:15 +0000]
Add dependency
Liam M. Healy [Tue, 20 Jul 2010 15:06:10 +0000]
New function matrix-into-columns
Liam Healy [Tue, 20 Jul 2010 01:53:24 +0000]
Change the default for :combine-destination in map-n-grids, add documentation
Liam M. Healy [Mon, 19 Jul 2010 22:34:33 +0000]
No static-vectors for complex arrays in CCL
Static vectors are evidently not possible with complex arrays in CCL;
error was: (COMPLEX SINGLE-FLOAT) is not an ivector subtype. Thus
the element-type and implementation are checked in the
initialize-instance :after method for foreign-array.
Liam Healy [Mon, 19 Jul 2010 02:49:11 +0000]
Added documentation for simplified generalized arrays
Liam Healy [Sun, 18 Jul 2010 04:35:04 +0000]
Simplify map-n-grids sources argument and add explanation of arguments
Each source, an element of 'sources, is a list (grid-or-function
affi). The creation of an affi from dimensions is done in map-grid.
Added significant documentation explaining map-n-grids arguments.
Liam M. Healy [Fri, 16 Jul 2010 13:40:04 +0000]
Simple loop in map-n-grids, added some documentation
Liam Healy [Fri, 16 Jul 2010 03:14:13 +0000]
Remove symbol 'clone
Liam M. Healy [Thu, 15 Jul 2010 22:22:35 +0000]
Set initial-element in foreign-array correctly
Set initial-element in foreign-array correctly; it was not correct for
#-static-vectors and complex element type. Also possibly redundant
keys in make-grid-data.
Liam M. Healy [Thu, 15 Jul 2010 13:44:09 +0000]
Keyword argument initial-element in map-n-grids
Keyword argument initial-element in map-n-grids and map-grid replaces
old default-value. It defaults to nil and if nil, there is no
initial-element used in creating the grid. If a number, it will be
coerced to the right type by coerce-value.
Liam Healy [Thu, 15 Jul 2010 03:25:19 +0000]
Complex arrays are settable and usable if #-static-vectors
Complex arrays are settable and usable if #-static-vectors; in the
case of initialization with :initial-contents, the contents are looped
over with (setf gref) on each element. In the case of (setf gref*),
the previous restriction preventing the use of complex vectors for
#-static-vectors was unnecessary as it works as-is. Return the value
at the end of the (setf gref*) function, as required by the CL
standard.
Liam Healy [Sun, 11 Jul 2010 03:29:28 +0000]
Correct :initarg for foreign-pointer slot in defclass foreign-array
Liam Healy [Sat, 10 Jul 2010 18:15:33 +0000]
Merge branch 'convert' of ssh://repo.or.cz/srv/git/gsd into convert
Liam M. Healy [Fri, 9 Jul 2010 21:42:01 +0000]
Export symbol read-data-file
Liam Healy [Fri, 9 Jul 2010 00:38:24 +0000]
Merge branch 'convert' of ssh://repo.or.cz/srv/git/gsd into convert
Liam M. Healy [Thu, 8 Jul 2010 22:07:55 +0000]
Simplify make-foreign-array-from-pointer
Simplify make-foreign-array-from-pointer by making use of the
:finalizer argument in initialize-instance :after.
Liam Healy [Thu, 8 Jul 2010 03:18:03 +0000]
Set the complex array elements correctly; (create-complex-matrix 2)
Set the complex array elements using (setf fsbv:object) for the
complex types; (create-complex-matrix 2) now works.
Liam Healy [Thu, 8 Jul 2010 01:21:05 +0000]
Merge branch 'convert' of ssh://repo.or.cz/srv/git/gsd into convert
Conflicts:
foreign-array/foreign-array.lisp
Liam Healy [Thu, 8 Jul 2010 01:19:30 +0000]
Handler and restart for using cl-array, non-functional
Liam M. Healy [Wed, 7 Jul 2010 18:53:39 +0000]
New function grid:copy-to, more robust read, check complex arrays
Liam M. Healy [Wed, 7 Jul 2010 14:02:59 +0000]
System dependence on split-sequence and alexandria
Liam M. Healy [Tue, 6 Jul 2010 19:07:19 +0000]
Read data from a file
Liam Healy [Tue, 6 Jul 2010 02:50:46 +0000]
Define #'copy for grids
Liam Healy [Mon, 5 Jul 2010 20:15:39 +0000]
Use destination-specification for grids made from functions
Making grids from functions with map-grid no longer assumes a
particular grid type or element type, so the
:destination-specification has to be given. The dimensions of the
source are assumed to be the same as the destination if source-dims is
not given.
Liam Healy [Sun, 4 Jul 2010 03:35:56 +0000]
Eliminate gtype and use specification instead in map functions
Eliminate gtype and use specification instead in map functions; two
tests fail.
Liam Healy [Sat, 3 Jul 2010 20:18:41 +0000]
New function make-specification, renamed function make-specification-gt
New function make-specification makes a specification form from the
type, dimensions, and element-type. Renamed function
make-specification-gt was make specification, and makes the
specification from the AFFI and gtype. Moved pure-cl-array-p to
multiarray.lisp because it was only used by the compound make-grid
there.
Liam Healy [Fri, 2 Jul 2010 01:58:02 +0000]
Move copy.lisp to grid from foreign-array
Liam M. Healy [Wed, 30 Jun 2010 22:01:37 +0000]
Move #'metadata-slot here from GSLL
Liam Healy [Wed, 30 Jun 2010 02:53:11 +0000]
Delete unused files, move/rename make-foreign-array from GSLL
Liam Healy [Wed, 30 Jun 2010 01:46:12 +0000]
New function foreign-array-from-pointer
New function foreign-array-from-pointer, restore #'element-size,
expand definition of data-class-name.
Liam M. Healy [Tue, 29 Jun 2010 12:59:47 +0000]
Make foreign-array with the appropriate subclass
Make foreign-array with the appropriate subclass such as
vector-double-float, instead of making it as foreign-array and then
changing the class. This helps when making objects in a subclass of
the subclass, so that it doesn't try to change it back to the parent
subclass (e.g., 'gsl:permutation is a subclass of
'vector-unsigned-byte-64).
Liam Healy [Tue, 29 Jun 2010 02:02:02 +0000]
Check for proper element-type, add dependency
Check for proper element-type when intializing an instance of
foreign-array. Add dependency to file.
Liam M. Healy [Mon, 28 Jun 2010 15:13:40 +0000]
Specification without dimensions
Specification without dimensions puts parentheses around the component
(grid) type.
Liam Healy [Mon, 28 Jun 2010 02:33:01 +0000]
Fix make-grid
Liam Healy [Mon, 28 Jun 2010 02:01:38 +0000]
Export 'data-class-name
Liam Healy [Sun, 27 Jun 2010 12:55:17 +0000]
Optional argument :foreign-metadata in making foreign-array
Liam Healy [Sun, 27 Jun 2010 03:10:16 +0000]
Add slot foreign-metadata
Liam Healy [Sat, 26 Jun 2010 23:38:08 +0000]
Subclasses for vectors and matrices
Define subclasses of foreign-array 'mvector and 'matrix, and
subclasses of those by element type. The definitions have mostly been
moved from GSLL. Remove all reference to GSL. Restore use of
static-vectors.
Liam Healy [Fri, 25 Jun 2010 02:53:10 +0000]
Comment/reference on work to be done for complex arrays on non-static-vectors
Liam Healy [Fri, 25 Jun 2010 00:08:58 +0000]
Add make-load-form for foreign-array
Liam M. Healy [Thu, 24 Jun 2010 13:40:10 +0000]
Conditionalize #-static-vectors correctly in initialize-instance
The #-static-vectors case would not compile because of incorrect
conditionalizations; this is now fixed. The push of :static-vectors
on *features* remains commented out for further testing and
development.
Liam Healy [Wed, 23 Jun 2010 02:58:49 +0000]
Print foreign arrays readably with #m
Liam Healy [Wed, 23 Jun 2010 02:36:03 +0000]
Use fsbv:object to convert complex array elements to CL
Liam Healy [Mon, 21 Jun 2010 02:32:30 +0000]
Reader macro #m for foreign arrays
Moved definition of #m to foreign-array from GSLL so that plain
foreign array is made. This works for #m, #3m (single float) and #31m
(signed 32 bit); complex #2m seems to work but gref returns a foreign
pointer and not the complex number.
Liam Healy [Sun, 20 Jun 2010 23:08:45 +0000]
Tests of foreign arrays
Liam Healy [Sun, 20 Jun 2010 15:17:45 +0000]
Restore array tests
Tests on CL arrays have been restored using #'test-grid-double-float
and #'contents, and all pass
TOTAL: 48 assertions passed, 0 failed, 0 execution errors.
Liam Healy [Sun, 20 Jun 2010 03:14:13 +0000]
Sample grid generation of any type
The sample grids that were bound to specials are now generated with a
new function #'test-grid-double-float that will make grids of any type
and dimension. Updated the documentation to use this function.
Liam Healy [Sun, 20 Jun 2010 02:44:18 +0000]
New function #'contents returns nested list of contents
New function #'contents returns nested list of contents, and this is
now used for the print-object method of foreign-array. It is also
suitable for an :initial-contents argument to make a new array.
Liam Healy [Sat, 19 Jun 2010 23:40:49 +0000]
Rearrange and clean up code
Liam Healy [Sat, 19 Jun 2010 23:15:42 +0000]
Single package, transpose now works for foreign-array
1. Eliminate the :foreign-array package and make all in :grid package.
2. Push foreign-array onto *grid-types*.
3. Coerce initial-element to the right type.
4. Added a grid-rank method.
5. Call function #'dimensions instead of #'grid-dimensions.
6. As a result, transpose now works on both array and foreign-array.
Liam Healy [Sat, 19 Jun 2010 20:49:45 +0000]
Make (setf grid:gref*) a method, grid:element-type a generic function
Liam Healy [Sat, 19 Jun 2010 19:43:38 +0000]
Fortran arrays with initial-contents
Fortran (column-major) arrays are now set correctly with
initial-contents, as demonstrated for example with
(make-grid '((farr:foreign-array 2 2) double-float)
:initial-contents '((1.0d0 2.0d0) (3.0d0 4.4d0))
:linearization :column-major)
All "C-array" designations have been changed to "foreign-array";
package nickname :farr.
Liam Healy [Sat, 19 Jun 2010 14:14:39 +0000]
Fortran (column-major) arrays support
Fortran (column-major) arrays support added, except :initial-contents
needs to be transposed.
Liam Healy [Fri, 18 Jun 2010 02:45:08 +0000]
Make 'array and 'foreign-array; sepation of multiarrays, step 2
It is now possible to make an array
(make-grid '((array 2 2) double-float) :initial-contents '((1.0d0 2.0d0) (3.0d0 4.4d0)))
and a foreign-array
(make-grid '((c-array:foreign-array 2 2) double-float) :initial-contents '((1.0d0 2.0d0) (3.0d0 4.4d0)))
but all the mechanics for multiarrays (lists, arrays of arrays, etc.)
has pushed into multiarrays.lisp which is not loaded and probably
won't compile.
Liam Healy [Thu, 17 Jun 2010 04:27:47 +0000]
Separation of "multiarrays", step 1
What was the inclusive (except for CL array) 'grid class is being
moved aside as a "multiarray" class, to leave simpler classes (array
and foreign-array) from which we build up.
Liam Healy [Wed, 16 Jun 2010 02:54:09 +0000]
Multidimensional foreign-array, define make-grid-data
Liam Healy [Tue, 15 Jun 2010 03:08:24 +0000]
Build foreign-array on static-vectors if available; (setf grid-ref) method
Liam Healy [Mon, 14 Jun 2010 03:01:47 +0000]
No superclass for foreign-array
Change class definition so that foreign-array is not a subclass of
grid, it stands on its own parallel to e.g. CL array. So far
instantiation works for vectors, and grid-ref is defined. It needs
some thought on indices (linearized vs. delinearized).
Liam Healy [Thu, 10 Jun 2010 03:24:37 +0000]
Class foreign-array for pure foreign array, no Lisp counterpart
Class foreign-array for pure foreign array, no Lisp counterpart
started. Still needs work in grid:make-grid-data, and gref, (setf
gref) in terms of gref* and (setf gref*).
Liam Healy [Wed, 9 Jun 2010 03:24:17 +0000]
Class foreign-array has two subclasses: duplicated-array and shared-array
The foreign-array class has two subclasses: duplicated-array and
shared-array, and everything is instantiated in one of those two
classes. The former is built on static-vectors, and the latter is
keeps two copies of the data. Both classes basically function but
duplicated-array still needs some more initialization options and
testing.
Liam Healy [Tue, 8 Jun 2010 03:17:52 +0000]
New class static-arrays
New grid class static-arrays uses Stelian Ionescu's static vectors.
It is possible to make one and two dimensional double-float arrays.
New function grid::total-size-from-dimension.
Liam Healy [Tue, 25 May 2010 03:00:02 +0000]
Permit :initial-contents as an argument to #'make-grid-data
Permit :initial-contents as an argument to all methods of
#'make-grid-data. This currently works for gsl:marray and array, but
not for list or c-array:foreign-array.
Liam Healy [Sun, 23 May 2010 14:26:40 +0000]
Merge branch 'master' of ssh://repo.or.cz/srv/git/gsd
Liam Healy [Sun, 23 May 2010 14:25:52 +0000]
Copy argument list in set-position; otherwise it is destructive
Copy argument list in set-position. Without copying, the original
list is changed which was affecting the dimension list when a subgrid
was selected. New error message when attempting to create a grid
including a dimension of zero.
Liam M. Healy [Mon, 26 Apr 2010 13:56:25 +0000]
Return the CL array from copy-array-from-pointer
Liam Healy [Mon, 26 Apr 2010 01:38:56 +0000]
New function copy-foreign-vector
New function copy-foreign-vector will copy the number of elements
requested from the foreign pointer into a foreign-friendly CL array.
Liam Healy [Sun, 28 Mar 2010 20:10:22 +0000]
In map-n-grids, iterate until "next" source walker returns nil
In map-n-grids, iterate until "next" source walker returns nil, not
until the walker itself is nil. This fixes an error reported by Mirko
Vukovic,
http://common-lisp.net/pipermail/gsll-devel/2010q1/000443.html. The
two "inject diagonal" tests that were in comments in the map.lisp file
in which there were errors have now been added as formal tests in the
'diagonal test in compose.lisp. A check-type has been added to gref*
to give a more meaningful (and consistent between implementations)
error should that function be called with a nil argument for the
index. This can be removed if efficiency is a concern.
Liam Healy [Sun, 21 Feb 2010 02:40:38 +0000]
Return a list from defmethod grid-dimensions ((grid grid))
Liam Healy [Tue, 9 Feb 2010 20:23:17 +0000]
Quote lambda forms in iterate extensions so that they will compile
Liam Healy [Sun, 7 Feb 2010 19:47:34 +0000]
Fix error in make-destination-gtype, new function make-gtype
Fix error in make-destination-gtype in which it would ignore
destination-affi if it wasn't a CL array. Made new function
make-gtype that replaces make-array-gtype but generalizes to any grid
type. This fixes the bug reported by Mirko Vukovic Tue, Jan 12, 2010
at 10:42 AM reporting an error when trying to find the diagonal of a
GSLL marray.
Liam M. Healy [Wed, 20 Jan 2010 19:50:53 +0000]
Duplicate #'remove-position, fix arguments to #'error
The function remove-position in the grid package has been duplicated
in AFFI because it's needed there also; these should be unified.
Fixed the number of arguments in error call.
Liam Healy [Sun, 17 Jan 2010 23:10:27 +0000]
Don't check that each dimension is positive
In AFFI, don't check that each dimension is positive, because GSLL at
least needs to make zero-length foreign arrays for combination. This
didn't seem to be a problem to SBCL, but it was for CCL.
Liam M. Healy [Wed, 6 Jan 2010 13:35:50 +0000]
Explicit package for 'gridp and 'grid-rank; export 'gridp
In iterate.lisp, which has default package :iter, use the explicit
package 'grid:gridp and 'grid:grid-rank. Export the symbol 'gridp
from the :grid package.
Liam Healy [Sat, 2 Jan 2010 23:16:26 +0000]
Add affi transformer #'extrude with tests
The transformer #'extrude will create a new AFFI that makes the grid
look as if it has an additional dimension, with each element
replicated along that dimension. Two tests added.
Further splitting of affi creation functions.
TOTAL: 47 assertions passed, 0 failed, 0 execution errors.
Liam Healy [Sat, 2 Jan 2010 15:48:35 +0000]
Return the magnitude from normalize as second value
Return the magnitude (normalization factor) as a second value from
normalize.
Liam Healy [Fri, 1 Jan 2010 21:44:05 +0000]
New make-affi-int; gtype can take grid; change to utility packages
New function make-affi-int split out from make-affi. Function gtype
can take a grid directly and will look up the specification. Use
alexandria instead of cl-utilities because CFFI already needs
alexandria which supplies with-unique-names, the only function used
from cl-utilities.
Liam Healy [Fri, 1 Jan 2010 17:00:54 +0000]
Add grid-iterate-extension
Macro extension for iterate over grids, with some documentation.
Liam Healy [Fri, 1 Jan 2010 04:14:07 +0000]
Remove dependency on iterate package