From: Akshay S. <ak...@us...> - 2013-02-03 22:29:04
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "matlisp". The branch, tensor has been updated via 926c7dc0991dbe277f1802ab9074b89599cc5008 (commit) from 2f7115f30d58288fdc9b160ce621ab19d1277772 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 926c7dc0991dbe277f1802ab9074b89599cc5008 Author: Akshay Srinivasan <aks...@gm...> Date: Sun Feb 3 14:28:44 2013 -0800 Moved function definitions out of (eval-when ..). diff --git a/src/ffi/f77-ffi.lisp b/src/ffi/f77-ffi.lisp index b03b2c5..31031c2 100644 --- a/src/ffi/f77-ffi.lisp +++ b/src/ffi/f77-ffi.lisp @@ -546,7 +546,7 @@ ,@pars)) (setq hack-return-type :void))) - `(eval-when (:compile-toplevel :load-toplevel :execute) + `(progn (cffi:defcfun (,fortran-name ,lisp-name) ,(%f77.get-return-type hack-return-type) ,@(%f77.parse-fortran-parameters hack-body)) ,@(%f77.def-fortran-interface name hack-return-type hack-body hidden-var-name))))) diff --git a/src/lapack/getrf.lisp b/src/lapack/getrf.lisp index d5a17ae..7e32538 100644 --- a/src/lapack/getrf.lisp +++ b/src/lapack/getrf.lisp @@ -32,11 +32,12 @@ (let* ((opt (if-ret (get-tensor-class-optimization-hashtable tensor-class) (error 'tensor-cannot-find-optimization :tensor-class tensor-class))) (matrix-class (getf opt :matrix))) - `(eval-when (:compile-toplevel :load-toplevel :execute) - (let ((opt (get-tensor-class-optimization-hashtable ',tensor-class))) - (assert opt nil 'tensor-cannot-find-optimization :tensor-class ',tensor-class) - (setf (getf opt :getrf) ',func-name - (get-tensor-class-optimization ',tensor-class) opt)) + `(progn + (eval-when (:compile-toplevel :load-toplevel :execute) + (let ((opt (get-tensor-class-optimization-hashtable ',tensor-class))) + (assert opt nil 'tensor-cannot-find-optimization :tensor-class ',tensor-class) + (setf (getf opt :getrf) ',func-name + (get-tensor-class-optimization ',tensor-class) opt))) (defun ,func-name (A ipiv) (declare (type ,matrix-class A) (type permutation-pivot-flip ipiv)) @@ -136,13 +137,12 @@ (let* ((opt (if-ret (get-tensor-class-optimization-hashtable tensor-class) (error 'tensor-cannot-find-optimization :tensor-class tensor-class))) (matrix-class (getf opt :matrix))) - `(eval-when (:compile-toplevel :load-toplevel :execute) - (defmethod lu ((A ,matrix-class) &optional (split-lu? t)) - (multiple-value-bind (lu ipiv info) - (getrf! (with-order :col-major - (,(getf opt :copy) A (,(getf opt :zero-maker) (dimensions A))))) - (declare (ignore info)) - (let* ((n (nrows a)) + `(defmethod lu ((A ,matrix-class) &optional (split-lu? t)) + (multiple-value-bind (lu ipiv info) + (getrf! (with-order :col-major + (,(getf opt :copy) A (,(getf opt :zero-maker) (dimensions A))))) + (declare (ignore info)) + (let* ((n (nrows a)) (m (ncols a)) (p (min n m))) (declare (type fixnum n m p)) @@ -197,7 +197,7 @@ (incf lu.of (- lu.cstd (the index-type (* (- n j 2) lu.rstd)))) (incf l.of (- l.cstd (the index-type (* (- n j 2) l.rstd))))))) (values lmat lu ipiv))) - (values lu ipiv)))))))) + (values lu ipiv))))))) (make-lu real-tensor) (make-lu complex-tensor) diff --git a/src/level-1/axpy.lisp b/src/level-1/axpy.lisp index d161d97..25966de 100644 --- a/src/level-1/axpy.lisp +++ b/src/level-1/axpy.lisp @@ -34,11 +34,12 @@ ;;Use only after checking the arguments for compatibility. (let* ((opt (get-tensor-class-optimization-hashtable tensor-class))) (assert opt nil 'tensor-cannot-find-optimization :tensor-class tensor-class) - `(eval-when (:compile-toplevel :load-toplevel :execute) - (let ((opt (get-tensor-class-optimization-hashtable ',tensor-class))) - (assert opt nil 'tensor-cannot-find-optimization :tensor-class ',tensor-class) - (setf (getf opt :axpy) ',func - (get-tensor-class-optimization ',tensor-class) opt)) + `(progn + (eval-when (:compile-toplevel :load-toplevel :execute) + (let ((opt (get-tensor-class-optimization-hashtable ',tensor-class))) + (assert opt nil 'tensor-cannot-find-optimization :tensor-class ',tensor-class) + (setf (getf opt :axpy) ',func + (get-tensor-class-optimization ',tensor-class) opt))) (defun ,func (alpha from to) (declare (type ,tensor-class from to) (type ,(getf opt :element-type) alpha)) @@ -80,11 +81,12 @@ ;;Use only after checking the arguments for compatibility. (let* ((opt (get-tensor-class-optimization tensor-class))) (assert opt nil 'tensor-cannot-find-optimization :tensor-class tensor-class) - `(eval-when (:compile-toplevel :load-toplevel :execute) - (let ((opt (get-tensor-class-optimization-hashtable ',tensor-class))) - (assert opt nil 'tensor-cannot-find-optimization :tensor-class ',tensor-class) - (setf (getf opt :num-axpy) ',func - (get-tensor-class-optimization ',tensor-class) opt)) + `(progn + (eval-when (:compile-toplevel :load-toplevel :execute) + (let ((opt (get-tensor-class-optimization-hashtable ',tensor-class))) + (assert opt nil 'tensor-cannot-find-optimization :tensor-class ',tensor-class) + (setf (getf opt :num-axpy) ',func + (get-tensor-class-optimization ',tensor-class) opt))) (defun ,func (num-from to) (declare (type ,tensor-class to) (type ,(getf opt :element-type) num-from)) diff --git a/src/level-1/copy.lisp b/src/level-1/copy.lisp index 6680e8a..880ccf5 100644 --- a/src/level-1/copy.lisp +++ b/src/level-1/copy.lisp @@ -34,11 +34,12 @@ ;;Use only after checking the arguments for compatibility. (let* ((opt (get-tensor-class-optimization-hashtable tensor-class))) (assert opt nil 'tensor-cannot-find-optimization :tensor-class tensor-class) - `(eval-when (:compile-toplevel :load-toplevel :execute) - (let ((opt (get-tensor-class-optimization-hashtable ',tensor-class))) - (assert opt nil 'tensor-cannot-find-optimization :tensor-class ',tensor-class) - (setf (getf opt :copy) ',func - (get-tensor-class-optimization ',tensor-class) opt)) + `(progn + (eval-when (:compile-toplevel :load-toplevel :execute) + (let ((opt (get-tensor-class-optimization-hashtable ',tensor-class))) + (assert opt nil 'tensor-cannot-find-optimization :tensor-class ',tensor-class) + (setf (getf opt :copy) ',func + (get-tensor-class-optimization ',tensor-class) opt))) (defun ,func (from to) (declare (type ,tensor-class from to)) ,(let @@ -76,11 +77,12 @@ ;;Use only after checking the arguments for compatibility. (let* ((opt (get-tensor-class-optimization-hashtable tensor-class))) (assert opt nil 'tensor-cannot-find-optimization :tensor-class tensor-class) - `(eval-when (:compile-toplevel :load-toplevel :execute) - (let ((opt (get-tensor-class-optimization-hashtable ',tensor-class))) - (assert opt nil 'tensor-cannot-find-optimization :tensor-class ',tensor-class) - (setf (getf opt :num-copy) ',func - (get-tensor-class-optimization ',tensor-class) opt)) + `(progn + (eval-when (:compile-toplevel :load-toplevel :execute) + (let ((opt (get-tensor-class-optimization-hashtable ',tensor-class))) + (assert opt nil 'tensor-cannot-find-optimization :tensor-class ',tensor-class) + (setf (getf opt :num-copy) ',func + (get-tensor-class-optimization ',tensor-class) opt))) (defun ,func (num-from to) (declare (type ,tensor-class to) (type ,(getf opt :element-type) num-from)) diff --git a/src/level-1/dot.lisp b/src/level-1/dot.lisp index 435cff1..8e1fe89 100644 --- a/src/level-1/dot.lisp +++ b/src/level-1/dot.lisp @@ -34,11 +34,12 @@ (assert opt nil 'tensor-cannot-find-optimization :tensor-class tensor-class) (setf (getf opt :dot) func (get-tensor-class-optimization tensor-class) opt) - `(eval-when (:compile-toplevel :load-toplevel :execute) - (let ((opt (get-tensor-class-optimization-hashtable ',tensor-class))) - (assert opt nil 'tensor-cannot-find-optimization :tensor-class ',tensor-class) - (setf (getf opt :axpy) ',func - (get-tensor-class-optimization ',tensor-class) opt)) + `(progn + (eval-when (:compile-toplevel :load-toplevel :execute) + (let ((opt (get-tensor-class-optimization-hashtable ',tensor-class))) + (assert opt nil 'tensor-cannot-find-optimization :tensor-class ',tensor-class) + (setf (getf opt :axpy) ',func + (get-tensor-class-optimization ',tensor-class) opt))) (defun ,func (x y conjugate-p) (declare (type ,tensor-class x y) ,(if conj? diff --git a/src/level-1/scal.lisp b/src/level-1/scal.lisp index ad2749d..72a7962 100644 --- a/src/level-1/scal.lisp +++ b/src/level-1/scal.lisp @@ -31,11 +31,12 @@ (defmacro generate-typed-scal! (func (tensor-class fortran-func fortran-lb)) (let* ((opt (get-tensor-class-optimization-hashtable tensor-class))) (assert opt nil 'tensor-cannot-find-optimization :tensor-class tensor-class) - `(eval-when (:compile-toplevel :load-toplevel :execute) - (let ((opt (get-tensor-class-optimization-hashtable ',tensor-class))) - (assert opt nil 'tensor-cannot-find-optimization :tensor-class ',tensor-class) - (setf (getf opt :scal) ',func - (get-tensor-class-optimization ',tensor-class) opt)) + `(progn + (eval-when (:compile-toplevel :load-toplevel :execute) + (let ((opt (get-tensor-class-optimization-hashtable ',tensor-class))) + (assert opt nil 'tensor-cannot-find-optimization :tensor-class ',tensor-class) + (setf (getf opt :scal) ',func + (get-tensor-class-optimization ',tensor-class) opt))) (defun ,func (from to) (declare (type ,tensor-class from to)) ,(let @@ -69,11 +70,12 @@ (defmacro generate-typed-num-scal! (func (tensor-class blas-func fortran-lb)) (let ((opt (get-tensor-class-optimization-hashtable tensor-class))) (assert opt nil 'tensor-cannot-find-optimization :tensor-class tensor-class) - `(eval-when (:compile-toplevel :load-toplevel :execute) - (let ((opt (get-tensor-class-optimization-hashtable ',tensor-class))) - (assert opt nil 'tensor-cannot-find-optimization :tensor-class ',tensor-class) - (setf (getf opt :num-scal) ',func - (get-tensor-class-optimization ',tensor-class) opt)) + `(progn + (eval-when (:compile-toplevel :load-toplevel :execute) + (let ((opt (get-tensor-class-optimization-hashtable ',tensor-class))) + (assert opt nil 'tensor-cannot-find-optimization :tensor-class ',tensor-class) + (setf (getf opt :num-scal) ',func + (get-tensor-class-optimization ',tensor-class) opt))) (defun ,func (alpha to) (declare (type ,tensor-class to) (type ,(getf opt :element-type) alpha)) @@ -101,11 +103,12 @@ (defmacro generate-typed-div! (func (tensor-class fortran-func fortran-lb)) (let* ((opt (get-tensor-class-optimization-hashtable tensor-class))) (assert opt nil 'tensor-cannot-find-optimization :tensor-class tensor-class) - `(eval-when (:compile-toplevel :load-toplevel :execute) - (let ((opt (get-tensor-class-optimization-hashtable ',tensor-class))) - (assert opt nil 'tensor-cannot-find-optimization :tensor-class ',tensor-class) - (setf (getf opt :div) ',func - (get-tensor-class-optimization ',tensor-class) opt)) + `(progn + (eval-when (:compile-toplevel :load-toplevel :execute) + (let ((opt (get-tensor-class-optimization-hashtable ',tensor-class))) + (assert opt nil 'tensor-cannot-find-optimization :tensor-class ',tensor-class) + (setf (getf opt :div) ',func + (get-tensor-class-optimization ',tensor-class) opt))) (defun ,func (from to) (declare (type ,tensor-class from to)) ,(let @@ -139,11 +142,12 @@ (defmacro generate-typed-num-div! (func (tensor-class fortran-func fortran-lb)) (let ((opt (get-tensor-class-optimization tensor-class))) (assert opt nil 'tensor-cannot-find-optimization :tensor-class tensor-class) - `(eval-when (:compile-toplevel :load-toplevel :execute) - (let ((opt (get-tensor-class-optimization-hashtable ',tensor-class))) - (assert opt nil 'tensor-cannot-find-optimization :tensor-class ',tensor-class) - (setf (getf opt :num-div) ',func - (get-tensor-class-optimization ',tensor-class) opt)) + `(progn + (eval-when (:compile-toplevel :load-toplevel :execute) + (let ((opt (get-tensor-class-optimization-hashtable ',tensor-class))) + (assert opt nil 'tensor-cannot-find-optimization :tensor-class ',tensor-class) + (setf (getf opt :num-div) ',func + (get-tensor-class-optimization ',tensor-class) opt))) (defun ,func (alpha to) (declare (type ,tensor-class to) (type ,(getf opt :element-type) alpha)) diff --git a/src/level-1/swap.lisp b/src/level-1/swap.lisp index 9464bc8..d9febc0 100644 --- a/src/level-1/swap.lisp +++ b/src/level-1/swap.lisp @@ -34,11 +34,12 @@ ;;Use only after checking the arguments for compatibility. (let* ((opt (get-tensor-class-optimization-hashtable tensor-class))) (assert opt nil 'tensor-cannot-find-optimization :tensor-class tensor-class) - `(eval-when (:compile-toplevel :load-toplevel :execute) - (let ((opt (get-tensor-class-optimization-hashtable ',tensor-class))) - (assert opt nil 'tensor-cannot-find-optimization :tensor-class ',tensor-class) - (setf (getf opt :swap) ',func - (get-tensor-class-optimization ',tensor-class) opt)) + `(progn + (eval-when (:compile-toplevel :load-toplevel :execute) + (let ((opt (get-tensor-class-optimization-hashtable ',tensor-class))) + (assert opt nil 'tensor-cannot-find-optimization :tensor-class ',tensor-class) + (setf (getf opt :swap) ',func + (get-tensor-class-optimization ',tensor-class) opt))) (defun ,func (x y) (declare (type ,tensor-class x y)) ,(let diff --git a/src/level-1/tensor-maker.lisp b/src/level-1/tensor-maker.lisp index f4e66bc..1620666 100644 --- a/src/level-1/tensor-maker.lisp +++ b/src/level-1/tensor-maker.lisp @@ -3,11 +3,12 @@ (defmacro make-tensor-maker (func-name (tensor-class)) (let ((opt (get-tensor-class-optimization-hashtable tensor-class))) (assert opt nil 'tensor-cannot-find-optimization :tensor-class tensor-class) - `(eval-when (:compile-toplevel :load-toplevel :execute) - (let ((opt (get-tensor-class-optimization-hashtable ',tensor-class))) - (assert opt nil 'tensor-cannot-find-optimization :tensor-class ',tensor-class) - (setf (getf opt :maker) ',func-name - (get-tensor-class-optimization ',tensor-class) opt)) + `(progn + (eval-when (:compile-toplevel :load-toplevel :execute) + (let ((opt (get-tensor-class-optimization-hashtable ',tensor-class))) + (assert opt nil 'tensor-cannot-find-optimization :tensor-class ',tensor-class) + (setf (getf opt :maker) ',func-name + (get-tensor-class-optimization ',tensor-class) opt))) (defun ,func-name (&rest args) (labels ((make-dims (dims) (declare (type cons dims)) @@ -67,11 +68,12 @@ (defmacro make-zeros-dims (func-name (tensor-class)) (let ((opt (get-tensor-class-optimization-hashtable tensor-class))) (assert opt nil 'tensor-cannot-find-optimization :tensor-class tensor-class) - `(eval-when (:compile-toplevel :load-toplevel :execute) - (let ((opt (get-tensor-class-optimization-hashtable ',tensor-class))) - (assert opt nil 'tensor-cannot-find-optimization :tensor-class ',tensor-class) - (setf (getf opt :zero-maker) ',func-name - (get-tensor-class-optimization ',tensor-class) opt)) + `(progn + (eval-when (:compile-toplevel :load-toplevel :execute) + (let ((opt (get-tensor-class-optimization-hashtable ',tensor-class))) + (assert opt nil 'tensor-cannot-find-optimization :tensor-class ',tensor-class) + (setf (getf opt :zero-maker) ',func-name + (get-tensor-class-optimization ',tensor-class) opt))) (defun ,func-name (dims) (declare (type (or cons index-store-vector) dims)) (let*-typed ((dims (if (consp dims) (make-index-store dims) (copy-seq dims)) :type index-store-vector) diff --git a/src/level-2/gemv.lisp b/src/level-2/gemv.lisp index 033d36e..9307caa 100644 --- a/src/level-2/gemv.lisp +++ b/src/level-2/gemv.lisp @@ -7,11 +7,12 @@ (error 'tensor-cannot-find-optimization :tensor-class tensor-class))) (matrix-class (getf opt :matrix)) (vector-class (getf opt :vector))) - `(eval-when (:compile-toplevel :load-toplevel :execute) - (let ((opt (get-tensor-class-optimization-hashtable ',tensor-class))) - (assert opt nil 'tensor-cannot-find-optimization :tensor-class ',tensor-class) - (setf (getf opt :gemv) ',func - (get-tensor-class-optimization ',tensor-class) opt)) + `(progn + (eval-when (:compile-toplevel :load-toplevel :execute) + (let ((opt (get-tensor-class-optimization-hashtable ',tensor-class))) + (assert opt nil 'tensor-cannot-find-optimization :tensor-class ',tensor-class) + (setf (getf opt :gemv) ',func + (get-tensor-class-optimization ',tensor-class) opt))) (defun ,func (alpha A x beta y job) (declare (type ,(getf opt :element-type) alpha beta) (type ,matrix-class A) diff --git a/src/level-3/gemm.lisp b/src/level-3/gemm.lisp index bd59f29..b24fc76 100644 --- a/src/level-3/gemm.lisp +++ b/src/level-3/gemm.lisp @@ -33,11 +33,12 @@ (error 'tensor-cannot-find-optimization :tensor-class tensor-class))) (matrix-class (getf opt :matrix)) (blas? blas-gemm-func)) - `(eval-when (:compile-toplevel :load-toplevel :execute) - (let ((opt (get-tensor-class-optimization-hashtable ',tensor-class))) - (assert opt nil 'tensor-cannot-find-optimization :tensor-class ',tensor-class) - (setf (getf opt :gemm) ',func - (get-tensor-class-optimization ',tensor-class) opt)) + `(progn + (eval-when (:compile-toplevel :load-toplevel :execute) + (let ((opt (get-tensor-class-optimization-hashtable ',tensor-class))) + (assert opt nil 'tensor-cannot-find-optimization :tensor-class ',tensor-class) + (setf (getf opt :gemm) ',func + (get-tensor-class-optimization ',tensor-class) opt))) (defun ,func (alpha A B beta C job) (declare (type ,(getf opt :element-type) alpha beta) (type ,matrix-class A B C) ----------------------------------------------------------------------- Summary of changes: src/ffi/f77-ffi.lisp | 2 +- src/lapack/getrf.lisp | 26 ++++++++++++------------ src/level-1/axpy.lisp | 22 +++++++++++--------- src/level-1/copy.lisp | 22 +++++++++++--------- src/level-1/dot.lisp | 11 +++++---- src/level-1/scal.lisp | 44 ++++++++++++++++++++++------------------ src/level-1/swap.lisp | 11 +++++---- src/level-1/tensor-maker.lisp | 22 +++++++++++--------- src/level-2/gemv.lisp | 11 +++++---- src/level-3/gemm.lisp | 11 +++++---- 10 files changed, 98 insertions(+), 84 deletions(-) hooks/post-receive -- matlisp |