From eebc5a48b581b6a5f5f01851e855010676c64d51 Mon Sep 17 00:00:00 2001 From: Liam Healy <liam@thinkpad.local> Date: Tue, 29 Jun 2010 21:49:10 -0400 Subject: [PATCH] All compiles using foreign-array All of GSLL now compiles using foreign-array; only the copy functions have been commented out. --- chebyshev.lisp | 7 ++++--- data/foreign-array.lisp | 8 +++++--- gsll.asd | 24 ++---------------------- histogram/histogram.lisp | 5 +++-- init/init.lisp | 4 ++-- linear-algebra/matrix-generation.lisp | 8 ++++---- polynomial.lisp | 8 ++++---- random/generators.lisp | 4 +++- random/quasi.lisp | 4 +++- 9 files changed, 30 insertions(+), 42 deletions(-) diff --git a/chebyshev.lisp b/chebyshev.lisp index ce16b2eb..f17eca4b 100644 --- a/chebyshev.lisp +++ b/chebyshev.lisp @@ -1,8 +1,8 @@ ;; Chebyshev Approximations ;; Liam Healy Sat Nov 17 2007 - 20:36 -;; Time-stamp: <2010-06-27 18:03:23EDT chebyshev.lisp> +;; Time-stamp: <2010-06-29 21:47:34EDT chebyshev.lisp> ;; -;; Copyright 2007, 2008, 2009 Liam M. Healy +;; Copyright 2007, 2008, 2009, 2010 Liam M. Healy ;; Distributed under the terms of the GNU General Public License ;; ;; This program is free software: you can redistribute it and/or modify @@ -60,7 +60,8 @@ :c-return (crtn :pointer) :documentation "The Chebyshev coefficient array as a CL array (foreign-friendly)." - :return ((grid:copy-foreign-vector crtn (size chebyshev))) + :return ((grid:make-foreign-array-from-pointer + crtn (list (size chebyshev)) 'double-float t)) :gsl-version (1 12)) ;;;;**************************************************************************** diff --git a/data/foreign-array.lisp b/data/foreign-array.lisp index 944d5063..4692c956 100644 --- a/data/foreign-array.lisp +++ b/data/foreign-array.lisp @@ -1,8 +1,8 @@ ;; A grid:foreign-array with added metadata for GSL. ;; Liam Healy 2008-04-06 21:23:41EDT -;; Time-stamp: <2010-06-27 22:21:12EDT foreign-array.lisp> +;; Time-stamp: <2010-06-29 21:41:40EDT foreign-array.lisp> ;; -;; Copyright 2008, 2009 Liam M. Healy +;; Copyright 2008, 2009, 2010 Liam M. Healy ;; Distributed under the terms of the GNU General Public License ;; ;; This program is free software: you can redistribute it and/or modify @@ -83,7 +83,7 @@ (error "Can't take a class name here anymore, sorry.")) (apply 'grid:make-grid - `((grid:foreign-array ,@dimensions) ,element-type) + `((grid:foreign-array ,@(alexandria:ensure-list dimensions)) ,element-type) keys)) (defun make-marray-or-default @@ -129,3 +129,5 @@ ,element-type))) :foreign-pointer foreign-pointer :foreign-metadata mpointer))) + +(defun make-foreign-array-from-pointer ()) diff --git a/gsll.asd b/gsll.asd index b4acbe94..3e5133ef 100644 --- a/gsll.asd +++ b/gsll.asd @@ -1,6 +1,6 @@ ;; Definition of GSLL system ;; Liam Healy -;; Time-stamp: <2010-06-29 19:26:27EDT gsll.asd> +;; Time-stamp: <2010-06-29 21:42:42EDT gsll.asd> ;; ;; Copyright 2006, 2007, 2008, 2009 Liam M. Healy ;; Distributed under the terms of the GNU General Public License @@ -81,11 +81,8 @@ ;(:file "copy-cl") (:file "array-tests" :depends-on ("both")) (:file "permutation" :depends-on ("foreign-array" "array-structs")) - (:file "combination" :depends-on ("foreign-array" "array-structs")) - )) - #+(or) + (:file "combination" :depends-on ("foreign-array" "array-structs")))) (:file "polynomial" :depends-on (init data)) - #+(or) (:module special-functions :depends-on (init) :components @@ -120,9 +117,7 @@ (:file "transport" :depends-on ("return-structures")) (:file "trigonometry" :depends-on ("return-structures")) (:file "zeta" :depends-on ("return-structures")))) - #+(or) (:file "sorting" :depends-on (init data)) - #+(or) (:module linear-algebra :depends-on (init data special-functions) :components @@ -138,7 +133,6 @@ (:file "cholesky") (:file "diagonal") (:file "householder"))) - #+(or) (:module eigensystems :depends-on (init data) :components @@ -147,7 +141,6 @@ (:file "nonsymmetric" :depends-on ("eigen-struct")) (:file "generalized") (:file "nonsymmetric-generalized"))) - #+(or) (:module fast-fourier-transforms :depends-on (init data) :components @@ -160,7 +153,6 @@ (:file "discrete") (:file "extras") (:file "example"))) - #+(or) (:module random :depends-on (init data) :components @@ -203,7 +195,6 @@ (:file "hypergeometric" :depends-on ("rng-types")) (:file "logarithmic" :depends-on ("rng-types")) (:file "shuffling-sampling" :depends-on ("rng-types")))) - #+(or) (:module statistics :depends-on (init data) :components @@ -214,7 +205,6 @@ (:file "covariance") ;; minimum and maximum values provided in vector.lisp (:file "median-percentile"))) - #+(or) (:module histogram :depends-on (init linear-algebra random) :components @@ -224,7 +214,6 @@ (:file "operations" :depends-on ("histogram")) (:file "probability-distribution" :depends-on ("histogram")) (:file "ntuple"))) - #+(or) (:module calculus :depends-on (init data random) :components @@ -234,7 +223,6 @@ (cffi-grovel:grovel-file "monte-carlo-structs") (:file "monte-carlo") (:file "numerical-differentiation"))) - #+(or) (:module ordinary-differential-equations :depends-on (init) :components @@ -244,7 +232,6 @@ (:file "control") (:file "evolution") (:file "ode-example" :depends-on ("ode-system" "stepping")))) - #+(or) (:module interpolation :depends-on (init) :components @@ -253,17 +240,11 @@ (:file "lookup") (:file "evaluation") (:file "spline-example" :depends-on ("types")))) - #+(or) (:file "chebyshev" :depends-on (init)) - #+(or) (cffi-grovel:grovel-file "series-struct") - #+(or) (:file "series-acceleration" :depends-on (init "series-struct")) - #+(or) (:file "wavelet" :depends-on (init data)) - #+(or) (:file "hankel" :depends-on (init data)) - #+(or) (:module solve-minimize-fit :depends-on (init data random) :components @@ -278,7 +259,6 @@ :depends-on ("generic" "solver-struct")) #+fsbv (:file "simulated-annealing"))) - #+(or) (:file "basis-splines" :depends-on (init data random)) (:module physical-constants :depends-on (init) diff --git a/histogram/histogram.lisp b/histogram/histogram.lisp index 4ca778ba..29fe3835 100644 --- a/histogram/histogram.lisp +++ b/histogram/histogram.lisp @@ -1,6 +1,6 @@ ;; The histogram structure ;; Liam Healy, Mon Jan 1 2007 - 11:32 -;; Time-stamp: <2010-06-27 18:13:52EDT histogram.lisp> +;; Time-stamp: <2010-06-29 21:18:58EDT histogram.lisp> ;; ;; Copyright 2007, 2008, 2009 Liam M. Healy ;; Distributed under the terms of the GNU General Public License @@ -79,6 +79,7 @@ :definition :method :return (histogram)) +#| (defmfun grid:copy-to-destination ((source histogram) (destination histogram)) "gsl_histogram_memcpy" (((mpointer destination) :pointer) ((mpointer source) :pointer)) @@ -116,4 +117,4 @@ :definition :method :c-return :pointer :index copy) - +|# diff --git a/init/init.lisp b/init/init.lisp index 77291c1d..c933199d 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-27 21:28:45EDT init.lisp> +;; Time-stamp: <2010-06-29 21:09:24EDT init.lisp> ;; ;; Copyright 2006, 2007, 2008, 2009 Liam M. Healy ;; Distributed under the terms of the GNU General Public License @@ -24,7 +24,7 @@ (:import-from :grid #:cl-array #:dimensions #:total-size #:element-type - #:foreign-array #:matrix #:dim0 #:dim1 + #:foreign-array #:matrix #:dim0 #:dim1 #:^ ; #:copy #:clone ) (:shadowing-import-from :grid #:foreign-pointer) diff --git a/linear-algebra/matrix-generation.lisp b/linear-algebra/matrix-generation.lisp index abf61061..df9c0ad4 100644 --- a/linear-algebra/matrix-generation.lisp +++ b/linear-algebra/matrix-generation.lisp @@ -1,8 +1,8 @@ ;; Generate matrices used in tests of linear algebra functions ;; Liam Healy 2009-09-19 18:28:31EDT matrix-generation.lisp -;; Time-stamp: <2009-12-27 09:54:58EST matrix-generation.lisp> +;; Time-stamp: <2010-06-29 21:48:06EDT matrix-generation.lisp> ;; -;; Copyright 2009 Liam M. Healy +;; Copyright 2009, 2010 Liam M. Healy ;; Distributed under the terms of the GNU General Public License ;; ;; This program is free software: you can redistribute it and/or modify @@ -38,13 +38,13 @@ based on a function of the element indices i, j." (grid:map-grid :source function - :destination-gtype `((marray ,(if dim1 2 1)) ,element-type) + :destination-gtype `((foreign-array ,(if dim1 2 1)) ,element-type) :source-dims (if dim1 (list dim0 dim1) (list dim0)))) (defun constant-matrix (constant dim0 &optional (dim1 dim0) (element-type 'double-float)) (grid:make-grid - `((marray ,dim0 ,dim1) ,element-type) + `((foreign-array ,dim0 ,dim1) ,element-type) :initial-element constant)) ;;;;**************************************************************************** diff --git a/polynomial.lisp b/polynomial.lisp index 839ecf8d..b24e11a7 100644 --- a/polynomial.lisp +++ b/polynomial.lisp @@ -1,6 +1,6 @@ ;; Polynomials ;; Liam Healy, Tue Mar 21 2006 - 18:33 -;; Time-stamp: <2010-06-27 18:14:53EDT polynomial.lisp> +;; Time-stamp: <2010-06-29 20:56:39EDT polynomial.lisp> ;; ;; Copyright 2009 Liam M. Healy ;; Distributed under the terms of the GNU General Public License @@ -27,7 +27,7 @@ ;;;;**************************************************************************** (defmfun evaluate - ((coefficients vector-double-float) (x float) &key divided-difference) + ((coefficients grid:vector-double-float) (x float) &key divided-difference) ("gsl_poly_eval" "gsl_poly_dd_eval") ((((foreign-pointer coefficients) :pointer) ((dim0 coefficients) sizet) (x :double)) @@ -43,7 +43,7 @@ #+fsbv (defmfun evaluate - ((coefficients vector-double-float) (x complex) + ((coefficients grid:vector-double-float) (x complex) &key) "gsl_poly_complex_eval" (((foreign-pointer coefficients) :pointer) ((dim0 coefficients) sizet) @@ -57,7 +57,7 @@ #+fsbv (defmfun evaluate - ((coefficients vector-complex-double-float) (x complex) + ((coefficients grid:vector-complex-double-float) (x complex) &key) "gsl_complex_poly_complex_eval" (((foreign-pointer coefficients) :pointer) ((dim0 coefficients) sizet) diff --git a/random/generators.lisp b/random/generators.lisp index 73e70a02..4b218ea4 100644 --- a/random/generators.lisp +++ b/random/generators.lisp @@ -1,6 +1,6 @@ ;; Generators of random numbers. ;; Liam Healy, Sat Jul 15 2006 - 14:43 -;; Time-stamp: <2010-06-27 18:07:07EDT generators.lisp> +;; Time-stamp: <2010-06-29 21:11:04EDT generators.lisp> ;; ;; Copyright 2006, 2007, 2008, 2009 Liam M. Healy ;; Distributed under the terms of the GNU General Public License @@ -176,6 +176,7 @@ ;;;; Copying state ;;;;**************************************************************************** +#| (defmfun grid:copy-to-destination ((source random-number-generator) (destination random-number-generator)) "gsl_rng_memcpy" @@ -193,6 +194,7 @@ :definition :method :c-return :pointer :index copy) +|# ;;;;**************************************************************************** ;;;; Examples and unit test diff --git a/random/quasi.lisp b/random/quasi.lisp index 0a725390..3501fae7 100644 --- a/random/quasi.lisp +++ b/random/quasi.lisp @@ -1,6 +1,6 @@ ;; Quasi-random sequences in arbitrary dimensions. ;; Liam Healy, Sun Jul 16 2006 - 15:54 -;; Time-stamp: <2010-06-27 18:13:45EDT quasi.lisp> +;; Time-stamp: <2010-06-29 21:11:34EDT quasi.lisp> ;; ;; Copyright 2006, 2007, 2008, 2009 Liam M. Healy ;; Distributed under the terms of the GNU General Public License @@ -64,6 +64,7 @@ :export nil :index gsl-random-state) +#| (defmfun grid:copy-to-destination ((source quasi-random-number-generator) (destination quasi-random-number-generator)) @@ -81,6 +82,7 @@ :definition :method :c-return :pointer :index copy) +|# (def-rng-type +niederreiter2+ ;; FDL -- GitLab