Add gemv
This commit is contained in:
parent
db60c8841d
commit
29d35b333b
1 changed files with 19 additions and 0 deletions
|
@ -222,6 +222,25 @@
|
||||||
do (setf m (max m (abs (aref x i)))))
|
do (setf m (max m (abs (aref x i)))))
|
||||||
m))
|
m))
|
||||||
|
|
||||||
|
;;;; Level 2 BLAS: matrix-vector, O(n^2) operations
|
||||||
|
|
||||||
|
;;; gemv
|
||||||
|
|
||||||
|
(defblas gemv ((A 2) (x 1) (y 1) (alpha 0) (beta 0))
|
||||||
|
(let* ((n (array-dimension A 1))
|
||||||
|
(n-block (* (floor n stride) stride))
|
||||||
|
(alpha-vec (simd alpha)))
|
||||||
|
(declare (fixnum n n-block)
|
||||||
|
(simd alpha-vec))
|
||||||
|
(loop for i fixnum from 0 below (array-dimension A 0)
|
||||||
|
do (setf (aref y i)
|
||||||
|
(+ (* beta (aref y i))
|
||||||
|
(loop for acc of-type simd = (simd 0) then (simd+ acc (simd* alpha-vec (simd-aref A i j) (aref x j)))
|
||||||
|
for j fixnum from 0 below n-block by stride
|
||||||
|
finally (return (the float (simd-horizontal+ acc))))
|
||||||
|
(loop for j fixnum from n-block below n
|
||||||
|
sum (* alpha (aref A i j) (aref x j)) of-type float))))))
|
||||||
|
|
||||||
;;;; Level 3 BLAS: matrix-matrix, O(n^3) operations
|
;;;; Level 3 BLAS: matrix-matrix, O(n^3) operations
|
||||||
|
|
||||||
(defblas transpose ((A 2))
|
(defblas transpose ((A 2))
|
||||||
|
|
Loading…
Add table
Reference in a new issue