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

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.
parent ea298b71
;; 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))
......
;; 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
......
;; 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
......
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