[lisplab-cvs] r15 - src/matrix
Jørn Inge Vestgården
jivestgarden at common-lisp.net
Wed May 6 18:06:24 UTC 2009
Author: jivestgarden
Date: Wed May 6 14:06:23 2009
New Revision: 15
Log:
removed dead code
Modified:
src/matrix/level1-array.lisp
Modified: src/matrix/level1-array.lisp
==============================================================================
--- src/matrix/level1-array.lisp (original)
+++ src/matrix/level1-array.lisp Wed May 6 14:06:23 2009
@@ -87,140 +87,3 @@
(defmethod cols ((a array))
(array-dimension a 1))
-
-
-
-;;;; TRASH
-
-#+to-remove (defmethod create ((a array) &optional (value 0) dim)
- (unless dim (setf dim (dim a)))
- (unless (consp dim) (setf dim (list dim 1)))
- (let ((tp (element-type a)))
- (make-array dim
- :element-type tp
- :initial-element (coerce value tp))))
-
-#+to-remove (defmethod ref ((a array) &rest idx)
- "Row major order"
- (if (cdr idx)
- (aref a (car idx) (cadr idx))
- (row-major-aref a (car idx))))
-
-#+to-remove (defmethod (setf ref) (value (a array) &rest idx)
- (if (cdr idx)
- (setf (aref a (car idx) (cadr idx))
- (convert value (element-type a)))
- (setf (row-major-aref a (car idx))
- (convert value (element-type a)))))
-
-
-#+to-remove (defmethod ->1d! ((a array))
- "Destructively makes the array one dimensional"
- (if (vector? a)
- a
- (make-array (size a) :displaced-to a :element-type (element-type a))))
-
-#+to-remove (defmethod .fill! ((a array) val)
- (let ((b (->1d! a)))
- (map b (constantly val) b)
- val))
-
-#+to-remove (defmethod copy-dim ((a array))
- (make-array (dim a) :element-type (element-type a)))
-
-#+to-remove (defmethod copy ((a array))
- "Copy array, dimensions and contents. No fill-pointer and such things
-TODO speed up, it's important"
- (let* ((a1 (->1d! a))
- (b (make-array (dim a)
- :element-type (element-type a)))
- (b1 (->1d! b)))
- (dotimes (i (size a1))
- (setf (aref b1 i) (aref a1 i)))
- b))
-
-#+to-remove (defmethod mtranspose! ((a array))
- "Destrutive matrix transpose"
- (assert (= (dim a 0) (dim a 1)))
- (dotimes (i (rows a))
- (dotimes (j (cols a))
- (let ((tmp (aref a i j)))
- (setf (aref a j i) (aref a i j)
- (aref a j i) tmp))))
- a)
-
-#+to-remove (defmethod ->1d ((a array))
- "Unrolls the array to a vector"
- (let ((b (make-array (size a) :element-type (element-type a))))
- (dotimes (i (size b))
- (setf (aref b i)
- (row-major-aref a i)))
- b))
-
-
-
-
-#+nil (defmethod mtranspose ((a array))
- "Matrix transpose" ; TODO remove
- (let ((b (make-array (reverse (dim A)) :element-type (element-type a))))
- (dotimes (i (rows a))
- (dotimes (j (cols a))
- (setf (aref b i j) (aref a j i))))
- b))
-
-
-
-#+nil (defmethod coerce-element-type ((a array) type)
- "Makes an new array with the elements
-converted to the new type"
- (let ((b (make-array (dim a) :element-type type)))
- (dotimes (i (size a))
- (setf (row-major-aref b i)
- (coerce
- (row-major-aref a i)
- type)))
- b))
-
-#+nil (defmethod get-row! (A row)
- (make-array (cols A)
- :displaced-to A
- :displaced-index-offset (* row (cols A))
- :element-type (element-type A)))
-
-#+nil (defmethod get-row ((A array) row)
- (let ((x (1d (zero A) (cols A))))
- (dotimes (i (cols A))
- (setf (aref x i) (aref A row i)))
- x))
-
-#+nil (defmethod get-col ((A array) col)
- (let ((x (1d (zero A) (rows A))))
- (dotimes (i (rows A))
- (setf (aref x i) (aref A i col)))
- x))
-
-#+nil (defmethod set-row ((A array) row (x array))
- (dotimes (i (cols A))
- (setf (aref A row i) (aref x i)))
- A)
-
-#+nil (defmethod set-col ((A array) col (x array))
- (dotimes (i (rows A))
- (setf (aref A i col) (aref x i)))
- A)
-
-
-
-
-#+nil (defmethod take-type (a)
- "Take the approximate type of the object"
- (if (rationalp a)
- 'rational
- (type-of a)))
-
-#+nil (defmethod take-type ((a array))
- (array-element-type a))
-
-#+nil (defmethod size ((a array))
- "The unrolled length of the indexed object"
- (reduce '* (dim a)))
More information about the lisplab-cvs
mailing list