-
Notifications
You must be signed in to change notification settings - Fork 61
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Dot product #26
Comments
ndgemm package handles matrix multiplication |
Consider adding |
This is about what I could manage: function dot(...args) {
return args.reduce((sofar, curr) => {
const result = zeros([ sofar.shape[0], curr.shape[1] ]);
gemm(result, sofar, curr);
return result;
});
} Test code: var zeros = require('zeros');
var ops = require('ndarray-ops');
var gemm = require('ndarray-gemm');
var a = ops.random(zeros([ 2, 3 ]));
var b = ops.random(zeros([ 3, 4 ]));
var c = ops.random(zeros([ 4, 2 ]));
var tmp = zeros([ 2, 4 ]);
var res1 = zeros([ 2, 2 ]);
gemm(tmp, a, b);
gemm(res1, tmp, c);
var res2 = dot(a, b, c);
assert(ops.equals(res1, res2)); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi,
Is there a way/module to perform dot product of 2 ndarrays?
Best regards
The text was updated successfully, but these errors were encountered: