[lisplab-cvs] r229 - in trunk: . src/matrix/1 src/matrix/1/funmat

jivestgarden at common-lisp.net jivestgarden at common-lisp.net
Fri Apr 20 18:40:23 UTC 2012


Author: jivestgarden
Date: Fri Apr 20 11:40:23 2012
New Revision: 229

Log:
Moved funmat

Added:
   trunk/src/matrix/1/funmat/
   trunk/src/matrix/1/funmat/level1-funmat.lisp
      - copied unchanged from r227, trunk/src/matrix/1/level1-funmat.lisp
Deleted:
   trunk/src/matrix/1/level1-funmat.lisp
Modified:
   trunk/lisplab.asd

Modified: trunk/lisplab.asd
==============================================================================
--- trunk/lisplab.asd	Fri Apr 20 11:33:46 2012	(r228)
+++ trunk/lisplab.asd	Fri Apr 20 11:40:23 2012	(r229)
@@ -132,8 +132,13 @@
     :depends-on (:src/interface/1)
     :serial t
     :components 
-    ((:file "matrix1-constructors")
-     (:file "level1-funmat")))
+    ((:file "matrix1-constructors")))
+
+   (:module :src/matrix/1/funmat
+    :depends-on (:src/interface/1)
+    :serial t
+    :components 
+    ((:file "level1-funmat")))
 
    (:module :src/matrix/1/generic
     :depends-on (:src/interface/1)

Copied: trunk/src/matrix/1/funmat/level1-funmat.lisp (from r227, trunk/src/matrix/1/level1-funmat.lisp)
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ trunk/src/matrix/1/funmat/level1-funmat.lisp	Fri Apr 20 11:40:23 2012	(r229, copy of r227, trunk/src/matrix/1/level1-funmat.lisp)
@@ -0,0 +1,64 @@
+;;; Lisplab, level1-dge.lisp
+;;; General, storeless matrices
+
+;;; 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)
+
+;;; Function matrices (matrices without a store)
+
+(defclass function-matrix
+    (structure-general element-base implementation-base vector-base)
+  ((mref
+    :initarg :mref
+    :initform (constantly 0)
+    :accessor function-matrix-mref
+    :type function)
+   (set-mref
+    :initarg :set-mref
+    :initform (constantly nil)
+    :accessor function-matrix-set-mref
+    :type function)
+   (vref
+    :initarg :vref
+    :initform (constantly 0)
+    :accessor function-matrix-vref 
+    :type function)
+   (set-vref
+    :initarg :set-vref
+    :initform (constantly nil)
+    :accessor function-matrix-set-vref
+    :type function))
+  (:documentation "Matrix without a store."))
+
+(defmethod initialize-instance :after ((m function-matrix) &key)
+  (with-slots (rows cols size) m
+    (setf size (* rows cols))))
+
+;;; Level1 methods specialized for the function matrix
+
+(defmethod mref ((f function-matrix) row col)
+  (funcall (function-matrix-mref f) f row col))
+
+(defmethod (setf mref) (value (f function-matrix) row col)
+  (funcall (function-matrix-set-mref f) value f row col))
+
+(defmethod vref ((f function-matrix) idx)
+  (funcall (function-matrix-vref f) f idx))
+
+(defmethod (setf vref) (value (f function-matrix) idx)
+  (funcall (function-matrix-set-vref f) value f idx))




More information about the lisplab-cvs mailing list