1.0.0 • Published 10 years ago
ndarray-gemm v1.0.0
ndarray-gemm
General matrix multiply for ndarrays. This is analogous to the BLAS level 3 routine xGEMM.
Note that while this implementation is correct, it is not yet very optimized. If someone wants to take over this project or suggest improvements, patches are welcome.
Example
var zeros = require("zeros")
var ops = require("ndarray-ops")
var gemm = require("ndarray-gemm")
//Create 3 random matrices
var a = zeros([300, 400]) // a is 300 x 400
var b = zeros([400, 500]) // b is 400 x 500
var c = zeros([300, 500]) // c is 300 x 500
ops.random(a)
ops.random(b)
ops.random(c)
//Set c = a * b
gemm(c, a, b)Install
Install using npm:
npm install ndarray-gemmAPI
require("ndarray-gemm")(c, a, b[, alpha, beta])
Computes a generalized matrix multiplication. This sets:
c = alpha * a * b + beta * ccis a[n,m]shape ndarrayais a[n,p]shape ndarraybis a[p,m]shape ndarrayalphais a scalar weight which is applied to the producta * bbetais a scalar weight applied tocwhen added back in
License
(c) 2013 Mikola Lysenko. MIT License
1.0.0
10 years ago
