Commit e5d36a1b authored by Liam Healy's avatar Liam Healy

Mass renames in grid and foreign-array systems

Package renamed to :grid from :c-array, function renamed to
'foreign-pointer from 'c-pointer.  Eliminate reference to native.
Port make-marray-or-default to foreign-array.
parent 78b25a17
;; Monte Carlo Integration
;; Liam Healy Sat Feb 3 2007 - 17:42
;; Time-stamp: <2009-12-27 09:42:11EST monte-carlo.lisp>
;; Time-stamp: <2010-06-27 18:13:57EDT monte-carlo.lisp>
;;
;; Copyright 2007, 2008, 2009 Liam M. Healy
;; Distributed under the terms of the GNU General Public License
......@@ -51,7 +51,7 @@
(scalars t))
"gsl_monte_plain_integrate"
((callback :pointer)
((c-pointer lower-limits) :pointer) ((c-pointer upper-limits) :pointer)
((foreign-pointer lower-limits) :pointer) ((foreign-pointer upper-limits) :pointer)
((dim0 lower-limits) sizet) (number-of-samples sizet)
((mpointer generator) :pointer)
((mpointer state) :pointer)
......@@ -112,7 +112,7 @@
(scalars t))
"gsl_monte_miser_integrate"
((callback :pointer)
((c-pointer lower-limits) :pointer) ((c-pointer upper-limits) :pointer)
((foreign-pointer lower-limits) :pointer) ((foreign-pointer upper-limits) :pointer)
((dim0 lower-limits) sizet) (number-of-samples sizet)
((mpointer generator) :pointer)
((mpointer state) :pointer)
......@@ -173,7 +173,7 @@
(scalars t))
"gsl_monte_vegas_integrate"
((callback :pointer)
((c-pointer lower-limits) :pointer) ((c-pointer upper-limits) :pointer)
((foreign-pointer lower-limits) :pointer) ((foreign-pointer upper-limits) :pointer)
((dim0 lower-limits) sizet) (number-of-samples sizet)
((mpointer generator) :pointer)
((mpointer state) :pointer)
......
;; Numerical integration
;; Liam Healy, Wed Jul 5 2006 - 23:14
;; Time-stamp: <2009-12-27 09:42:09EST numerical-integration.lisp>
;; Time-stamp: <2010-06-27 18:13:57EDT numerical-integration.lisp>
;;
;; Copyright 2006, 2007, 2008, 2009 Liam M. Healy
;; Distributed under the terms of the GNU General Public License
......@@ -157,7 +157,7 @@
(limit 1000) (workspace (make-integration-workspace limit)))
"gsl_integration_qagp"
((callback :pointer)
((c-pointer points) :pointer) ((dim0 points) sizet)
((foreign-pointer points) :pointer) ((dim0 points) sizet)
(absolute-error :double) (relative-error :double) (limit sizet)
((mpointer workspace) :pointer)
(result (:pointer :double)) (abserr (:pointer :double)))
......
;; Chebyshev Approximations
;; Liam Healy Sat Nov 17 2007 - 20:36
;; Time-stamp: <2010-04-26 09:48:32EDT chebyshev.lisp>
;; Time-stamp: <2010-06-27 18:03:23EDT chebyshev.lisp>
;;
;; Copyright 2007, 2008, 2009 Liam M. Healy
;; Distributed under the terms of the GNU General Public License
......@@ -60,7 +60,7 @@
:c-return (crtn :pointer)
:documentation
"The Chebyshev coefficient array as a CL array (foreign-friendly)."
:return ((c-array:copy-foreign-vector crtn (size chebyshev)))
:return ((grid:copy-foreign-vector crtn (size chebyshev)))
:gsl-version (1 12))
;;;;****************************************************************************
......
;; Functions for both vectors and matrices.
;; Liam Healy 2008-04-26 20:48:44EDT both.lisp
;; Time-stamp: <2009-12-27 09:42:06EST both.lisp>
;; Time-stamp: <2010-06-27 18:03:26EDT both.lisp>
;;
;; Copyright 2008, 2009 Liam M. Healy
;; Distributed under the terms of the GNU General Public License
......@@ -68,7 +68,7 @@
:c-return :void
:documentation "Set all elements to 0.")
(defmfun c-array:copy-to-destination
(defmfun grid:copy-to-destination
((source both) (destination both))
("gsl_" :category :type "_memcpy")
(((mpointer destination) :pointer) ((mpointer source) :pointer))
......@@ -76,7 +76,7 @@
:inputs (source)
:outputs (destination))
(defmfun c-array:copy-making-destination
(defmfun grid:copy-making-destination
((source both) &aux
(destination
(make-marray element-type :dimensions (dimensions source))))
......
;; Combinations
;; Liam Healy, Sun Mar 26 2006 - 11:51
;; Time-stamp: <2009-12-27 09:42:06EST combination.lisp>
;; Time-stamp: <2010-06-27 18:14:05EDT combination.lisp>
;;
;; Copyright 2006, 2007, 2008, 2009 Liam M. Healy
;; Distributed under the terms of the GNU General Public License
......@@ -26,7 +26,7 @@
;;;; Combination structure and CL object
;;;;****************************************************************************
(defclass combination (mobject c-array:foreign-array)
(defclass combination (mobject grid:foreign-array)
((element-type
:initform
#+int64 '(unsigned-byte 64)
......@@ -42,7 +42,7 @@
(setf (slot-value object 'mpointer)
mptr
(cffi:foreign-slot-value mptr 'gsl-combination-c 'data)
(c-pointer object)
(foreign-pointer object)
(cffi:foreign-slot-value mptr 'gsl-combination-c 'choice-of)
choice-of
(cffi:foreign-slot-value mptr 'gsl-combination-c 'size)
......@@ -89,7 +89,7 @@
"Initialize the combination c to the lexicographically
last combination, i.e. (n-k,n-k+1,...,n-1).")
(defmfun c-array:copy-to-destination ((source combination) (destination combination))
(defmfun grid:copy-to-destination ((source combination) (destination combination))
"gsl_combination_memcpy"
(((mpointer destination) :pointer)
((mpointer source) :pointer))
......
;; Copy marrays to/from CL arrays
;; Liam Healy 2009-02-11 19:28:44EST copy-cl.lisp
;; Time-stamp: <2009-12-27 09:42:05EST copy-cl.lisp>
;; Time-stamp: <2010-06-27 18:03:25EDT copy-cl.lisp>
;;
;; Copyright 2009 Liam M. Healy
;; Distributed under the terms of the GNU General Public License
......@@ -38,52 +38,52 @@
;;; These make destination but are methods of copy-to-destination so
;;; that the class argument may be supplied.
(defmethod c-array:copy-to-destination ((source mvector) (destination array))
(defmethod grid:copy-to-destination ((source mvector) (destination array))
(unless (equal (dimensions source) (array-dimensions destination))
(error 'c-array:array-mismatch))
(error 'grid:array-mismatch))
(loop for i below (dim0 source)
do (setf (aref destination i) (maref source i)))
destination)
(defmethod c-array:copy-to-destination ((source matrix) (destination array))
(defmethod grid:copy-to-destination ((source matrix) (destination array))
(unless (equal (dimensions source) (array-dimensions destination))
(error 'c-array:array-mismatch))
(error 'grid:array-mismatch))
(loop for i below (dim0 source) do
(loop for j below (dim1 source) do
(setf (aref destination i j) (maref source i j))))
destination)
(defmethod c-array:copy-to-destination ((source array) (destination mvector))
(defmethod grid:copy-to-destination ((source array) (destination mvector))
(unless (equal (array-dimensions source) (dimensions destination))
(error 'c-array:array-mismatch))
(error 'grid:array-mismatch))
(loop for i below (length source)
do (setf (maref destination i) (aref source i)))
destination)
(defmethod c-array:copy-to-destination ((source array) (destination matrix))
(defmethod grid:copy-to-destination ((source array) (destination matrix))
(unless (equal (array-dimensions source) (dimensions destination))
(error 'c-array:array-mismatch))
(error 'grid:array-mismatch))
(loop for i below (array-dimension source 0) do
(loop for j below (array-dimension source 1) do
(setf (maref destination i j) (aref source i j))))
destination)
(defmethod c-array:copy-to-destination ((source marray) (destclass (eql 'array)))
(defmethod grid:copy-to-destination ((source marray) (destclass (eql 'array)))
(let ((destination
(c-array:make-ffa (element-type source) :dimensions (dimensions source))))
(c-array:copy-to-destination source destination)))
(grid:make-ffa (element-type source) :dimensions (dimensions source))))
(grid:copy-to-destination source destination)))
;;; Copy to a named marray element-type, where the type is a symbol
(defmethod c-array:copy-to-destination ((source array) (destclass symbol))
(defmethod grid:copy-to-destination ((source array) (destclass symbol))
(let ((destination
(make-marray destclass :dimensions (array-dimensions source))))
(c-array:copy-to-destination source destination)))
(grid:copy-to-destination source destination)))
;;; Copy to a named marray element-type, where the type is a list
(defmethod c-array:copy-to-destination ((source array) (destclass list))
(defmethod grid:copy-to-destination ((source array) (destclass list))
(let ((destination
(make-marray destclass :dimensions (array-dimensions source))))
(c-array:copy-to-destination source destination)))
(grid:copy-to-destination source destination)))
;;; Examples and tests
......
;; A grid:foreign-array with added metadata for GSL.
;; Liam Healy 2008-04-06 21:23:41EDT
;; Time-stamp: <2010-06-27 08:48:58EDT foreign-array.lisp>
;; Time-stamp: <2010-06-27 18:27:37EDT foreign-array.lisp>
;;
;; Copyright 2008, 2009 Liam M. Healy
;; Distributed under the terms of the GNU General Public License
......@@ -88,15 +88,26 @@
`((grid:foreign-array ,@dimensions) element-type)
keys)))
(defun make-marray-or-default
(default dimensions
&optional dont-make-if-nil (element-type 'double-float) initial-element)
"If default is T or dont-make-if-nil, make a marray and
returned with the dimensions and element-type. If default is a
marray, it is returned."
(if (member default (list t dont-make-if-nil))
(if initial-element
(make-marray
element-type :dimensions dimensions :initial-element initial-element)
(make-marray element-type :dimensions dimensions))
default))
;;;;****************************************************************************
;;;; Make from GSL mpointers
;;;;****************************************************************************
;; Some functions in solve-minimize-fit return a pointer to a GSL
;; vector of double-floats. This function turns that into a
;; foreign-friendly array. There is no choice but to copy over the
;; data even on native implementations; because GSL is doing the
;; mallocing, the data are not CL-accessible.
;; vector of double-floats. This function turns it into a
;; foreign-array.
(defun make-foreign-array-from-mpointer
(mpointer &optional (element-type 'double-float) (category :vector))
......@@ -107,7 +118,7 @@
(:vector 'gsl-vector-c)
(:matrix 'gsl-matrix-c)
(t (error "Unrecognized category ~a" category))))
(c-pointer (cffi:foreign-slot-value mpointer cstruct 'data)))
(foreign-pointer (cffi:foreign-slot-value mpointer cstruct 'data)))
(grid:make-grid
(case category
(:vector
......@@ -118,25 +129,5 @@
,(cffi:foreign-slot-value mpointer cstruct size0)
,(cffi:foreign-slot-value mpointer cstruct size1)))
,element-type))
:foreign-pointer c-pointer
:foreign-pointer foreign-pointer
:foreign-metadata mpointer)))
;;;;****************************************************************************
;;;; Convenient defaulting of defmfun arguments
;;;;****************************************************************************
(defun make-marray-or-default
(default dimensions
&optional dont-make-if-nil (element-type 'double-float) initial-element)
"If default is T or dont-make-if-nil, make a marray and
returned with the dimensions and element-type. If default is a
marray, it is returned after being synced for non-native."
(if (member default (list t dont-make-if-nil))
(if initial-element
(make-marray
element-type :dimensions dimensions :initial-element initial-element)
(make-marray element-type :dimensions dimensions))
(progn #-native
(when (typep default 'marray)
(c-array:copy-cl-to-c default))
default)))
;; Get/set array or elements: cl-array, maref
;; Liam Healy 2008-08-27 22:43:10EDT maref.lisp
;; Time-stamp: <2009-12-27 09:42:05EST maref.lisp>
;; Time-stamp: <2010-06-27 18:03:27EDT maref.lisp>
;;
;; Copyright 2008, 2009 Liam M. Healy
;; Distributed under the terms of the GNU General Public License
......@@ -43,9 +43,9 @@
category tp)
,@ffrestargs
,@(if value-symbol
(list (c-array:cl-cffi tp) value-symbol)
(list (c-array:cl-cffi tp))))))
c-array:*array-element-types*)))
(list (grid:cl-cffi tp) value-symbol)
(list (grid:cl-cffi tp))))))
grid:*array-element-types*)))
(defgeneric maref (object index &optional index2 type)
(:documentation
......@@ -75,14 +75,14 @@
,(actual-gsl-function-name
`("gsl_" :category :type ,"_get")
'vector tp)))
c-array:*array-element-types*)
grid:*array-element-types*)
(mapcar (lambda (tp)
`(map-name
'maref
,(actual-gsl-function-name
`("gsl_" :category :type ,"_get")
'matrix tp)))
c-array:*array-element-types*)))
grid:*array-element-types*)))
(defgeneric (setf maref) (value object index &optional index2 type)
(:documentation
......@@ -113,11 +113,11 @@
,(actual-gsl-function-name
`("gsl_" :category :type ,"_set")
'vector tp)))
c-array:*array-element-types*)
grid:*array-element-types*)
(mapcar (lambda (tp)
`(map-name
'(setf maref)
,(actual-gsl-function-name
`("gsl_" :category :type ,"_set")
'matrix tp)))
c-array:*array-element-types*)))
grid:*array-element-types*)))
;; Matrices
;; Liam Healy 2008-04-15 21:57:52EDT matrix.lisp
;; Time-stamp: <2010-06-26 19:16:41EDT matrix.lisp>
;; Time-stamp: <2010-06-27 18:03:26EDT matrix.lisp>
;;
;; Copyright 2008, 2009 Liam M. Healy
;; Distributed under the terms of the GNU General Public License
......@@ -36,7 +36,7 @@
collect (loop for j below dim1
collect (maref pointer i j element-type)))))
(defmethod c-array:copy-to-destination
(defmethod grid:copy-to-destination
((object matrix) (pointer #.+foreign-pointer-class+))
(foreign-pointer-method
pointer
......
;; Permutations
;; Liam Healy, Sun Mar 26 2006 - 11:51
;; Time-stamp: <2009-12-27 09:42:03EST permutation.lisp>
;; Time-stamp: <2010-06-27 18:14:06EDT permutation.lisp>
;;
;; Copyright 2006, 2007, 2008, 2009 Liam M. Healy
;; Distributed under the terms of the GNU General Public License
......@@ -27,7 +27,7 @@
;;;; Permutation structure and CL object
;;;;****************************************************************************
(defclass permutation (mobject c-array:foreign-array)
(defclass permutation (mobject grid:foreign-array)
((element-type
:initform
#+int64 '(unsigned-byte 64)
......@@ -41,7 +41,7 @@
(setf (slot-value object 'mpointer)
mptr
(cffi:foreign-slot-value mptr 'gsl-permutation-c 'data)
(c-pointer object)
(foreign-pointer object)
(cffi:foreign-slot-value mptr 'gsl-permutation-c 'size)
dimensions)
(tg:finalize object (lambda () (cffi:foreign-free mptr)))))
......@@ -77,7 +77,7 @@
"Initialize the permutation p to the identity, i.e.
(0,1,2,...,n-1).")
(defmfun c-array:copy-to-destination ((source permutation) (destination permutation))
(defmfun grid:copy-to-destination ((source permutation) (destination permutation))
"gsl_permutation_memcpy"
(((mpointer destination) :pointer)
((mpointer source) :pointer))
......
;; Vectors
;; Liam Healy 2008-04-13 09:39:02EDT vector.lisp
;; Time-stamp: <2010-06-26 19:16:43EDT vector.lisp>
;; Time-stamp: <2010-06-27 18:03:25EDT vector.lisp>
;;
;; Copyright 2008, 2009 Liam M. Healy
;; Distributed under the terms of the GNU General Public License
......@@ -32,7 +32,7 @@
(loop for i below (cffi:foreign-slot-value pointer struct-type 'size)
collect (maref pointer i nil element-type)))
(defmethod c-array:copy-to-destination
(defmethod grid:copy-to-destination
((object mvector) (pointer #.+foreign-pointer-class+))
(foreign-pointer-method
pointer
......
......@@ -113,7 +113,7 @@ combination for which the following are supported:</p>
</li>
<li><a href="http://www.cliki.net/trivial-garbage">trivial-garbage</a>
<li><a href="http://repo.or.cz/w/gsd.git">GSD</a>, the <i>Grid Structured Data</i>; in particular,
the <code>c-array</code> and <code>grid</code> systems</li>
the <code>foreign-array</code> and <code>grid</code> systems</li>
<li><a href="http://common-lisp.net/project/cl-utilities/">cl-utilities</a>
</li>
<li><a href="http://www.cliki.net/asdf">ASDF</a></li>
......@@ -161,7 +161,7 @@ can be used to browse or retrieve a compressed tarball (click the most
recent "snapshot" link).
You will need to make a link
of <code>gsll.asd</code>, <code>grid.asd</code>,
<code>c-array.asd</code>, and
<code>foreign-array.asd</code>, and
optionally <code>gsll-tests.asd</code> and
<code>fsbv.asd</code>
to some directory known to ASDF.
......@@ -283,7 +283,7 @@ GSLL has many functions that work on vectors (one-dimensional arrays)
and matrices (two-dimensional arrays). GSLL supports all array
element types that are supported by CFFI, the CL implementation,
GSL, and the platform. This list is available in the
variable <code>c-array:*array-element-types*</code>. On implementations that
variable <code>grid:*array-element-types*</code>. On implementations that
support it (currently only SBCL), the contents are directly available
to the GSL functions without copying between the Lisp area and the C
area of memory.</p>
......@@ -472,7 +472,7 @@ and arrays used internally or for function return.
<!-- Created: Feb 25 2005 -->
<!-- hhmts start -->
<small>
Time-stamp: <2010-06-08 12:58:19EDT index.html>
Time-stamp: <2010-06-27 18:05:50EDT index.html>
</small>
<!-- hhmts end -->
</div>
......
;; Backward FFT
;; Sumant Oemrawsingh, Sat Oct 24 2009 - 12:55
;; Time-stamp: <2009-12-27 09:45:34EST backward.lisp>
;; Time-stamp: <2010-06-27 18:13:59EDT backward.lisp>
;;
;; Copyright 2009 Sumant Oemrawsingh, Liam M. Healy
;; Distributed under the terms of the GNU General Public License
......@@ -33,7 +33,7 @@
(defmfun backward-fourier-transform-radix2
((vector vector) &key (stride 1))
("gsl_fft" :type "_radix2_backward")
(((c-pointer vector) :pointer) (stride sizet) ((floor (size vector) stride) sizet))
(((foreign-pointer vector) :pointer) (stride sizet) ((floor (size vector) stride) sizet))
:definition :generic
:element-types :complex
:inputs (vector)
......@@ -49,7 +49,7 @@
(wavetable (make-fft-wavetable element-type (floor (size vector) stride)))
(workspace (make-fft-workspace element-type (floor (size vector) stride))))
("gsl_fft" :type "_backward")
(((c-pointer vector) :pointer) (stride sizet) ((floor (size vector) stride) sizet)
(((foreign-pointer vector) :pointer) (stride sizet) ((floor (size vector) stride) sizet)
((mpointer wavetable) :pointer) ((mpointer workspace) :pointer))
:definition :generic
:element-types :complex
......@@ -69,7 +69,7 @@
(defmfun backward-fourier-transform-halfcomplex-radix2
((vector vector) &key (stride 1))
("gsl_fft_halfcomplex" :type "_radix2_backward")
(((c-pointer vector) :pointer) (stride sizet) ((floor (size vector) stride) sizet))
(((foreign-pointer vector) :pointer) (stride sizet) ((floor (size vector) stride) sizet))
:definition :generic
:element-types :float
:inputs (vector)
......@@ -86,7 +86,7 @@
(wavetable (make-fft-wavetable element-type (floor (size vector) stride) t))
(workspace (make-fft-workspace element-type (floor (size vector) stride))))
("gsl_fft_halfcomplex" :type "_backward")
(((c-pointer vector) :pointer) (stride sizet) ((floor (size vector) stride) sizet)
(((foreign-pointer vector) :pointer) (stride sizet) ((floor (size vector) stride) sizet)
((mpointer wavetable) :pointer) ((mpointer workspace) :pointer))
:definition :generic
:element-types :float
......@@ -106,7 +106,7 @@
(defmfun backward-fourier-transform-dif-radix2
((vector vector) &key (stride 1))
("gsl_fft" :type "_radix2_dif_backward")
(((c-pointer vector) :pointer) (stride sizet) ((floor (size vector) stride) sizet))
(((foreign-pointer vector) :pointer) (stride sizet) ((floor (size vector) stride) sizet))
:definition :generic
:element-types :complex
:inputs (vector)
......
;; Discrete Fourier Transforms
;; Liam Healy 2009-11-07 14:24:07EST
;; Time-stamp: <2009-12-27 09:45:34EST discrete.lisp>
;; Time-stamp: <2010-06-27 18:13:59EDT discrete.lisp>
;;
;; Copyright 2009 Liam M. Healy
;; Distributed under the terms of the GNU General Public License
......@@ -31,8 +31,8 @@
&key (stride 1)
(result (make-marray element-type :dimensions (dimensions vector))))
("gsl_dft" :type "_forward")
(((c-pointer vector) :pointer) (stride sizet) ((floor (size vector) stride) sizet)
((c-pointer result) :pointer))
(((foreign-pointer vector) :pointer) (stride sizet) ((floor (size vector) stride) sizet)
((foreign-pointer result) :pointer))
:definition :generic
:element-types :complex
:inputs (vector)
......@@ -47,8 +47,8 @@
&key (stride 1)
(result (make-marray element-type :dimensions (dimensions vector))))
("gsl_dft" :type "_backward")
(((c-pointer vector) :pointer) (stride sizet) ((floor (size vector) stride) sizet)
((c-pointer result) :pointer))
(((foreign-pointer vector) :pointer) (stride sizet) ((floor (size vector) stride) sizet)
((foreign-pointer result) :pointer))
:definition :generic
:element-types :complex
:inputs (vector)
......@@ -63,8 +63,8 @@
&key (stride 1)
(result (make-marray element-type :dimensions (dimensions vector))))
("gsl_dft" :type "_inverse")
(((c-pointer vector) :pointer) (stride sizet) ((floor (size vector) stride) sizet)
((c-pointer result) :pointer))
(((foreign-pointer vector) :pointer) (stride sizet) ((floor (size vector) stride) sizet)
((foreign-pointer result) :pointer))
:definition :generic
:element-types :complex
:inputs (vector)
......@@ -79,8 +79,8 @@
&key (stride 1)
(result (make-marray element-type :dimensions (dimensions vector))))
("gsl_dft" :type "_transform")
(((c-pointer vector) :pointer) (stride sizet) ((floor (size vector) stride) sizet)
((c-pointer result) :pointer))
(((foreign-pointer vector) :pointer) (stride sizet) ((floor (size vector) stride) sizet)
((foreign-pointer result) :pointer))
:definition :generic
:element-types :complex
:inputs (vector)
......
;; Example FFT: transform a pulse (using the "clean" fft interface)
;; Sumant Oemrawsingh, Sat Oct 31 2009 - 00:24
;; Time-stamp: <2009-12-27 09:45:34EST example.lisp>
;; Time-stamp: <2010-06-27 18:03:24EDT example.lisp>
;;
;; Copyright 2009 Sumant Oemrawsingh, Liam M. Healy
;; Distributed under the terms of the GNU General Public License
......@@ -76,7 +76,7 @@
;; (make-urand-vector '(complex double-float) 5)
(defun make-urand-vector (element-type dimension &key (stride 1))
"Make a vector with random elements."
(let ((vec (make-marray `(complex ,(c-array:component-float-type element-type))
(let ((vec (make-marray `(complex ,(grid:component-float-type element-type))
:dimensions (list (* stride dimension)))))
(loop for i from 0 below (* stride dimension) by stride
do
......@@ -90,7 +90,7 @@
"The real vector consisting of the real part of the complex vector."
(let ((real-vector
(make-marray
(c-array:component-float-type (element-type complex-vector))
(grid:component-float-type (element-type complex-vector))
:dimensions (dimensions complex-vector))))
(loop for i below (total-size complex-vector) do
(setf (maref real-vector i)
......
;; Forward FFT.
;; Sumant Oemrawsingh, Sat Oct 31 2009 - 23:48
;; Time-stamp: <2009-12-27 09:45:33EST forward.lisp>
;; Time-stamp: <2010-06-27 18:13:58EDT forward.lisp>
;;
;; Copyright 2009 Sumant Oemrawsingh, Liam M. Healy
;; Distributed under the terms of the GNU General Public License
......@@ -37,7 +37,7 @@
single-float "gsl_fft_real_float_radix2_transform"
complex-double-float "gsl_fft_complex_radix2_forward"
complex-single-float "gsl_fft_complex_float_radix2_forward")
(((c-pointer vector) :pointer) (stride sizet) ((floor (size vector) stride) sizet))
(((foreign-pointer vector) :pointer) (stride sizet) ((floor (size vector) stride) sizet))
:definition :generic
:element-types :float-complex
:inputs (vector)
......@@ -56,7 +56,7 @@
single-float "gsl_fft_real_float_transform"
complex-double-float "gsl_fft_complex_forward"
complex-single-float "gsl_fft_complex_float_forward")
(((c-pointer vector) :pointer) (stride sizet) ((floor (size vector) stride) sizet)
(((foreign-pointer vector) :pointer) (stride sizet) ((floor (size vector) stride) sizet)
((mpointer wavetable) :pointer) ((mpointer workspace) :pointer))
:definition :generic
:element-types :float-complex
......@@ -75,7 +75,7 @@
(defmfun forward-fourier-transform-halfcomplex-radix2
((vector vector) &key (stride 1))
("gsl_fft_halfcomplex" :type "_radix2_transform")
(((c-pointer vector) :pointer) (stride sizet) ((floor (size vector) stride) sizet))
(((foreign-pointer vector) :pointer) (stride sizet) ((floor (size vector) stride) sizet))
:definition :generic
:element-types :float
:inputs (vector)
......@@ -92,7 +92,7 @@
(wavetable (make-fft-wavetable element-type (floor (size vector) stride) t))
(workspace (make-fft-workspace element-type (floor (size vector) stride))))
("gsl_fft_halfcomplex" :type "_transform")
(((c-pointer vector) :pointer) (stride sizet) ((floor (size vector) stride) sizet)
(((foreign-pointer vector) :pointer) (stride sizet) ((floor (size vector) stride) sizet)
((mpointer wavetable) :pointer) ((mpointer workspace) :pointer))
:definition :generic
:element-types :float
......@@ -111,7 +111,7 @@
(defmfun forward-fourier-transform-dif-radix2 ((vector vector) &key (stride 1))
("gsl_fft" :type "_radix2_dif_forward")
(((c-pointer vector) :pointer) (stride sizet) ((floor (size vector) stride) sizet))
(((foreign-pointer vector) :pointer) (stride sizet) ((floor (size vector) stride) sizet))
:definition :generic
:element-types :complex
:inputs (vector)
......
;; Inverse FFT
;; Sumant Oemrawsingh, Sat Oct 24 2009 - 12:55
;; Time-stamp: <2009-12-27 09:45:33EST inverse.lisp>
;; Time-stamp: <2010-06-27 18:14:00EDT inverse.lisp>
;;
;; Copyright 2009 Sumant Oemrawsingh, Liam M. Healy
;; Distributed under the terms of the GNU General Public License
......@@ -33,7 +33,7 @@
(defmfun inverse-fourier-transform-radix2
((vector vector) &key (stride 1))
("gsl_fft" :type "_radix2_inverse")
(((c-pointer vector) :pointer) (stride sizet) ((floor (size vector) stride) sizet))
(((foreign-pointer vector) :pointer) (stride sizet) ((floor (size vector) stride) sizet))
:definition :generic
:element-types :complex
:inputs (vector)
......@@ -49,7 +49,7 @@
(wavetable (make-fft-wavetable element-type (floor (size vector) stride)))
(workspace (make-fft-workspace element-type (floor (size vector) stride))))
("gsl_fft" :type "_inverse")
(((c-pointer vector) :pointer) (stride sizet) ((floor (size vector) stride) sizet)
(((foreign-pointer vector) :pointer) (stride sizet) ((floor (size vector) stride) sizet)
((mpointer wavetable) :pointer) ((mpointer workspace) :pointer))
:definition :generic
:element-types :complex
......@@ -69,7 +69,7 @@
(defmfun inverse-fourier-transform-halfcomplex-radix2
((vector vector) &key (stride 1))
("gsl_fft_halfcomplex" :type "_radix2_inverse")
(((c-pointer vector) :pointer) (stride sizet) ((floor (size vector) stride) sizet))
(((foreign-pointer vector) :pointer) (stride sizet) ((floor (size vector) stride) sizet))
:definition :generic
:element-types :float
:inputs (vector)
......@@ -86,7 +86,7 @@
(wavetable (make-fft-wavetable element-type (floor (size vector) stride) t))
(workspace (make-fft-workspace element-type (floor (size vector) stride))))
("gsl_fft_halfcomplex" :type "_inverse")
(((c-pointer vector) :pointer) (stride sizet) ((floor (size vector) stride) sizet)
(((foreign-pointer vector) :pointer) (stride sizet) ((floor (size vector) stride) sizet)
((mpointer wavetable) :pointer) ((mpointer workspace) :pointer))
:definition :generic
:element-types :float
......@@ -106,7 +106,7 @@
(defmfun inverse-fourier-transform-dif-radix2
((vector vector) &key (stride 1))
("gsl_fft" :type "_radix2_dif_inverse")
(((c-pointer vector) :pointer) (stride sizet) ((floor (size vector) stride) sizet))
(((foreign-pointer vector) :pointer) (stride sizet) ((floor (size vector) stride) sizet))
:definition :generic
:element-types :complex
:inputs (vector)
......
;; FFT where direction is selected.
;; Sumant Oemrawsingh, Sat Oct 24 2009 - 12:55
;; Time-stamp: <2009-12-27 09:45:32EST select-direction.lisp>
;; Time-stamp: <2010-06-27 18:13:58EDT select-direction.lisp>
;;
;; Copyright 2009 Sumant Oemrawsingh, Liam M. Healy
;; Distributed under the terms of the GNU General Public License
......@@ -26,7 +26,7 @@
(defmfun fourier-transform-radix2
((vector vector) direction &key (stride 1) (n (expt 2 (floor (log (size vector) 2)))))
("gsl_fft" :type "_radix2_transform")
(((c-pointer vector) :pointer) (stride sizet) (n sizet) (direction fft-direction))
(((foreign-pointer vector) :pointer) (stride sizet) (n sizet) (direction fft-direction))
:definition :generic
:element-types :complex
:inputs (vector)
......@@ -40,7 +40,7 @@
(defmfun fourier-transform-dif-radix2
((vector vector) direction &key (stride 1) (n (expt 2 (floor (log (size vector) 2)))))
("gsl_fft" :type "_radix2_dif_transform")
(((c-pointer vector) :pointer) (stride sizet) (n sizet) (direction fft-direction))
(((foreign-pointer vector) :pointer) (stride sizet) (n sizet) (direction fft-direction))
:definition :generic
:element-types :complex
:inputs (vector)
......
;; Unpack functions for FFT vectors.
;; Sumant Oemrawsingh, Sun Oct 25 2009 - 16:35
;; Time-stamp: <2009-12-27 09:45:32EST unpack.lisp>
;; Time-stamp: <2010-06-27 18:14:00EDT unpack.lisp>
;;
;; Copyright 2009 Sumant Oemrawsingh, Liam M. Healy
;; Distributed under the terms of the GNU General Public License
......@@ -34,8 +34,8 @@
t
(make-marray '(complex double-float) :dimensions (size vector)))))
("gsl_fft_real" :type "_unpack")
(((c-pointer vector) :pointer)
((c-pointer output) :pointer)
(((foreign-pointer vector) :pointer)
((foreign-pointer output) :pointer)
(stride sizet) ((floor (size vector) stride) sizet))
:definition :generic
:element-types :float
......@@ -58,8 +58,8 @@
t