[lisplab-cvs] r73 - src/matrix
Jørn Inge Vestgården
jivestgarden at common-lisp.net
Sat Aug 8 17:42:45 UTC 2009
Author: jivestgarden
Date: Sat Aug 8 13:42:45 2009
New Revision: 73
Log:
optimized mref
Modified:
src/matrix/level1-matrix.lisp
Modified: src/matrix/level1-matrix.lisp
==============================================================================
--- src/matrix/level1-matrix.lisp (original)
+++ src/matrix/level1-matrix.lisp Sat Aug 8 13:42:45 2009
@@ -18,6 +18,8 @@
;;; with this program; if not, write to the Free Software Foundation, Inc.,
;;; 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+;;; Note: use the slot-value rather than the methods, since slot-value is faster.
+
;;; TODO: clean up
(in-package :lisplab)
@@ -65,61 +67,65 @@
;;; The general matrix
(defmethod mref ((matrix matrix-ge) row col)
- (aref (matrix-store matrix) (column-major-idx row col (rows matrix))))
+ (aref (slot-value matrix 'matrix-store)
+ (column-major-idx row col (slot-value matrix 'rows))))
(defmethod (setf mref) (value (matrix matrix-ge) row col)
- (setf (aref (matrix-store matrix) (column-major-idx row col (rows matrix)))
+ (setf (aref (slot-value matrix 'matrix-store)
+ (column-major-idx row col (slot-value matrix 'rows)))
value))
(defmethod vref ((matrix matrix-ge) idx)
- (aref (matrix-store matrix) idx))
+ (aref (slot-value matrix 'matrix-store) idx))
(defmethod (setf vref) (value (matrix matrix-ge) idx)
- (setf (aref (matrix-store matrix) idx)
+ (setf (aref (slot-value matrix 'matrix-store) idx)
value))
;;; Spcialized for blas-dge
(defmethod mref ((matrix matrix-base-dge) row col)
- (ref-blas-real-store (matrix-store matrix) row col (rows matrix)))
+ (ref-blas-real-store (slot-value matrix 'matrix-store) row col (slot-value matrix 'rows)))
(defmethod (setf mref) (value (matrix matrix-base-dge) row col)
(let ((val2 (coerce value 'double-float)))
(declare (type double-float val2))
- (setf (ref-blas-real-store (matrix-store matrix) row col (rows matrix))
+ (setf (ref-blas-real-store (slot-value matrix 'matrix-store)
+ row col (slot-value matrix 'rows))
val2)
val2))
(defmethod vref ((matrix matrix-base-dge) idx)
- (aref (the type-blas-store (matrix-store matrix)) idx))
+ (aref (the type-blas-store (slot-value matrix 'matrix-store)) idx))
(defmethod (setf vref) (value (matrix matrix-base-dge) idx)
(let ((val2 (coerce value 'double-float)))
(declare (type double-float val2))
- (setf (aref (the type-blas-store (matrix-store matrix)) idx)
+ (setf (aref (the type-blas-store (slot-value matrix 'matrix-store)) idx)
val2)
val2))
;;; Spcialized for blas-zge
(defmethod mref ((matrix matrix-base-zge) row col)
- (ref-blas-complex-store (matrix-store matrix)
- row col (rows matrix)))
+ (ref-blas-complex-store (slot-value matrix 'matrix-store)
+ row col (slot-value matrix 'rows)))
(defmethod (setf mref) (value (matrix matrix-base-zge) row col)
(let ((val2 (coerce value '(complex double-float))))
(declare (type (complex double-float) val2))
- (setf (ref-blas-complex-store (matrix-store matrix) row col (rows matrix))
+ (setf (ref-blas-complex-store (slot-value matrix 'matrix-store)
+ row col (slot-value matrix 'rows))
val2)
val2))
(defmethod vref ((matrix matrix-base-zge) i)
- (ref-blas-complex-store (matrix-store matrix) i 0 1))
+ (ref-blas-complex-store (slot-value matrix 'matrix-store) i 0 1))
(defmethod (setf vref) (value (matrix matrix-base-zge) i)
(let ((val2 (coerce value '(complex double-float))))
(declare (type (complex double-float) val2))
- (setf (ref-blas-complex-store (matrix-store matrix) i 0 1)
+ (setf (ref-blas-complex-store (slot-value matrix 'matrix-store) i 0 1)
val2)
val2))
More information about the lisplab-cvs
mailing list