diff --git a/data/both.lisp b/data/both.lisp index 3afc593c14aebe0ec199e9024056acae82601836..e65f4dece1b4906c8686a0c395d784db080cef8a 100644 --- a/data/both.lisp +++ b/data/both.lisp @@ -1,6 +1,6 @@ ;; Functions for both vectors and matrices. ;; Liam Healy 2008-04-26 20:48:44EDT both.lisp -;; Time-stamp: <2010-06-29 22:12:07EDT both.lisp> +;; Time-stamp: <2010-07-01 19:38:01EDT both.lisp> ;; ;; Copyright 2008, 2009 Liam M. Healy ;; Distributed under the terms of the GNU General Public License @@ -28,7 +28,7 @@ ("gsl_" :category :type "_alloc_from_block") ((blockptr :pointer) (0 sizet) ; offset - ((total-size object) sizet) ; number of elements + ((size object) sizet) ; number of elements (1 sizet)) ; stride :definition :generic :c-return :pointer diff --git a/data/foreign-array.lisp b/data/foreign-array.lisp index c16e31555d5edfa830d14451e2616c0929096ff3..b59ae3a48536421aa5f7e5a551df96d008a61e2a 100644 --- a/data/foreign-array.lisp +++ b/data/foreign-array.lisp @@ -1,6 +1,6 @@ ;; A grid:foreign-array with added metadata for GSL. ;; Liam Healy 2008-04-06 21:23:41EDT -;; Time-stamp: <2010-06-30 18:03:10EDT foreign-array.lisp> +;; Time-stamp: <2010-07-01 19:38:35EDT foreign-array.lisp> ;; ;; Copyright 2008, 2009, 2010 Liam M. Healy ;; Distributed under the terms of the GNU General Public License @@ -21,7 +21,7 @@ (in-package :gsl) ;;;;**************************************************************************** -;;;; Make the mpointer, block-pointer, total-size metadata +;;;; Make the mpointer, block-pointer, size metadata ;;;;**************************************************************************** ;;; We don't allocate or free the C array data, because that is @@ -38,11 +38,11 @@ it is called on a particular foreign-array." ;; Don't do anything if mpointer has already been assigned. (unless (grid:metadata-slot object 'mpointer) - (when (zerop (total-size object)) + (when (zerop (size object)) (error "Object ~a has zero total dimension." object)) (let ((blockptr (cffi:foreign-alloc 'gsl-block-c))) (setf (cffi:foreign-slot-value blockptr 'gsl-block-c 'size) - (grid:total-size object) + (size object) (cffi:foreign-slot-value blockptr 'gsl-block-c 'data) (foreign-pointer object) (grid:metadata-slot object 'block-pointer) blockptr) diff --git a/fast-fourier-transforms/example.lisp b/fast-fourier-transforms/example.lisp index b758485930a37acd901861ac498253d98db74577..7cbfce3e15d670964df2c881973038397d61dc02 100644 --- a/fast-fourier-transforms/example.lisp +++ b/fast-fourier-transforms/example.lisp @@ -1,6 +1,6 @@ ;; Example FFT: transform a pulse (using the "clean" fft interface) ;; Sumant Oemrawsingh, Sat Oct 31 2009 - 00:24 -;; Time-stamp: <2010-06-30 19:57:28EDT example.lisp> +;; Time-stamp: <2010-07-01 19:38:50EDT example.lisp> ;; ;; Copyright 2009 Sumant Oemrawsingh, Liam M. Healy ;; Distributed under the terms of the GNU General Public License @@ -92,7 +92,7 @@ (grid:make-foreign-array (grid:component-float-type (element-type complex-vector)) :dimensions (dimensions complex-vector)))) - (loop for i below (total-size complex-vector) do + (loop for i below (size complex-vector) do (setf (grid:gref real-vector i) (realpart (grid:gref complex-vector i)))) real-vector)) diff --git a/init/init.lisp b/init/init.lisp index c933199db7f8780d4b7c90e329666a030ff1a895..bb91c11be00db86339a744120c2b6716a067f846 100644 --- a/init/init.lisp +++ b/init/init.lisp @@ -1,6 +1,6 @@ ;; Load GSL ;; Liam Healy Sat Mar 4 2006 - 18:53 -;; Time-stamp: <2010-06-29 21:09:24EDT init.lisp> +;; Time-stamp: <2010-07-01 19:36:05EDT init.lisp> ;; ;; Copyright 2006, 2007, 2008, 2009 Liam M. Healy ;; Distributed under the terms of the GNU General Public License @@ -23,13 +23,13 @@ (:use :common-lisp :cffi) (:import-from :grid - #:cl-array #:dimensions #:total-size #:element-type + #:cl-array #:dimensions #:element-type #:foreign-array #:matrix #:dim0 #:dim1 #:^ ; #:copy #:clone ) (:shadowing-import-from :grid #:foreign-pointer) (:export - #:cl-array #:dimensions #:total-size #:element-type #:dim0 #:dim1 + #:cl-array #:dimensions #:element-type #:dim0 #:dim1 #:copy #:clone)) (cffi:define-foreign-library libgslcblas diff --git a/init/mobject.lisp b/init/mobject.lisp index f675a2dabcde4b48b2913a4a0ae629faa9c414f8..f21c7f41ecc75ee5f673fc0efd4ead5c11f64975 100644 --- a/init/mobject.lisp +++ b/init/mobject.lisp @@ -1,6 +1,6 @@ ;; Definition of GSL objects and ways to use them. ;; Liam Healy, Sun Dec 3 2006 - 10:21 -;; Time-stamp: <2010-06-29 22:51:18EDT mobject.lisp> +;; Time-stamp: <2010-07-01 19:37:25EDT mobject.lisp> ;; ;; Copyright 2006, 2007, 2008, 2009 Liam M. Healy ;; Distributed under the terms of the GNU General Public License @@ -309,7 +309,9 @@ (defgeneric size (object) (:documentation "The size of the GSL object.") (:method ((object array)) - (array-total-size object))) + (array-total-size object)) + (:method ((object grid:foreign-array)) + (grid:total-size object))) (export 'evaluate) (defgeneric evaluate (object point &key #+sbcl &allow-other-keys) diff --git a/tests/scale.lisp b/tests/scale.lisp index 5b071308ebc395d4e4e92480a34d5aa59090ae77..d015c20e431fe4e29660c36e7f3d85a6655572e4 100644 --- a/tests/scale.lisp +++ b/tests/scale.lisp @@ -30,10 +30,9 @@ (GRID:MAKE-FOREIGN-ARRAY '(COMPLEX SINGLE-FLOAT) :INITIAL-CONTENTS - '(-34.5 8.24 3.29 -8.93 34.12 - -6.15 49.27 -13.49 32.5 42.73 - -17.24 43.31 -16.12 -8.25 21.44 - -49.08))) + '(#C(-34.5 8.24) #C(3.29 -8.93) #C(34.12 -6.15) + #C(49.27 -13.49) #C(32.5 42.73) + #C(-17.24 43.31) #C(-16.12 -8.25) #C(21.44 -49.08)))) (SCALAR 32.5)) (CL-ARRAY (SCALE SCALAR V1))))) (LISP-UNIT::ASSERT-NUMERICAL-EQUAL @@ -61,7 +60,7 @@ (GRID:MAKE-FOREIGN-ARRAY 'SINGLE-FLOAT :INITIAL-CONTENTS - '(#C(-34.5 8.24) #C(3.29 -8.93) #C(34.12 -6.15) #C(49.27 -13.49)))) + '(-34.5 8.24 3.29 -8.93 34.12 -6.15 49.27 -13.49))) (SCALAR 32.5)) (CL-ARRAY (SCALE SCALAR V1))))) (LISP-UNIT::ASSERT-NUMERICAL-EQUAL @@ -73,8 +72,8 @@ (LET ((V1 (GRID:MAKE-FOREIGN-ARRAY 'DOUBLE-FLOAT :INITIAL-CONTENTS - '(#C(-34.5d0 8.24d0) #C(3.29d0 -8.93d0) - #C(34.12d0 -6.15d0) #C(49.27d0 -13.49d0)))) + '(-34.5d0 8.24d0 3.29d0 -8.93d0 + 34.12d0 -6.15d0 49.27d0 -13.49d0))) (SCALAR 32.5d0)) (CL-ARRAY (SCALE SCALAR V1))))) #+fsbv diff --git a/tests/setf-row.lisp b/tests/setf-row.lisp index fb487d45e5883f3e448b2209221a53d6a79d4851..6c6e332d7b083ffe9d4e337b903c0297d356294d 100644 --- a/tests/setf-row.lisp +++ b/tests/setf-row.lisp @@ -93,7 +93,8 @@ (ROW (GRID:MAKE-FOREIGN-ARRAY '(COMPLEX DOUBLE-FLOAT) - :INITIAL-CONTENTS '(42.73d0 -17.24d0 43.31d0 -16.12d0 -8.25d0 21.44d0)))) + :INITIAL-CONTENTS + '(#C(42.73d0 -17.24d0) #C(43.31d0 -16.12d0) #C(-8.25d0 21.44d0))))) (SETF (ROW M1 2) ROW) (CL-ARRAY M1)))) (LISP-UNIT::ASSERT-NUMERICAL-EQUAL