Commit 87dcb940 authored by Liam M. Healy's avatar Liam M. Healy
Browse files

Merge branch 'antik-multiple-systems' of git://repo.or.cz/gsll into antik-multiple-systems

parents 85f9ecd9 1107fc49
;; BLAS level 2, Matrix-vector operations ;; BLAS level 2, Matrix-vector operations
;; Liam Healy, Wed Apr 26 2006 - 21:08 ;; Liam Healy, Wed Apr 26 2006 - 21:08
;; Time-stamp: <2011-10-23 20:36:31EDT blas2.lisp> ;; Time-stamp: <2013-12-25 12:08:15EST blas2.lisp>
;; ;;
;; Copyright 2006, 2007, 2008, 2009, 2010, 2011 Liam M. Healy ;; Copyright 2006, 2007, 2008, 2009, 2010, 2011, 2013 Liam M. Healy
;; Distributed under the terms of the GNU General Public License ;; Distributed under the terms of the GNU General Public License
;; ;;
;; This program is free software: you can redistribute it and/or modify ;; This program is free software: you can redistribute it and/or modify
...@@ -26,11 +26,20 @@ ...@@ -26,11 +26,20 @@
;;;; Functions ;;;; Functions
;;;;**************************************************************************** ;;;;****************************************************************************
(defun matrix-product-dimensions (a b) (defun matrix-product-dimensions (a b &key (transa :notrans) (transb :notrans))
(if (typep b 'grid:matrix) (let ((dima (funcall
(list (first (grid:dimensions a)) (ecase transa
(second (grid:dimensions b))) (:notrans #'first)
(first (grid:dimensions a)))) (:trans #'second))
(grid:dimensions a))))
(if (typep b 'grid:matrix)
(list dima
(funcall
(ecase transb
(:notrans #'second)
(:trans #'first))
(grid:dimensions b)))
dima)))
(defmfun matrix-product (defmfun matrix-product
((A grid:matrix) (x vector) ((A grid:matrix) (x vector)
...@@ -40,7 +49,7 @@ ...@@ -40,7 +49,7 @@
&aux &aux
(yarr (yarr
(grid:ensure-foreign-array (grid:ensure-foreign-array
y (matrix-product-dimensions A x) element-type 0))) y (matrix-product-dimensions A x :transa transa) element-type 0)))
("gsl_blas_" :type "gemv") ("gsl_blas_" :type "gemv")
((transa cblas-transpose) (alpha :element-c-type) ((mpointer A) :pointer) ((transa cblas-transpose) (alpha :element-c-type) ((mpointer A) :pointer)
((mpointer x) :pointer) (beta :element-c-type) ((mpointer yarr) :pointer)) ((mpointer x) :pointer) (beta :element-c-type) ((mpointer yarr) :pointer))
......
;; BLAS level 3, Matrix-matrix operations ;; BLAS level 3, Matrix-matrix operations
;; Liam Healy, Wed Apr 26 2006 - 21:08 ;; Liam Healy, Wed Apr 26 2006 - 21:08
;; Time-stamp: <2011-10-23 20:37:22EDT blas3.lisp> ;; Time-stamp: <2013-12-25 12:10:44EST blas3.lisp>
;; ;;
;; Copyright 2006, 2007, 2008, 2009, 2010, 2011 Liam M. Healy ;; Copyright 2006, 2007, 2008, 2009, 2010, 2011, 2013 Liam M. Healy
;; Distributed under the terms of the GNU General Public License ;; Distributed under the terms of the GNU General Public License
;; ;;
;; This program is free software: you can redistribute it and/or modify ;; This program is free software: you can redistribute it and/or modify
...@@ -34,8 +34,10 @@ ...@@ -34,8 +34,10 @@
&aux &aux
(Carr (Carr
(or C (or C
(grid:make-foreign-array element-type :dimensions (matrix-product-dimensions A B) (grid:make-foreign-array
:initial-element 0)))) element-type
:dimensions (matrix-product-dimensions A B :transa TransA :transb TransB)
:initial-element 0))))
("gsl_blas_" :type "gemm") ("gsl_blas_" :type "gemm")
((TransA cblas-transpose) (TransB cblas-transpose) ((TransA cblas-transpose) (TransB cblas-transpose)
(alpha :element-c-type) ((mpointer A) :pointer) (alpha :element-c-type) ((mpointer A) :pointer)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment