[cl-gsl-cvs] CVS update: cl-gsl/vector.lisp

Edgar Denny edenny at common-lisp.net
Tue Mar 15 03:17:30 UTC 2005


Update of /project/cl-gsl/cvsroot/cl-gsl
In directory common-lisp.net:/tmp/cvs-serv31424

Modified Files:
	vector.lisp 
Log Message:
Can now actually set and get values from complex vectors. Bindings are
still leaky though.

Date: Tue Mar 15 04:17:29 2005
Author: edenny

Index: cl-gsl/vector.lisp
diff -u cl-gsl/vector.lisp:1.3 cl-gsl/vector.lisp:1.4
--- cl-gsl/vector.lisp:1.3	Sat Mar  5 05:31:41 2005
+++ cl-gsl/vector.lisp	Tue Mar 15 04:17:29 2005
@@ -231,6 +231,38 @@
          ,type-ptr))))
 
 
+(defun-foreign "gsl_vector_complex_float_ptr"
+    ((v gsl-vector-complex-float-ptr)
+     (i size-t))
+  (* gsl-complex-float))
+
+(defun-foreign "gsl_vector_complex_ptr"
+    ((v gsl-vector-complex-ptr)
+     (i size-t))
+  (* gsl-complex))
+
+(defun-foreign "wrap_gsl_vector_complex_float_set"
+    ((v gsl-vector-complex-float-ptr)
+     (i size-t)
+     (z (* gsl-complex-float)))
+  :void)
+
+(defun-foreign "wrap_gsl_vector_complex_set"
+    ((v gsl-vector-complex-ptr)
+     (i size-t)
+     (z (* gsl-complex)))
+  :void)
+
+(defun-foreign "wrap_gsl_vector_complex_float_set_all"
+    ((v gsl-vector-complex-float-ptr)
+     (z (* gsl-complex-float)))
+  :void)
+
+(defun-foreign "wrap_gsl_vector_complex_set_all"
+    ((v gsl-vector-complex-ptr)
+     (z (* gsl-complex)))
+  :void)
+
 (def-vector-type-funcs% double-float)
 (def-vector-type-funcs% single-float)
 (def-vector-type-funcs% integer)
@@ -292,10 +324,10 @@
     ((eq (gsl-vec-element-type v) 'double-float)
      (gsl-vector-get (gsl-vec-ptr v) i))
     ((equal (gsl-vec-element-type v) '(complex (single-float)))
-     (gsl-complex-float->complex (gsl-vector-complex-float-get
-                                  (gsl-vec-ptr v) i)))
+     (gsl-complex-float->complex
+      (gsl-vector-complex-float-ptr (gsl-vec-ptr v) i)))
     ((equal (gsl-vec-element-type v) '(complex (double-float)))
-     (gsl-complex->complex (gsl-vector-complex-get (gsl-vec-ptr v) i)))
+     (gsl-complex->complex (gsl-vector-complex-ptr (gsl-vec-ptr v) i)))
     (t
      (error "No matching type"))))
 
@@ -313,10 +345,11 @@
     ((eq (gsl-vec-element-type v) 'double-float)
      (gsl-vector-set (gsl-vec-ptr v) i x))
     ((equal (gsl-vec-element-type v) '(complex (single-float)))
-     (gsl-vector-complex-float-set (gsl-vec-ptr v) i
-                                   (complex->gsl-complex-float x)))
+     (wrap-gsl-vector-complex-float-set (gsl-vec-ptr v) i
+                                        (complex->gsl-complex-float-ptr x)))
     ((equal (gsl-vec-element-type v) '(complex (double-float)))
-     (gsl-vector-complex-set (gsl-vec-ptr v) i (complex->gsl-complex x)))
+     (wrap-gsl-vector-complex-set (gsl-vec-ptr v) i
+                                  (complex->gsl-complex-ptr x)))
     (t
      (error "No matching type"))))
 
@@ -332,10 +365,11 @@
     ((eq (gsl-vec-element-type v) 'double-float)
      (gsl-vector-set-all (gsl-vec-ptr v) x))
     ((equal (gsl-vec-element-type v) '(complex (single-float)))
-     (gsl-vector-complex-float-set-all (gsl-vec-ptr v)
-                                       (complex->gsl-complex-float x)))
+     (wrap-gsl-vector-complex-float-set-all (gsl-vec-ptr v)
+                                            (complex->gsl-complex-float-ptr x)))
     ((equal (gsl-vec-element-type v) '(complex (double-float)))
-     (gsl-vector-complex-set-all (gsl-vec-ptr v) (complex->gsl-complex x)))
+     (wrap-gsl-vector-complex-set-all (gsl-vec-ptr v)
+                                      (complex->gsl-complex-ptr x)))
     (t
      (error "No matching type"))))
 
@@ -369,11 +403,9 @@
     ((eq (gsl-vec-element-type v) 'double-float)
      (gsl-vector-set-basis (gsl-vec-ptr v) i))
     ((equal (gsl-vec-element-type v) '(complex (single-float)))
-     (gsl-vector-complex-float-set-basis (gsl-vec-ptr v)
-                                         (complex->gsl-complex-float i)))
+     (gsl-vector-complex-float-set-basis (gsl-vec-ptr v) i))
     ((equal (gsl-vec-element-type v) '(complex (double-float)))
-     (gsl-vector-complex-set-basis (gsl-vec-ptr v)
-                                   (complex->gsl-complex i)))
+     (gsl-vector-complex-set-basis (gsl-vec-ptr v) i))
     (t
      (error "No matching type"))))
 
@@ -864,3 +896,4 @@
 
 ;; Function: gsl_vector_view gsl_vector_view_array_with_stride (double * base, size_t stride, size_t n)
 ;; Function: gsl_vector_const_view gsl_vector_const_view_array_with_stride (const double * base, size_t stride, size_t n)
+




More information about the Cl-gsl-cvs mailing list