[lisplab-cvs] r226 - in trunk: . src/interface/1 src/vector/1/generic

jivestgarden at common-lisp.net jivestgarden at common-lisp.net
Sun Apr 15 19:32:38 UTC 2012


Author: jivestgarden
Date: Sun Apr 15 12:32:38 2012
New Revision: 226

Log:
moved code to new file

Added:
   trunk/src/vector/1/generic/
   trunk/src/vector/1/generic/vector1-generic.lisp
Modified:
   trunk/lisplab.asd
   trunk/src/interface/1/vector1-base.lisp

Modified: trunk/lisplab.asd
==============================================================================
--- trunk/lisplab.asd	Sun Apr 15 12:16:31 2012	(r225)
+++ trunk/lisplab.asd	Sun Apr 15 12:32:38 2012	(r226)
@@ -104,6 +104,11 @@
      (:file "matrix1-interface")
      (:file "matrix1-classes")))
 
+   (:module :src/vector/1/generic
+    :depends-on (:src/interface/1)
+    :components 
+    ((:file "vector1-generic")))
+
    (:module :src/vector/1/df
     :depends-on (:src/interface/1)
     :components 

Modified: trunk/src/interface/1/vector1-base.lisp
==============================================================================
--- trunk/src/interface/1/vector1-base.lisp	Sun Apr 15 12:16:31 2012	(r225)
+++ trunk/src/interface/1/vector1-base.lisp	Sun Apr 15 12:32:38 2012	(r226)
@@ -17,12 +17,6 @@
 ;;; with this program; if not, write to the Free Software Foundation, Inc.,
 ;;; 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
 
-;;; In lisplab, any matrix is a vector !
-;;; The vectors are 1D objects and respond to
-;;; the methods: 
-;;;              size, dim, element-type, vref, vector-p, rank
-
-
 (in-package :lisplab)
 
 (defclass vector-base ()
@@ -43,30 +37,4 @@
 	   :reader vector-store
 	   :type type-blas-store)))
 
-;;; General
-
-(defmethod print-object ((v vector-base) stream)
-  (print-unreadable-object (v stream :type t :identity t)
-    (dotimes (i (min (size v) *lisplab-print-size*))
-      (format stream "~a " (vref v i)))))
-
-(defmethod vector-p ((x vector-base)) t)
-
-(defmethod rank ((x vector-base)) 
-  1)
-
-(defmethod dim ((x vector-base) &optional d)
-  (if d
-      (ecase d (0 (size x)))
-      (list (size x))))
-
-;;; Untyped vectors
-
-(defmethod vref ((vector  vector-any) idx)
-  (aref (slot-value vector 'store) idx))
-
-(defmethod (setf vref) (value (vector vector-any) idx)
-  (setf (aref (slot-value vector 'store) idx)
-	value))
-
 

Added: trunk/src/vector/1/generic/vector1-generic.lisp
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ trunk/src/vector/1/generic/vector1-generic.lisp	Sun Apr 15 12:32:38 2012	(r226)
@@ -0,0 +1,47 @@
+;;; Lisplab, vector1-generic.lisp
+;;; Generic vector implementaion
+
+;;; Copyright (C) 2009 Joern Inge Vestgaarden
+;;;
+;;; This program is free software; you can redistribute it and/or modify
+;;; it under the terms of the GNU General Public License as published by
+;;; the Free Software Foundation; either version 2 of the License, or
+;;; (at your option) any later version.
+;;;
+;;; This program is distributed in the hope that it will be useful,
+;;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+;;; GNU General Public License for more details.
+;;;
+;;; You should have received a copy of the GNU General Public License along
+;;; with this program; if not, write to the Free Software Foundation, Inc.,
+;;; 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+
+(in-package :lisplab)
+
+;;; General
+
+(defmethod print-object ((v vector-base) stream)
+  (print-unreadable-object (v stream :type t :identity t)
+    (dotimes (i (min (size v) *lisplab-print-size*))
+      (format stream "~a " (vref v i)))))
+
+(defmethod vector-p ((x vector-base)) t)
+
+(defmethod rank ((x vector-base)) 
+  1)
+
+(defmethod dim ((x vector-base) &optional d)
+  (if d
+      (ecase d (0 (size x)))
+      (list (size x))))
+
+;;; Untyped vectors
+
+(defmethod vref ((vector  vector-any) idx)
+  (aref (slot-value vector 'store) idx))
+
+(defmethod (setf vref) (value (vector vector-any) idx)
+  (setf (aref (slot-value vector 'store) idx)
+	value))
+




More information about the lisplab-cvs mailing list