From acad7ba5902b9cb3c34fb973ac817aa6a5ba1cf3 Mon Sep 17 00:00:00 2001
From: "Liam M. Healy" <lnp@healy.washington.dc.us>
Date: Wed, 18 Nov 2009 10:49:44 -0500
Subject: [PATCH] Scalar addition/multiplication to complex marrays use complex
 scalars

The functions elt* and elt+ which used with a scalar use complex, not
double, scalars; GSL functions are gsl_vector_complex_scale,
gsl_vector_complex_add_constant, gsl_vector_complex_float_scale,
gsl_vector_complex_float_add_constant.
---
 data/both.lisp        | 35 ++++++++++++++++++++++++++++++-----
 init/body-expand.lisp |  5 ++---
 init/defmfun.lisp     |  5 ++---
 3 files changed, 34 insertions(+), 11 deletions(-)

diff --git a/data/both.lisp b/data/both.lisp
index 3715334c..27b82a9a 100644
--- a/data/both.lisp
+++ b/data/both.lisp
@@ -1,7 +1,6 @@
 ;; Functions for both vectors and matrices.
 ;; Liam Healy 2008-04-26 20:48:44EDT both.lisp
-;; Time-stamp: <2009-05-25 15:19:49EDT both.lisp>
-;; $Id$
+;; Time-stamp: <2009-11-18 10:46:49EST both.lisp>
 
 (in-package :gsl)
 
@@ -141,13 +140,26 @@
   ("gsl_" :category :type "_add_constant")
   (((mpointer a) :pointer) (x :double))
   :definition :methods
-  :element-types #.(if (have-at-least-gsl-version '(1 12)) t :no-complex)
+  :element-types :no-complex
   :inputs (a)
   :outputs (a)
   :return (a)
   :documentation			; FDL
   "Add the scalar double-float x to all the elements of array a.")
 
+#+fsbv
+(defmfun elt+ ((a both) (x complex))
+  ("gsl_" :category :type "_add_constant")
+  (((mpointer a) :pointer) (x :element-c-type))
+  :definition :methods
+  :element-types :complex
+  :inputs (a)
+  :outputs (a)
+  :return (a)
+  :gsl-version (1 12)
+  :documentation			; FDL
+  "Add the scalar complex x to all the elements of array a.")
+
 (defmethod elt+ ((x float) (a marray))
   (elt+ a x))
   
@@ -208,20 +220,33 @@
   :outputs (a)
   :return (a))
 
-(defmethod elt/ ((a marray) (x float))
+(defmethod elt/ ((a marray) (x number))
   (elt* a (/ x)))
 
 (defmfun elt* ((a both) (x float))
   ("gsl_" :category :type "_scale")
   (((mpointer a) :pointer) (x :double))
   :definition :methods
-  :element-types #.(if (have-at-least-gsl-version '(1 12)) t :no-complex)
+  :element-types :no-complex
   :inputs (a)
   :outputs (a)
   :return (a)
   :documentation			; FDL
   "Multiply the elements of a by the scalar double-float factor x.")
 
+#+fsbv
+(defmfun elt* ((a both) (x complex))
+  ("gsl_" :category :type "_scale")
+  (((mpointer a) :pointer) (x :element-c-type))
+  :definition :methods
+  :element-types :complex
+  :inputs (a)
+  :outputs (a)
+  :return (a)
+  :gsl-version (1 12)
+  :documentation			; FDL
+  "Multiply the elements of a by the scalar complex factor x.")
+
 (defmethod elt* ((x float) (a marray))
   (elt* a x))
 
diff --git a/init/body-expand.lisp b/init/body-expand.lisp
index 19fea05e..11d70cad 100644
--- a/init/body-expand.lisp
+++ b/init/body-expand.lisp
@@ -1,7 +1,6 @@
 ;; Expand the body of a defmfun
 ;; Liam Healy 2009-04-13 22:07:13EDT body-expand.lisp
-;; Time-stamp: <2009-11-14 10:19:46EST body-expand.lisp>
-;; $Id: $
+;; Time-stamp: <2009-11-18 09:56:18EST body-expand.lisp>
 
 (in-package :gsl)
 
@@ -123,7 +122,7 @@
 					 (t (st-type arg)))
 				       (st-symbol arg)))
 			       (mapcar 'st-pointer-generic-pointer c-arguments))
-			      (list(st-type creturn-st))))))
+			      (list (st-type creturn-st))))))
 	     ,@(case c-return
 		     (:void `((declare (ignore ,(st-symbol creturn-st)))))
 		     (:error-code	; fill in arguments
diff --git a/init/defmfun.lisp b/init/defmfun.lisp
index d6f76dc5..1bd40115 100644
--- a/init/defmfun.lisp
+++ b/init/defmfun.lisp
@@ -1,7 +1,6 @@
 ;; Macro for defining GSL functions.
 ;; Liam Healy 2008-04-16 20:49:50EDT defmfun.lisp
-;; Time-stamp: <2009-05-24 16:54:33EDT defmfun.lisp>
-;; $Id$
+;; Time-stamp: <2009-11-18 09:14:07EST defmfun.lisp>
 
 (in-package :gsl)
 
@@ -10,7 +9,7 @@
 ;;;;****************************************************************************
 
 ;;; Demfun is the main macro for defining functions (ordinary
-;;; functions, generic functions, and methods) tthat call GSL
+;;; functions, generic functions, and methods) that call GSL
 ;;; functions.  It takes care of mapping the data from CL to C and
 ;;; then back out from C to CL.  Where the GSL function returns a
 ;;; condition code, it will insert a check that turns that result into
-- 
GitLab