[lisplab-cvs] r99 - src/matrix
Jørn Inge Vestgården
jivestgarden at common-lisp.net
Wed Sep 30 18:25:42 UTC 2009
Author: jivestgarden
Date: Wed Sep 30 14:25:41 2009
New Revision: 99
Log:
views
Removed:
src/matrix/level2-funmat.lisp
Modified:
lisplab.asd
package.lisp
src/matrix/level2-constructors.lisp
src/matrix/level2-interface.lisp
src/matrix/level2-view.lisp
Modified: lisplab.asd
==============================================================================
--- lisplab.asd (original)
+++ lisplab.asd Wed Sep 30 14:25:41 2009
@@ -75,7 +75,7 @@
(:file "level2-matrix-dge")
(:file "level2-matrix-zge")
(:file "level2-array-functions")
- (:file "level2-funmat")
+ (:file "level2-view")
(:file "level2-list")
))
Modified: package.lisp
==============================================================================
--- package.lisp (original)
+++ package.lisp Wed Sep 30 14:25:41 2009
@@ -178,8 +178,6 @@
"VIEW-ROW"
"VIEW-COL"
"VIEW-MATRIX"
- "VIEW-MATRIX-AS-VECTOR"
- "VIEW-VECTOR-AS-MATRIX"
"VIEW-TRANSPOSE"
"MSUM"
"MMIN"
Modified: src/matrix/level2-constructors.lisp
==============================================================================
--- src/matrix/level2-constructors.lisp (original)
+++ src/matrix/level2-constructors.lisp Wed Sep 30 14:25:41 2009
@@ -110,7 +110,7 @@
For example: (drange 4 0 1) -> 0 1 2 3, while
(drange 4 0 1 0.5) -> 0.5 1.5 2.5 3.5."
(let ((x (dnew 0 n 1))
- (dx (./ (.- to from))))
+ (dx (./ (.- to from) N)))
(dotimes (i n)
(setf (vref x i) (.+ from (.* dx (.+ i shift)))))
x))
Modified: src/matrix/level2-interface.lisp
==============================================================================
--- src/matrix/level2-interface.lisp (original)
+++ src/matrix/level2-interface.lisp Wed Sep 30 14:25:41 2009
@@ -94,12 +94,6 @@
(defgeneric view-matrix (matrix dim &optional (type))
(:documentation "Returns a shared structure view of the matrix"))
-(defgeneric view-matrix-as-vector (a)
- (:documentation "Returs a vector with same (shared) elements as the matrix"))
-
-(defgeneric view-vector-as-matrix (a rows)
- (:documentation "Returns a matrix with the same (shared) elements as the vector"))
-
(defgeneric view-transpose (a)
(:documentation "Returns a transposed matrix with same (shared) elements"))
Modified: src/matrix/level2-view.lisp
==============================================================================
--- src/matrix/level2-view.lisp (original)
+++ src/matrix/level2-view.lisp Wed Sep 30 14:25:41 2009
@@ -19,7 +19,8 @@
(in-package :lisplab)
-#+todo-make-this(defmethod view-matrix (matrix shape &optional (type))
+
+(defmethod view-matrix (matrix shape &optional (type))
"Outputs a function matrix"
(declare (ignore type))
(let* ((rows (car shape))
@@ -28,8 +29,6 @@
(make-instance 'function-matrix
:rows rows
:cols cols
- :size size
- :element-type (element-type matrix)
:mref #'(lambda (x i j)
(declare (ignore x))
(vref matrix (column-major-idx i j rows)))
@@ -42,46 +41,43 @@
:set-vref #'(lambda (value x i)
(declare (ignore x))
(setf (vref matrix i) value)))))
-
(defmethod view-row (matrix row)
- "Outputs a function matrix."
- (make-instance
- 'function-matrix
- :rows (cols matrix)
- :cols 1
- :mref #'(lambda (x i j)
- (declare (ignore x j))
- (mref matrix row i))
- :set-mref #'(lambda (value x i j)
- (declare (ignore x i))
- (setf (mref matrix row j) value))
- :vref #'(lambda (x i)
- (declare (ignore x))
- (mref matrix row i))
- :set-vref #'(lambda (value x i)
- (declare (ignore x))
- (setf (mref matrix row i) value))))
+ "Outputs a function matrix"
+ (make-instance 'function-matrix
+ :rows 1
+ :cols (cols matrix)
+ :mref #'(lambda (x i j)
+ (declare (ignore x i))
+ (mref matrix row j))
+ :set-mref #'(lambda (value x i j)
+ (declare (ignore x j))
+ (setf (mref matrix row i) value))
+ :vref #'(lambda (x i)
+ (declare (ignore x))
+ (mref matrix row i))
+ :set-vref #'(lambda (value x i)
+ (declare (ignore x))
+ (setf (mref matrix row i) value))))
(defmethod view-col (matrix col)
- "Outputs a function matrix."
- (make-instance
- 'function-matrix
- :rows (rows matrix)
- :cols 1
- :mref #'(lambda (x i j)
- (declare (ignore x j))
- (mref matrix i col))
- :set-mref #'(lambda (value x i j)
- (declare (ignore x j))
- (setf (mref matrix i col) value))
- :vref #'(lambda (x i)
- (declare (ignore x))
- (mref matrix i col))
- :set-vref #'(lambda (value x i)
- (declare (ignore x))
- (setf (mref matrix i col) value))))
+ "Outputs a function matrix"
+ (make-instance 'function-matrix
+ :rows (rows matrix)
+ :cols 1
+ :mref #'(lambda (x i j)
+ (declare (ignore x j))
+ (mref matrix i col))
+ :set-mref #'(lambda (value x i j)
+ (declare (ignore x j))
+ (setf (mref matrix i col) value))
+ :vref #'(lambda (x i)
+ (declare (ignore x))
+ (mref matrix i col))
+ :set-vref #'(lambda (value x i)
+ (declare (ignore x))
+ (setf (mref matrix i col) value))))
-#+todo-make-this(defmethod view-transpose (matrix)
+(defmethod view-transpose (matrix)
"Outputs a function matrix"
(make-instance 'function-matrix
:rows (cols matrix)
@@ -101,7 +97,3 @@
(declare (ignore x))
(setf (vref matrix i) value))))
-
-
-
-
More information about the lisplab-cvs
mailing list