From: Raymond T. <rt...@us...> - 2010-12-07 14:40:27
|
Update of /cvsroot/maxima/maxima/share/lapack In directory sfp-cvsdas-4.v30.ch3.sourceforge.com:/tmp/cvs-serv1978/share/lapack Modified Files: lapack.mac lapack.system Added Files: dgemm.lisp Log Message: Add simple interface to LAPACK dgemm routine for general real matrix multiplication. share/lapack/lapack.mac: o Define dgemm share/lapack/lapack.system: o Build dgemm.lisp doc/info/lapack.texi: o Add rudimentary documentation for dgemm. share/lapack/dgemm.lisp: o New file containing implementation of interface to dgemm. --- NEW FILE: dgemm.lisp --- ;;; Simple raw interface to LAPACK dgemm, general real matrix ;;; multiplication. (in-package :maxima) (defun %%dgemm (a b &key c transpose_a transpose_b (alpha 1d0) (beta 0d0)) (multiple-value-bind (a-nrows a-ncols) (maxima-matrix-dims a) (multiple-value-bind (b-nrows b-ncols) (maxima-matrix-dims b) (let ((alpha ($float alpha)) (beta ($float beta)) (matrix-a (lapack-lispify-matrix a a-nrows a-ncols)) (matrix-b (lapack-lispify-matrix b a-nrows a-ncols)) (matrix-c (cond ((and c (not (zerop beta))) (lapack-lispify-matrix c a-nrows b-ncols)) (t ;; No C matrix given, or beta is zero. ;; Force beta to be zero to tell LAPACK ;; not to add C. But we still need to ;; create a matrix. (setf beta 0d0) (make-array (* a-nrows b-ncols) :element-type 'double-float)))) (trans-a (if transpose_a "t" "n")) (trans-b (if transpose_b "t" "n"))) (blas::dgemm trans-a trans-b a-nrows b-ncols a-ncols alpha matrix-a a-nrows matrix-b b-nrows beta matrix-c a-nrows) ;; matrix-c contains the desired result. (lapack-maxify-matrix a-nrows b-ncols matrix-c))))) ;; Main interface from maxima to Lapack routine dgemm. Just parses ;; args and calls %%dgemm to do the dirty work. (defun $%dgemm (a b options) (let* ((args (lispify-maxima-keyword-options (cdr options) '($c $transpose_a $transpose_b $alpha $beta)))) (apply #'%%dgemm a b args))) Index: lapack.mac =================================================================== RCS file: /cvsroot/maxima/maxima/share/lapack/lapack.mac,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- lapack.mac 5 Jan 2007 18:17:38 -0000 1.1 +++ lapack.mac 7 Dec 2010 14:40:18 -0000 1.2 @@ -1 +1,4 @@ load("load-lapack.lisp"); + +dgemm(a, b, [options]) := + %dgemm(a, b, options); Index: lapack.system =================================================================== RCS file: /cvsroot/maxima/maxima/share/lapack/lapack.system,v retrieving revision 1.9 retrieving revision 1.10 diff -u -d -r1.9 -r1.10 --- lapack.system 18 Jul 2010 00:36:44 -0000 1.9 +++ lapack.system 7 Dec 2010 14:40:18 -0000 1.10 @@ -340,4 +340,5 @@ :components ( (:file "eigensys") - (:file "dgesv"))) + (:file "dgesv") + (:file "dgemm"))) |