Commit 8e3ede1a authored by Liam Healy's avatar Liam Healy
Browse files

Removed definitions to foreign-array

parent e9f09f02
;; A "marray" is an array in both GSL and CL
;; Liam Healy 2008-04-06 21:23:41EDT
;; Time-stamp: <2010-06-24 20:03:33EDT marray.lisp>
;; Time-stamp: <2010-06-26 19:11:23EDT marray.lisp>
;;
;; Copyright 2008, 2009 Liam M. Healy
;; Distributed under the terms of the GNU General Public License
......@@ -84,40 +84,6 @@
(set-struct-array-pointer object)
(call-next-method))
;;;;****************************************************************************
;;;; Definition of specific data classes
;;;;****************************************************************************
(defparameter *class-element-type* nil
"The mapping between the class name and the CL element type.")
(defun data-class-name (category element-type)
"The class name from the type of element."
;; e.g. (data-class-name 'vector '(unsigned-byte 8))
;; -> VECTOR-UNSIGNED-BYTE-8
(if (member category '(vector matrix))
(intern (format nil "~:@(~a-~a~)"
category (c-array:cl-single element-type :gsl))
:gsl)
category))
(defun data-defclass (category superclass)
"Define all the subclasses based on the known element types."
(cons 'progn
(mapcan
(lambda (element-type-cl)
(let* ((class-name (data-class-name category element-type-cl)))
;; Define the class
`((defclass ,class-name
(,superclass)
((element-type :initform ',element-type-cl
:allocation :class)))
;; Push mapping onto *class-element-type*
(pushnew ',(cons class-name element-type-cl)
*class-element-type* :test #'equal)
(export ',class-name))))
c-array:*array-element-types*)))
;;;;****************************************************************************
;;;; Make data from either the dimensions provided or from the initial values
;;;;****************************************************************************
......
;; Matrices
;; Liam Healy 2008-04-15 21:57:52EDT matrix.lisp
;; Time-stamp: <2009-12-27 09:42:04EST matrix.lisp>
;; Time-stamp: <2010-06-26 19:16:41EDT matrix.lisp>
;;
;; Copyright 2008, 2009 Liam M. Healy
;; Distributed under the terms of the GNU General Public License
......@@ -26,14 +26,6 @@
;;;; Matrix structure and CL object
;;;;****************************************************************************
(export 'matrix)
(defclass matrix (marray)
()
(:documentation "GSL matrices."))
;;; Define all supported matrix subclasses
#.(data-defclass 'matrix 'matrix)
(defmethod contents-from-pointer
(pointer (struct-type (eql 'gsl-matrix-c))
&optional (element-type 'double-float))
......
;; Vectors
;; Liam Healy 2008-04-13 09:39:02EDT vector.lisp
;; Time-stamp: <2009-12-27 09:42:03EST vector.lisp>
;; Time-stamp: <2010-06-26 19:16:43EDT vector.lisp>
;;
;; Copyright 2008, 2009 Liam M. Healy
;; Distributed under the terms of the GNU General Public License
......@@ -26,14 +26,6 @@
;;;; Vector structure, CL object, and allocation
;;;;****************************************************************************
(export 'mvector)
(defclass mvector (marray)
()
(:documentation "GSL vectors."))
;;; Define all supported mvector subclasses
#.(data-defclass 'vector 'mvector)
(defmethod contents-from-pointer
(pointer (struct-type (eql 'gsl-vector-c))
&optional (element-type 'double-float))
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment