Commit 2a877243 authored by Liam Healy's avatar Liam Healy

Merge branch 'antik'

Conflicts:
	gsll.asd
	ordinary-differential-equations/ode-system.lisp
	random/dirichlet.lisp
parents dfdabff8 13e65854
;; Basis splines.
;; Liam Healy 2008-02-18 14:43:20EST basis-splines.lisp
;; Time-stamp: <2010-06-30 19:57:28EDT basis-splines.lisp>
;; Time-stamp: <2011-05-26 12:37:29EDT basis-splines.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
......@@ -125,18 +125,18 @@
(let* ((xi (coerce (* i (/ 15 (1- ndata))) 'double-float))
(yi (+ (* (cos xi) (exp (* -0.1d0 xi)))
(sample rng :gaussian :sigma sigma))))
(setf (grid:gref x i) xi
(grid:gref y i) yi
(grid:gref w i) (/ (expt sigma 2)))))
(setf (grid:aref x i) xi
(grid:aref y i) yi
(grid:aref w i) (/ (expt sigma 2)))))
;; Uniform breakpoints [0, 15]
(uniform-knots 0.0d0 15.0d0 bw)
;; Fit matrix
(dotimes (i ndata)
;; Compute B_j
(evaluate bw (grid:gref x i) :b B)
(evaluate bw (grid:aref x i) :b B)
;; Fill in row i of X
(dotimes (j ncoeffs)
(setf (grid:gref Xmatrix i j) (grid:gref B j))))
(setf (grid:aref Xmatrix i j) (grid:aref B j))))
;; Do the fit
(linear-mfit Xmatrix y c w nil cov mw)
;; Return the smoothed curve
......
;; Monte Carlo Integration
;; Liam Healy Sat Feb 3 2007 - 17:42
;; Time-stamp: <2010-08-07 21:41:14EDT monte-carlo.lisp>
;; Time-stamp: <2011-01-10 17:59:20EST monte-carlo.lisp>
;;
;; Copyright 2007, 2008, 2009 Liam M. Healy
;; Copyright 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
......@@ -51,7 +51,7 @@
(scalars t))
"gsl_monte_plain_integrate"
((callback :pointer)
((foreign-pointer lower-limits) :pointer) ((foreign-pointer upper-limits) :pointer)
((grid:foreign-pointer lower-limits) :pointer) ((grid: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)
((foreign-pointer lower-limits) :pointer) ((foreign-pointer upper-limits) :pointer)
((grid:foreign-pointer lower-limits) :pointer) ((grid: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)
((foreign-pointer lower-limits) :pointer) ((foreign-pointer upper-limits) :pointer)
((grid:foreign-pointer lower-limits) :pointer) ((grid: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: <2010-08-07 21:46:21EDT numerical-integration.lisp>
;; Time-stamp: <2011-01-10 17:59:21EST numerical-integration.lisp>
;;
;; Copyright 2006, 2007, 2008, 2009, 2010 Liam M. Healy
;; Copyright 2006, 2007, 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
......@@ -157,7 +157,7 @@
(limit 1000) (workspace (make-integration-workspace limit)))
"gsl_integration_qagp"
((callback :pointer)
((foreign-pointer points) :pointer) ((dim0 points) sizet)
((grid:foreign-pointer points) :pointer) ((dim0 points) sizet)
(absolute-error :double) (relative-error :double) (limit sizet)
((mpointer workspace) :pointer)
(result (:pointer :double)) (abserr (:pointer :double)))
......
;; 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-05-26 12:37:36EDT 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
......@@ -35,13 +35,13 @@
:export nil
:documentation "Allocate memory for the GSL struct given a block pointer.")
(defmfun alloc-from-block ((object matrix) blockptr)
(defmfun alloc-from-block ((object grid:matrix) blockptr)
("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)
......@@ -81,7 +81,7 @@
;;;;****************************************************************************
;;;; Array elements; used in callbacks scalarsp=T only
;;;;****************************************************************************
;;; Normal foreign array access is with grid:gref, but in order to
;;; Normal foreign array access is with grid:aref, but in order to
;;; avoid the overhead of instantiating a foreign-array object to
;;; access components, we use these macros which expand to gsl_*_get
;;; and gsl_*_set.
......@@ -113,7 +113,7 @@
`(cffi:foreign-funcall
,(actual-gsl-function-name
`("gsl_" :category :type ,(if value "_set" "_get"))
(if matrixp 'matrix 'vector)
(if matrixp 'grid:matrix 'vector)
element-type)
:pointer ,mpointer
sizet ,(first indices)
......@@ -192,7 +192,7 @@
:documentation ; FDL
"Add the scalar complex x to all the elements of array a.")
(defmethod elt+ ((x float) (a foreign-array))
(defmethod elt+ ((x float) (a grid:foreign-array))
(elt+ a x))
(defmfun elt- ((a both) (b both))
......@@ -207,7 +207,7 @@
"Subtract the elements of b from the elements of a.
The two must have the same dimensions.")
(defmethod elt- ((a foreign-array) (x float))
(defmethod elt- ((a grid:foreign-array) (x float))
(elt+ a (- x)))
(defmfun elt* ((a vector) (b vector))
......@@ -222,7 +222,7 @@
"Multiply the elements of a by the elements of b.
The two must have the same dimensions.")
(defmfun elt* ((a matrix) (b matrix))
(defmfun elt* ((a grid:matrix) (b grid:matrix))
("gsl_" :category :type "_mul_elements")
(((mpointer a) :pointer) ((mpointer b) :pointer))
:definition :methods
......@@ -243,7 +243,7 @@
"Divide the elements of a by the elements of b.
The two must have the same dimensions.")
(defmfun elt/ ((a matrix) (b matrix))
(defmfun elt/ ((a grid:matrix) (b grid:matrix))
("gsl_" :category :type "_div_elements")
(((mpointer a) :pointer) ((mpointer b) :pointer))
:definition :methods
......@@ -252,7 +252,7 @@
:outputs (a)
:return (a))
(defmethod elt/ ((a foreign-array) (x number))
(defmethod elt/ ((a grid:foreign-array) (x number))
(elt* a (/ x)))
(defmfun elt* ((a both) (x float))
......@@ -279,7 +279,7 @@
:documentation ; FDL
"Multiply the elements of a by the scalar complex factor x.")
(defmethod elt* ((x float) (a foreign-array))
(defmethod elt* ((x float) (a grid:foreign-array))
(elt* a x))
;;;;****************************************************************************
......@@ -329,7 +329,7 @@
"The index of the minimum value in a. When there are several
equal minimum elements, then the lowest index is returned.")
(defmfun min-index ((a matrix))
(defmfun min-index ((a grid:matrix))
("gsl_" :category :type "_min_index")
(((mpointer a) :pointer) (imin (:pointer sizet)) (jmin (:pointer sizet)))
:definition :methods
......@@ -348,7 +348,7 @@
"The index of the maximum value in a. When there are several
equal maximum elements, then the lowest index is returned.")
(defmfun max-index ((a matrix))
(defmfun max-index ((a grid:matrix))
("gsl_" :category :type "_max_index")
(((mpointer a) :pointer) (imin (:pointer sizet)) (jmin (:pointer sizet)))
:definition :methods
......@@ -369,7 +369,7 @@
returned. Returned indices are minimum, maximum; for matrices
imin, jmin, imax, jmax.")
(defmfun minmax-index ((a matrix))
(defmfun minmax-index ((a grid:matrix))
("gsl_" :category :type "_minmax_index")
(((mpointer a) :pointer)
(imin (:pointer sizet)) (jmin (:pointer sizet))
......
;; Combinations
;; Liam Healy, Sun Mar 26 2006 - 11:51
;; Time-stamp: <2010-07-16 17:14:03EDT combination.lisp>
;; Time-stamp: <2011-01-10 18:16:28EST combination.lisp>
;;
;; Copyright 2006, 2007, 2008, 2009, 2010 Liam M. Healy
;; Copyright 2006, 2007, 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
......@@ -37,7 +37,7 @@
(setf (grid:metadata-slot object 'mpointer)
mptr
(cffi:foreign-slot-value mptr 'gsl-combination-c 'data)
(foreign-pointer object)
(grid:foreign-pointer object)
(cffi:foreign-slot-value mptr 'gsl-combination-c 'range)
range
(cffi:foreign-slot-value mptr 'gsl-combination-c 'size)
......@@ -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)
......
;; A grid:foreign-array with added metadata for GSL.
;; Liam Healy 2008-04-06 21:23:41EDT
;; Time-stamp: <2010-07-13 22:53:02EDT foreign-array.lisp>
;; Time-stamp: <2011-01-12 00:34:42EST foreign-array.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
......@@ -44,7 +44,7 @@
(setf (cffi:foreign-slot-value blockptr 'gsl-block-c 'size)
(size object)
(cffi:foreign-slot-value blockptr 'gsl-block-c 'data)
(foreign-pointer object)
(grid:foreign-pointer object)
(grid:metadata-slot object 'block-pointer) blockptr)
(let ((array-struct (alloc-from-block object blockptr)))
(setf
......@@ -53,8 +53,8 @@
;; from the block to the vector/matrix; we must do that manually here
(cffi:foreign-slot-value
array-struct
(if (typep object 'matrix) 'gsl-matrix-c 'gsl-vector-c) 'data)
(foreign-pointer object))
(if (typep object 'grid:matrix) 'gsl-matrix-c 'gsl-vector-c) 'data)
(grid:foreign-pointer object))
(tg:finalize object
(lambda ()
(cffi:foreign-free blockptr)
......@@ -82,23 +82,23 @@
(let* ((category
(case category-or-rank
((vector :vector 1) 'vector)
((matrix :matrix 2) 'matrix)
((matrix grid:matrix :matrix 2) 'grid:matrix)
(t (error "Unrecognized category ~a" category-or-rank))))
(cstruct
(case category
(vector 'gsl-vector-c)
(matrix 'gsl-matrix-c)))
(grid:matrix 'gsl-matrix-c)))
(fa
(grid:make-grid
(case category
(vector
`((foreign-array ,(cffi:foreign-slot-value mpointer cstruct 'size))
,element-type))
(matrix
`((foreign-array
,(cffi:foreign-slot-value mpointer cstruct 'size0)
,(cffi:foreign-slot-value mpointer cstruct 'size1))
,element-type)))
`((grid:foreign-array ,(cffi:foreign-slot-value mpointer cstruct 'size))
,element-type))
(grid:matrix
`((grid:foreign-array
,(cffi:foreign-slot-value mpointer cstruct 'size0)
,(cffi:foreign-slot-value mpointer cstruct 'size1))
,element-type)))
:foreign-pointer
(cffi:foreign-slot-value mpointer cstruct 'data)
:finalizer finalize)))
......
;; 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-12 00:34:45EST 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
......@@ -26,7 +26,7 @@
;;;; Mathematical
;;;;****************************************************************************
(defmfun set-identity ((matrix matrix))
(defmfun set-identity ((matrix grid:matrix))
("gsl_matrix" :type "_set_identity")
(((mpointer matrix) :pointer))
:definition :generic
......@@ -43,8 +43,7 @@
;;;; Copying rows and columns
;;;;****************************************************************************
(defmfun row
((matrix matrix) i
(defmfun row ((matrix grid:matrix) i
&optional (vector (grid:make-foreign-array element-type :dimensions (dim1 matrix))))
("gsl_matrix" :type "_get_row")
(((mpointer vector) :pointer) ((mpointer matrix) :pointer) (i sizet))
......@@ -57,7 +56,7 @@
into the vector. The length of the vector must be the
same as the length of the row.")
(defmfun (setf row) ((vector vector) (matrix matrix) i)
(defmfun (setf row) ((vector vector) (matrix grid:matrix) i)
("gsl_matrix" :type "_set_row")
(((mpointer matrix) :pointer) (i sizet) ((mpointer vector) :pointer))
:definition :generic
......@@ -68,8 +67,7 @@
"Copy the elements of the vector into the jth row of the matrix.
The length of the vector must be the same as the length of the row.")
(defmfun column
((matrix matrix) i
(defmfun column ((matrix grid:matrix) i
&optional (vector (grid:make-foreign-array element-type :dimensions (dim0 matrix))))
("gsl_matrix" :type "_get_col")
(((mpointer vector) :pointer) ((mpointer matrix) :pointer) (i sizet))
......@@ -82,7 +80,7 @@
into the vector. The length of the vector must be the
same as the length of the column.")
(defmfun (setf column) ((vector vector) (matrix matrix) i)
(defmfun (setf column) ((vector vector) (matrix grid:matrix) i)
("gsl_matrix" :type "_set_col")
(((mpointer matrix) :pointer) (i sizet) ((mpointer vector) :pointer))
:definition :generic
......@@ -97,7 +95,7 @@
;;;; Exchanging rows and columns
;;;;****************************************************************************
(defmfun swap-rows ((matrix matrix) i j)
(defmfun swap-rows ((matrix grid:matrix) i j)
("gsl_matrix" :type "_swap_rows")
(((mpointer matrix) :pointer) (i sizet) (j sizet))
:definition :generic
......@@ -107,7 +105,7 @@
:documentation ; FDL
"Exchange the ith and jth rows of the matrix in-place.")
(defmfun swap-columns ((matrix matrix) i j)
(defmfun swap-columns ((matrix grid:matrix) i j)
("gsl_matrix" :type "_swap_columns")
(((mpointer matrix) :pointer) (i sizet) (j sizet))
:definition :generic
......@@ -117,7 +115,7 @@
:documentation ; FDL
"Exchange the ith and jth columns of the matrix in-place.")
(defmfun swap-row-column ((matrix matrix) i j)
(defmfun swap-row-column ((matrix grid:matrix) i j)
("gsl_matrix" :type "_swap_rowcol")
(((mpointer matrix) :pointer) (i sizet) (j sizet))
:definition :generic
......@@ -129,7 +127,7 @@
matrix in-place. The matrix must be square for this operation to
be possible.")
(defmfun matrix-transpose* ((matrix matrix))
(defmfun matrix-transpose* ((matrix grid:matrix))
("gsl_matrix" :type "_transpose")
(((mpointer matrix) :pointer))
:definition :generic
......@@ -142,10 +140,10 @@
operation to be possible.")
(defmfun matrix-transpose
((source matrix)
((source grid: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: <2010-11-13 18:44:09EST permutation.lisp>
;; Time-stamp: <2011-05-26 12:37:36EDT permutation.lisp>
;;
;; Copyright 2006, 2007, 2008, 2009, 2010 Liam M. Healy
;; Copyright 2006, 2007, 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
......@@ -38,7 +38,7 @@
(setf (grid:metadata-slot object 'mpointer)
mptr
(cffi:foreign-slot-value mptr 'gsl-permutation-c 'data)
(foreign-pointer object)
(grid:foreign-pointer object)
(cffi:foreign-slot-value mptr 'gsl-permutation-c 'size)
(first dimensions))
(tg:finalize object (lambda () (cffi:foreign-free mptr)))))
......@@ -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)
......@@ -339,7 +339,7 @@
(save-test permutation
(let ((perm-1 (make-permutation 4 t)))
(grid:gref perm-1 2))
(grid:aref perm-1 2))
(let ((perm-1 (make-permutation 4 t))) ;grid:contents
(grid:contents perm-1))
(let ((perm-1 (make-permutation 4 t))) ;permutation-reverse
......
......@@ -9,6 +9,21 @@
content="text/html; charset=iso-8859-1">
<link rev="made" href="mailto:lhealy@common-lisp.net">
<link rel="stylesheet" type="text/css" href="site.css">
<script type="text/javascript">
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-25052371-1']);
_gaq.push(['_setDomainName', 'none']);
_gaq.push(['_setAllowLinker', true]);
_gaq.push(['_trackPageview']);
(function() {
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();
</script>
</head>
<body>
<div id="banner">
......@@ -336,18 +351,9 @@ four-digit number; please attach them all to your email.
<!-- Created: Feb 25 2005 -->
<!-- hhmts start -->
<small>
Time-stamp: <2010-10-12 17:46:29EDT index.html>
Time-stamp: <2011-08-09 22:37:23EDT index.html>
</small>
<!-- hhmts end -->
</div>
<script type="text/javascript">
var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
</script>
<script type="text/javascript">
var pageTracker = _gat._getTracker("UA-3669275-1");
pageTracker._initData();
pageTracker._trackPageview();
</script>
</body>
</html>
;; 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-12 00:08:22EST 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
......@@ -56,8 +56,7 @@
n-by-n complex generalized hermitian-definite eigensystems. The
size of the workspace is O(5n).")
(defmfun eigenvalues-gensymm
((A matrix) (B matrix)
(defmfun eigenvalues-gensymm ((A grid:matrix) (B grid:matrix)
&optional
(eigenvalues (grid:make-foreign-array element-type :dimensions (dim0 A)))
(ws (eltcase complex (make-eigen-genherm (dim0 A))
......@@ -78,11 +77,10 @@
outlined above. On output, B contains its Cholesky decomposition and
A is destroyed.")
(defmfun eigenvalues-eigenvectors-gensymm
((A matrix) (B matrix)
(defmfun eigenvalues-eigenvectors-gensymm ((A grid:matrix) (B grid: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-12 00:09:43EST 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
......@@ -66,8 +66,7 @@
;;;; Eigenvalues and eigenvectors
;;;;****************************************************************************
(defmfun eigenvalues
((A matrix)
(defmfun eigenvalues ((A grid:matrix)
&optional
(eigenvalues (grid:make-foreign-array element-type :dimensions (dim0 A)))
(ws (eltcase complex (make-eigen-herm (dim0 A))
......@@ -91,11 +90,10 @@
referenced. The eigenvalues are stored in the vector eigenvalues and
are unordered.")
(defmfun eigenvalues-eigenvectors
((A matrix)
(defmfun eigenvalues-eigenvectors ((A grid: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"
......@@ -126,7 +124,7 @@
;;;;****************************************************************************
(defmfun sort-eigenvalues-eigenvectors
((eigenvalues vector) (eigenvectors matrix) sort-type)
((eigenvalues vector) (eigenvectors grid:matrix) sort-type)
(double-float "gsl_eigen_symmv_sort"
complex-double-float "gsl_eigen_hermv_sort")
(((mpointer eigenvalues) :pointer) ((mpointer eigenvectors) :pointer)
......
;; Backward FFT
;; Sumant Oemrawsingh, Sat Oct 24 2009 - 12:55
;; Time-stamp: <2010-06-27 18:13:59EDT backward.lisp>
;; Time-stamp: <2011-01-11 23:34:19EST backward.lisp>
;;
;; Copyright 2009 Sumant Oemrawsingh, Liam M. Healy
;; Copyright 2009, 2011 Sumant Oemrawsingh, 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
......@@ -33,7 +33,7 @@
(defmfun backward-fourier-transform-radix2
((vector vector) &key (stride 1))
("gsl_fft" :type "_radix2_backward")
(((foreign-pointer vector) :pointer) (stride sizet) ((floor (size vector) stride) sizet))
(((grid: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