[lisplab-cvs] r195 - in trunk/src: matrix1 matrix2 vector2

Jørn Inge Vestgården jivestgarden at common-lisp.net
Sun Nov 21 13:46:08 UTC 2010


Author: jivestgarden
Date: Sun Nov 21 08:46:08 2010
New Revision: 195

Log:
copy is now a pure vector operation

Modified:
   trunk/src/matrix1/level1-dge.lisp
   trunk/src/matrix2/level2-constructors.lisp
   trunk/src/vector2/level2-generic.lisp
   trunk/src/vector2/level2-matrix-dge.lisp

Modified: trunk/src/matrix1/level1-dge.lisp
==============================================================================
--- trunk/src/matrix1/level1-dge.lisp	(original)
+++ trunk/src/matrix1/level1-dge.lisp	Sun Nov 21 08:46:08 2010
@@ -22,7 +22,7 @@
 ;;; Double float general classes
 
 (defclass matrix-base-dge 
-    (structure-general 
+    (structure-general      
      vector-d 
      implementation-base) 
   ())

Modified: trunk/src/matrix2/level2-constructors.lisp
==============================================================================
--- trunk/src/matrix2/level2-constructors.lisp	(original)
+++ trunk/src/matrix2/level2-constructors.lisp	Sun Nov 21 08:46:08 2010
@@ -70,13 +70,6 @@
   (unless implementation
     (setf implementation (implementation-spec a)))
   (make-matrix-instance (list element-type structure implementation) dim value)) 
-
-(defmethod copy ((a matrix-base))
-  (let ((x (make-matrix-instance (class-of a) (dim a) 0)))
-    (dotimes (i (size x))
-      (setf (vref x i) (vref a i)))
-    x))
-
 (defmethod convert ((x matrix-base) type)
   (let ((y (make-matrix-instance type (dim x) 0)))
     (copy-contents x y)

Modified: trunk/src/vector2/level2-generic.lisp
==============================================================================
--- trunk/src/vector2/level2-generic.lisp	(original)
+++ trunk/src/vector2/level2-generic.lisp	Sun Nov 21 08:46:08 2010
@@ -32,6 +32,12 @@
 
 ;;; Vector operations (ignore structure)
 
+(defmethod copy ((a vector-base))
+  (let ((x (make-matrix-instance (class-of a) (dim a) 0)))
+    (dotimes (i (size x))
+      (setf (vref x i) (vref a i)))
+    x))
+
 (defmethod mmap ((type (eql t)) f (a vector-base) &rest args)
   "Maps with output type given by first matrix."
   (apply #'mmap (type-of a) f a args)) 

Modified: trunk/src/vector2/level2-matrix-dge.lisp
==============================================================================
--- trunk/src/vector2/level2-matrix-dge.lisp	(original)
+++ trunk/src/vector2/level2-matrix-dge.lisp	Sun Nov 21 08:46:08 2010
@@ -28,7 +28,7 @@
 (defmethod copy ((a vector-d))
   (let ((store (vector-store a)))
     (declare (type type-blas-store store))
-    (make-instance (class-name (class-of a))
+    (make-instance (class-of a)
 		   :store (copy-seq store)
 		   :dim (dim a))))
 
@@ -270,8 +270,9 @@
 	  
 (defmethod .expt ((a vector-d) (b real))
   "There is a lot of fuzz going on in here. The reason is because
-the important special cases of exponents -3,-2,-1,0,1,2,3 are a factor 10 faster
-than the general case on SBCL. Furthermore, output can be complex for non-integer exponent."
+the important special cases of exponents -3,-2,-1,0,1,2,3 are 
+a factor 10 faster than the general case on SBCL. 
+Furthermore, output can be complex for non-integer exponent."
   (multiple-value-bind (div mod) (truncate b)
     (if (= 0 mod)
 	(let ((c (mcreate a)))




More information about the lisplab-cvs mailing list