scijs/ndarray-blas-gemv

Name: ndarray-blas-gemv

Owner: scijs

Description: BLAS Level 2 GEMV (Matrix-Vector multiply) for ndarrays

Created: 2015-05-14 14:51:30.0

Updated: 2015-11-04 12:57:48.0

Pushed: 2015-05-14 15:01:38.0

Homepage: null

Size: 128

Language: JavaScript

GitHub Committers

UserMost Recent Commit# Commits

Other Committers

UserEmailMost Recent Commit# Commits

README

ndarray-blas-gemv

Build Status npm version Dependency Status

BLAS Level 2 GEMV (matrix-vector multiply) for ndarrays

Usage
gemv( alpha, A, x, beta, y )

Calculate y <- alpha * A * x + beta * y for scalar alpha, matrix A, vector x, scalar beta, and vector y. Result is overwritten in vector y. All other inputs are unchanged.

Example
gemv = require('ndarray-blas-gemv')

A = ndarray([1,2,5,3], [2,2]),
x = ndarray([-4,7]),
y = ndarray([3,-2])

( -4, A, x, 2, y )

esult: y = [-34, -8]

To multiply using the transpose of A, you can simply use .transpose(1,0) to transpose the input (note that this calculates new strides and offsets but does not rearrange the physical memory).

A = ndarray([1,2,5,3], [2,2]),
x = ndarray([-4,7]),
y = ndarray([3,-2])

( -4, A.transpose(1,0), x, 2, y )

esult: y = [-118, -56]
Credits

(c) 2015 Ricky Reusser. MIT License


This work is supported by the National Institutes of Health's National Center for Advancing Translational Sciences, Grant Number U24TR002306. This work is solely the responsibility of the creators and does not necessarily represent the official views of the National Institutes of Health.