Commit 0701df89 authored by Liam M. Healy's avatar Liam M. Healy
Browse files

Explicit package reference to grid:dimensions

Explicit package reference to grid:dimensions but there's an error
because if the symbol isn't imported many more tests fail.
parent 9fc8126d
;; Functions for both vectors and matrices.
;; Liam Healy 2008-04-26 20:48:44EDT both.lisp
;; Time-stamp: <2010-11-25 09:31:17EST both.lisp>
;; Time-stamp: <2011-01-10 18:17:02EST both.lisp>
;;
;; Copyright 2008, 2009, 2010 Liam M. Healy
;; Copyright 2008, 2009, 2010, 2011 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
......@@ -39,9 +39,9 @@
("gsl_" :category :type "_alloc_from_block")
((blockptr :pointer)
(0 sizet) ; offset
((first (dimensions object)) sizet) ; number of rows
((second (dimensions object)) sizet) ; number of columns
((second (dimensions object)) sizet)) ; "tda" = number of columns for now
((first (grid:dimensions object)) sizet) ; number of rows
((second (grid:dimensions object)) sizet) ; number of columns
((second (grid:dimensions object)) sizet)) ; "tda" = number of columns for now
:definition :methods
:c-return :pointer
:export nil)
......
;; Combinations
;; Liam Healy, Sun Mar 26 2006 - 11:51
;; Time-stamp: <2011-01-10 17:59:21EST combination.lisp>
;; Time-stamp: <2011-01-10 18:16:28EST combination.lisp>
;;
;; Copyright 2006, 2007, 2008, 2009, 2010, 2011 Liam M. Healy
;; Distributed under the terms of the GNU General Public License
......@@ -56,7 +56,7 @@
(make-instance
'combination
:element-type '(unsigned-byte #+int64 64 #+int32 32)
:range (combination-range n) :dimensions (dimensions k))
:range (combination-range n) :dimensions (grid:dimensions k))
(make-instance
'combination
:element-type '(unsigned-byte #+int64 64 #+int32 32)
......
;; Matrices
;; Liam Healy 2008-04-15 21:57:52EDT matrix.lisp
;; Time-stamp: <2010-06-29 22:10:48EDT matrix.lisp>
;; Time-stamp: <2011-01-10 18:17:17EST matrix.lisp>
;;
;; Copyright 2008, 2009 Liam M. Healy
;; Copyright 2008, 2009, 2011 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
......@@ -145,7 +145,7 @@
((source matrix)
&optional
(destination
(grid:make-foreign-array element-type :dimensions (reverse (dimensions source)))))
(grid:make-foreign-array element-type :dimensions (reverse (grid:dimensions source)))))
("gsl_matrix" :type "_transpose_memcpy")
(((mpointer destination) :pointer) ((mpointer source) :pointer))
:definition :generic
......
;; Permutations
;; Liam Healy, Sun Mar 26 2006 - 11:51
;; Time-stamp: <2011-01-10 17:59:22EST permutation.lisp>
;; Time-stamp: <2011-01-10 18:16:26EST permutation.lisp>
;;
;; Copyright 2006, 2007, 2008, 2009, 2010, 2011 Liam M. Healy
;; Distributed under the terms of the GNU General Public License
......@@ -53,7 +53,7 @@
(make-instance
'permutation
:element-type '(unsigned-byte #+int64 64 #+int32 32)
:dimensions (if (typep n 'permutation) (dimensions n) (list n)))))
:dimensions (if (typep n 'permutation) (grid:dimensions n) (list n)))))
(when initialize
(if (typep n 'permutation)
(error "not available yet") ; (copy perm n)
......
;; Real generalized eigensystems
;; Liam Healy 2009-02-16 12:55:04EST real-generalized.lisp
;; Time-stamp: <2010-06-29 22:15:24EDT generalized.lisp>
;; Time-stamp: <2011-01-10 18:17:27EST generalized.lisp>
;;
;; Copyright 2009 Liam M. Healy
;; Copyright 2009, 2011 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
......@@ -82,7 +82,7 @@
((A matrix) (B matrix)
&optional
(eigenvalues (grid:make-foreign-array element-type :dimensions (dim0 A)))
(eigenvectors (grid:make-foreign-array element-type :dimensions (dimensions A)))
(eigenvectors (grid:make-foreign-array element-type :dimensions (grid:dimensions A)))
(ws (eltcase complex (make-eigen-hermv (dim0 A))
t (make-eigen-symmv (dim0 A)))))
(double-float "gsl_eigen_gensymmv"
......
;; Generalized eigensystems for nonsymmetric real matrices
;; Liam Healy 2009-02-16 14:27:20EST nonsymmetric-generalized.lisp
;; Time-stamp: <2010-06-29 22:15:24EDT nonsymmetric-generalized.lisp>
;; Time-stamp: <2011-01-10 18:19:14EST nonsymmetric-generalized.lisp>
;;
;; Copyright 2009 Liam M. Healy
;; Copyright 2009, 2011 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
......@@ -63,11 +63,11 @@
(balance nil) ; unused by GSL
(Q
(if (eql shur-vectors t)
(grid:make-foreign-array 'double-float :dimensions (dimensions A))
(grid:make-foreign-array 'double-float :dimensions (grid:dimensions A))
shur-vectors))
(Z
(if (eql shur-vectors t)
(grid:make-foreign-array 'double-float :dimensions (dimensions A))
(grid:make-foreign-array 'double-float :dimensions (grid:dimensions A))
shur-vectors)))
("gsl_eigen_gen" "gsl_eigen_gen_QZ")
((((mpointer A) :pointer) ((mpointer B) :pointer)
......@@ -118,18 +118,18 @@
(beta
(grid:make-foreign-array 'double-float :dimensions (dim0 A)))
(eigenvectors
(grid:make-foreign-array 'double-float :dimensions (dimensions A)))
(grid:make-foreign-array 'double-float :dimensions (grid:dimensions A)))
(ws (make-eigen-genv (dim0 A)))
compute-shur-form-s compute-shur-form-t shur-vectors
&aux
(balance nil) ; unused by GSL
(Q
(if (eql shur-vectors t)
(grid:make-foreign-array 'double-float :dimensions (dimensions A))
(grid:make-foreign-array 'double-float :dimensions (grid:dimensions A))
shur-vectors))
(Z
(if (eql shur-vectors t)
(grid:make-foreign-array 'double-float :dimensions (dimensions A))
(grid:make-foreign-array 'double-float :dimensions (grid:dimensions A))
shur-vectors)))
("gsl_eigen_genv" "gsl_eigen_genv_QZ")
((((mpointer A) :pointer) ((mpointer B) :pointer)
......
;; Eigensystems for nonsymmetric real matrices
;; Liam Healy 2009-02-16 12:51:18EST nonsymmetric.lisp
;; Time-stamp: <2010-06-29 22:15:24EDT nonsymmetric.lisp>
;; Time-stamp: <2011-01-10 18:19:13EST nonsymmetric.lisp>
;;
;; Copyright 2009 Liam M. Healy
;; Copyright 2009, 2011 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
......@@ -58,7 +58,7 @@
&aux
(sv
(if (eql shur-vectors t)
(grid:make-foreign-array 'double-float :dimensions (dimensions A))
(grid:make-foreign-array 'double-float :dimensions (grid:dimensions A))
shur-vectors)))
("gsl_eigen_nonsymm" "gsl_eigen_nonsymm_Z")
((((mpointer A) :pointer)
......@@ -119,13 +119,13 @@
(eigenvalues
(grid:make-foreign-array '(complex double-float) :dimensions (dim0 A)))
(eigenvectors
(grid:make-foreign-array '(complex double-float) :dimensions (dimensions A)))
(grid:make-foreign-array '(complex double-float) :dimensions (grid:dimensions A)))
(ws (make-eigen-nonsymmv (dim0 A)))
shur-vectors
&aux
(sv
(if (eql shur-vectors t)
(grid:make-foreign-array 'double-float :dimensions (dimensions A))
(grid:make-foreign-array 'double-float :dimensions (grid:dimensions A))
shur-vectors)))
("gsl_eigen_nonsymmv" "gsl_eigen_nonsymmv_Z")
((((mpointer A) :pointer)
......
;; Eigenvectors and eigenvalues
;; Liam Healy, Sun May 21 2006 - 19:52
;; Time-stamp: <2010-07-07 14:25:01EDT symmetric-hermitian.lisp>
;; Time-stamp: <2011-01-10 18:19:13EST symmetric-hermitian.lisp>
;;
;; Copyright 2006, 2007, 2008, 2009 Liam M. Healy
;; Copyright 2006, 2007, 2008, 2009, 2011 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
......@@ -95,7 +95,7 @@
((A matrix)
&optional
(eigenvalues (grid:make-foreign-array element-type :dimensions (dim0 A)))
(eigenvectors (grid:make-foreign-array element-type :dimensions (dimensions A)))
(eigenvectors (grid:make-foreign-array element-type :dimensions (grid:dimensions A)))
(ws (eltcase complex (make-eigen-hermv (dim0 A))
t (make-eigen-symmv (dim0 A)))))
(double-float "gsl_eigen_symmv"
......
;; Discrete Fourier Transforms
;; Liam Healy 2009-11-07 14:24:07EST
;; Time-stamp: <2011-01-10 17:59:23EST discrete.lisp>
;; Time-stamp: <2011-01-10 18:16:24EST discrete.lisp>
;;
;; Copyright 2009, 2011 Liam M. Healy
;; Distributed under the terms of the GNU General Public License
......@@ -29,7 +29,7 @@
(defmfun forward-discrete-fourier-transform
((vector vector)
&key (stride 1)
(result (grid:make-foreign-array element-type :dimensions (dimensions vector))))
(result (grid:make-foreign-array element-type :dimensions (grid:dimensions vector))))
("gsl_dft" :type "_forward")
(((grid:foreign-pointer vector) :pointer) (stride sizet) ((floor (size vector) stride) sizet)
((grid:foreign-pointer result) :pointer))
......@@ -45,7 +45,7 @@
(defmfun backward-discrete-fourier-transform
((vector vector)
&key (stride 1)
(result (grid:make-foreign-array element-type :dimensions (dimensions vector))))
(result (grid:make-foreign-array element-type :dimensions (grid:dimensions vector))))
("gsl_dft" :type "_backward")
(((grid:foreign-pointer vector) :pointer) (stride sizet) ((floor (size vector) stride) sizet)
((grid:foreign-pointer result) :pointer))
......@@ -61,7 +61,7 @@
(defmfun inverse-discrete-fourier-transform
((vector vector)
&key (stride 1)
(result (grid:make-foreign-array element-type :dimensions (dimensions vector))))
(result (grid:make-foreign-array element-type :dimensions (grid:dimensions vector))))
("gsl_dft" :type "_inverse")
(((grid:foreign-pointer vector) :pointer) (stride sizet) ((floor (size vector) stride) sizet)
((grid:foreign-pointer result) :pointer))
......@@ -77,7 +77,7 @@
(defmfun discrete-fourier-transform
((vector vector)
&key (stride 1)
(result (grid:make-foreign-array element-type :dimensions (dimensions vector))))
(result (grid:make-foreign-array element-type :dimensions (grid:dimensions vector))))
("gsl_dft" :type "_transform")
(((grid:foreign-pointer vector) :pointer) (stride sizet) ((floor (size vector) stride) sizet)
((grid:foreign-pointer result) :pointer))
......
;; Discrete Hankel Transforms.
;; Liam Healy, Sat Dec 8 2007 - 16:50
;; Time-stamp: <2011-01-10 17:59:25EST hankel.lisp>
;; Time-stamp: <2011-01-10 18:16:23EST hankel.lisp>
;;
;; Copyright 2007, 2008, 2009, 2011 Liam M. Healy
;; Distributed under the terms of the GNU General Public License
......@@ -39,7 +39,7 @@
(defmfun apply-hankel
(hankel array-in
&optional
(array-out (grid:make-foreign-array 'double-float :dimensions (dimensions array-in))))
(array-out (grid:make-foreign-array 'double-float :dimensions (grid:dimensions array-in))))
"gsl_dht_apply"
(((mpointer hankel) :pointer) ((grid:foreign-pointer array-in) :pointer)
((grid:foreign-pointer array-out) :pointer))
......
;; Definitions for macro expansion
;; Liam Healy 2009-03-15 14:50:28EDT callback-compile-defs.lisp
;; Time-stamp: <2009-12-27 09:50:34EST callback-compile-defs.lisp>
;; Time-stamp: <2011-01-10 18:19:12EST callback-compile-defs.lisp>
;;
;; Copyright 2009 Liam M. Healy
;; Copyright 2009, 2011 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
......@@ -40,7 +40,7 @@
`(make-cbstruct
',(parse-callback-static cbs 'callback-fnstruct)
(when (dimension-names object)
(mappend 'list (dimension-names object) (dimensions object)))
(mappend 'list (dimension-names object) (grid:dimensions object)))
,@(mappend
'list
(mapcar
......
;; The mobject that defines callbacks
;; Liam Healy 2009-03-14 11:20:03EDT callback-included.lisp
;; Time-stamp: <2009-12-27 09:50:34EST callback-included.lisp>
;; Time-stamp: <2011-01-10 18:19:12EST callback-included.lisp>
;;
;; Copyright 2009 Liam M. Healy
;; Copyright 2009, 2011 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
......@@ -43,7 +43,7 @@
:initarg :scalarsp :reader scalarsp :initform t
:documentation "Whether the function expect to be passed and return
scalars or arrays.")
(dimensions :initarg :dimensions :reader dimensions))
(grid:dimensions :initarg :dimensions :reader grid:dimensions))
(:documentation
"A mobject that includes a callback function or functions to GSL."))
......@@ -65,7 +65,7 @@
(declare (ignore ignore))
`(defclass ,class-name ,superclasses
((dimension-names :initform nil :allocation :class)
(dimensions :initform '(1) :allocation :class)
(grid:dimensions :initform '(1) :allocation :class)
(scalarsp :initform T :allocation :class))
(:documentation ,documentation)))
......@@ -76,7 +76,7 @@
(princ (first (functions object)) stream)
(princ ", " stream))
(princ "dimensions " stream)
(princ (dimensions object) stream)))
(princ (grid:dimensions object) stream)))
;;;;****************************************************************************
;;;; For making mobjects
......
;; Generate a lambda that calls the user function; will be called by callback.
;; Liam Healy
;; Time-stamp: <2010-11-25 09:09:40EST funcallable.lisp>
;; Time-stamp: <2011-01-10 18:19:11EST funcallable.lisp>
;;
;; Copyright 2009, 2010 Liam M. Healy
;; Copyright 2009, 2010, 2011 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
......@@ -214,7 +214,7 @@
(lambda (fn fnspec)
(compile
nil
(make-funcallable-form fn fnspec (scalarsp object) (dimensions object))))
(make-funcallable-form fn fnspec (scalarsp object) (grid:dimensions object))))
(functions object)
(parse-callback-static (cbinfo object) 'functions))))
......
;; Load GSL
;; Liam Healy Sat Mar 4 2006 - 18:53
;; Time-stamp: <2011-01-10 17:47:50EST init.lisp>
;; Time-stamp: <2011-01-10 18:28:14EST init.lisp>
;;
;; Copyright 2006, 2007, 2008, 2009, 2010, 2011 Liam M. Healy
;; Distributed under the terms of the GNU General Public License
......@@ -22,14 +22,9 @@
(:nicknames :gsl)
(:use :common-lisp :cffi)
(:import-from
:grid
#:cl-array #:dimensions #:element-type
#:foreign-array #:matrix #:dim0 #:dim1 #:^
#:copy)
;;(:shadowing-import-from :grid #:foreign-pointer)
(:export
#:cl-array #:dimensions #:element-type #:dim0 #:dim1
#:copy))
:grid #:dimensions
#:element-type #:foreign-array #:matrix #:dim0 #:dim1 #:^ #:copy)
(:export #:element-type #:dim0 #:dim1 #:copy))
;;; Where there is a symbol conflict, take the other one.
(shadow '#:row :antik-user) ; conflict with grid:row; they are equivalent
......
;; Definition of GSL objects and ways to use them.
;; Liam Healy, Sun Dec 3 2006 - 10:21
;; Time-stamp: <2010-11-13 18:22:18EST mobject.lisp>
;; Time-stamp: <2011-01-10 18:19:11EST mobject.lisp>
;;
;; Copyright 2006, 2007, 2008, 2009 Liam M. Healy
;; Copyright 2006, 2007, 2008, 2009, 2011 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
......@@ -102,7 +102,7 @@
(if (have-at-least-gsl-version gsl-version)
`(progn
,(if cbinfo
`(,(if (member 'dimensions cl-alloc-args)
`(,(if (member 'grid:dimensions cl-alloc-args)
'def-ci-subclass 'def-ci-subclass-1d)
,class
,superclasses
......
;; BLAS level 1, Vector operations
;; Liam Healy, Wed Apr 26 2006 - 15:23
;; Time-stamp: <2011-01-10 17:59:27EST blas1.lisp>
;; Time-stamp: <2011-01-10 18:16:22EST blas1.lisp>
;;
;; Copyright 2006, 2007, 2008, 2009, 2011 Liam M. Healy
;; Distributed under the terms of the GNU General Public License
......@@ -112,7 +112,7 @@
(defmfun axpy
(alpha (x vector)
&optional
(y (grid:make-foreign-array element-type :dimensions (dimensions x))))
(y (grid:make-foreign-array element-type :dimensions (grid:dimensions x))))
;; This gets an error for complex types because you can't pass a
;; struct in CFFI yet.
("gsl_blas_" :type "axpy")
......
;; BLAS level 2, Matrix-vector operations
;; Liam Healy, Wed Apr 26 2006 - 21:08
;; Time-stamp: <2010-07-07 14:25:00EDT blas2.lisp>
;; Time-stamp: <2011-01-10 18:19:10EST blas2.lisp>
;;
;; Copyright 2006, 2007, 2008, 2009 Liam M. Healy
;; Copyright 2006, 2007, 2008, 2009, 2011 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
......@@ -42,9 +42,9 @@
(defun matrix-product-dimensions (a b)
(if (typep b 'matrix)
(list (first (dimensions a))
(second (dimensions b)))
(first (dimensions a))))
(list (first (grid:dimensions a))
(second (grid:dimensions b)))
(first (grid:dimensions a))))
(defmfun matrix-product
((A matrix) (x vector)
......
;; Cholesky Decomposition
;; Liam Healy, Wed May 3 2006 - 16:38
;; Time-stamp: <2010-06-30 19:57:28EDT cholesky.lisp>
;; Time-stamp: <2011-01-10 18:19:09EST cholesky.lisp>
;;
;; Copyright 2006, 2007, 2008, 2009 Liam M. Healy
;; Copyright 2006, 2007, 2008, 2009, 2011 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
......@@ -53,7 +53,7 @@
(defmfun cholesky-solve
((A matrix) (b vector) &optional x-spec
&aux
(x (grid:make-foreign-array-or-default x-spec (dimensions b) t)))
(x (grid:make-foreign-array-or-default x-spec (grid:dimensions b) t)))
(("gsl_linalg" :complex "_cholesky_svx")
("gsl_linalg" :complex "_cholesky_solve"))
((((mpointer A) :pointer) ((mpointer b) :pointer))
......
;; Householder Transformations
;; Liam Healy, Wed May 10 2006 - 10:03
;; Time-stamp: <2010-06-29 22:51:21EDT householder.lisp>
;; Time-stamp: <2011-01-10 18:19:08EST householder.lisp>
;;
;; Copyright 2006, 2007, 2008, 2009 Liam M. Healy
;; Copyright 2006, 2007, 2008, 2009, 2011 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
......@@ -87,7 +87,7 @@
(defmfun householder-solve
(A b &optional x-spec
&aux
(x (grid:make-foreign-array-or-default x-spec (dimensions b) t)))
(x (grid:make-foreign-array-or-default x-spec (grid:dimensions b) t)))
("gsl_linalg_HH_svx" "gsl_linalg_HH_solve")
((((mpointer A) :pointer) ((mpointer b) :pointer))
(((mpointer A) :pointer) ((mpointer b) :pointer)
......
;; LU decomposition
;; Liam Healy, Thu Apr 27 2006 - 12:42
;; Time-stamp: <2011-01-01 11:47:45EST lu.lisp>
;; Time-stamp: <2011-01-10 18:16:19EST lu.lisp>
;;
;; Copyright 2006, 2007, 2008, 2009, 2011 Liam M. Healy
;; Distributed under the terms of the GNU General Public License
......@@ -56,7 +56,7 @@
((A matrix) (b vector) permutation &optional x-spec
&aux
(x (if (eq x-spec t)
(grid:make-foreign-array element-type :dimensions (dimensions b))
(grid:make-foreign-array element-type :dimensions (grid:dimensions b))
x-spec)))
(("gsl_linalg" :complex "_LU_svx")
("gsl_linalg" :complex "_LU_solve"))
......
Markdown is supported
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