[cl-gsl-cvs] CVS update: cl-gsl/vector.lisp
cl-gsl-cvs at common-lisp.net
cl-gsl-cvs at common-lisp.net
Sun Apr 10 02:31:07 UTC 2005
Update of /project/cl-gsl/cvsroot/cl-gsl
In directory common-lisp.net:/tmp/cvs-serv27234
Modified Files:
vector.lisp
Log Message:
Fix scale and add-constant functions. Only subvector and
subvector-with-stride functions now have problems.
Date: Sun Apr 10 04:31:06 2005
Author: edenny
Index: cl-gsl/vector.lisp
diff -u cl-gsl/vector.lisp:1.6 cl-gsl/vector.lisp:1.7
--- cl-gsl/vector.lisp:1.6 Thu Apr 7 04:37:13 2005
+++ cl-gsl/vector.lisp Sun Apr 10 04:31:06 2005
@@ -139,7 +139,8 @@
(equal typ '(complex (single-float))))
`(defun-foreign ,(concatenate 'string "gsl_" type-string "_scale")
((vec ,type-ptr)
- (x ,type-val))
+ ;; seems odd that this is :double for all types
+ (x :double))
:int))
,(unless (or (equal typ '(complex (double-float)))
@@ -147,7 +148,8 @@
`(defun-foreign ,(concatenate 'string
"gsl_" type-string "_add_constant")
((vec ,type-ptr)
- (x ,type-val))
+ ;; and again, :double for all types
+ (x :double))
:int))
,(unless (or (equal typ '(complex (double-float)))
@@ -217,14 +219,14 @@
(defun-foreign ,(concatenate 'string "wrap_gsl_" type-string
"_subvector")
- ((v gsl-vector-ptr)
+ ((v ,type-ptr)
(offset size-t)
(n size-t))
,type-ptr)
(defun-foreign ,(concatenate 'string "wrap_gsl_" type-string
"_subvector_with_stride")
- ((v gsl-vector-ptr)
+ ((v ,type-ptr)
(offset size-t)
(stride size-t)
(n size-t))
@@ -784,9 +786,10 @@
(let ((status
(cond
((eq (gsl-vec-element-type v) 'integer)
- (gsl-vector-int-scale (gsl-vec-ptr v) x))
+ ;; coerce to double-float looks wrong, but isn't.
+ (gsl-vector-int-scale (gsl-vec-ptr v) (coerce x 'double-float)))
((eq (gsl-vec-element-type v) 'single-float)
- (gsl-vector-float-scale (gsl-vec-ptr v) x))
+ (gsl-vector-float-scale (gsl-vec-ptr v) (coerce x 'double-float)))
((eq (gsl-vec-element-type v) 'double-float)
(gsl-vector-scale (gsl-vec-ptr v) x))
(t
@@ -800,9 +803,11 @@
(let ((status
(cond
((eq (gsl-vec-element-type v) 'integer)
- (gsl-vector-int-add-constant (gsl-vec-ptr v) x))
+ (gsl-vector-int-add-constant (gsl-vec-ptr v)
+ (coerce x 'double-float)))
((eq (gsl-vec-element-type v) 'single-float)
- (gsl-vector-float-add-constant (gsl-vec-ptr v) x))
+ (gsl-vector-float-add-constant (gsl-vec-ptr v)
+ (coerce x 'double-float)))
((eq (gsl-vec-element-type v) 'double-float)
(gsl-vector-add-constant (gsl-vec-ptr v) x))
(t
@@ -907,7 +912,7 @@
(error "No matching type")))))
-(defun gsl-vector->lisp-vector (v)
+(defun gsl->lisp-vector (v)
(assert (eq 'gsl-vec (type-of v)))
(let ((a (make-array (gsl-vec-size v) :element-type (gsl-vec-element-type v))))
(dotimes (i (gsl-vec-size v) a)
More information about the Cl-gsl-cvs
mailing list