views:

58

answers:

2

Do any browsers currently support or plan to support fast array math operations, similar to what NumPy provides for Python? Here is an example to demonstrate what I mean:

var a = new NumericArray('uint32', [1, 2, 3, 4]);
var b = new NumericArray('uint32', [2, 2, 2, 2]);
var c = a.add(b); // c == [3, 4, 5, 6]

In that example, add is not meant to represent a function implemented in JavaScript. That would be trivial to write. It is meant to represent a function that is written in C (or whatever language the JavaScript implementation is written in) and is optimized specifically for math operations over the array.

+2  A: 

I don't think so, but Google are certainly interested in pushing the limits of what is possible in Javascript. If you are interested in safely running native code in the browser you might want to take a look at NaCl.

Mark Byers
That looks very interesting. I'll have to play around with that a bit.
David
A: 

I'm the original poster, but I figured I'd share something I ran across. WebGL (implementations are already in progress by Mozilla and WebKit, see Lesson 0 at learningwebgl.com) introduces something called "Typed Arrays", which is sort of what I was looking for. The specification is available at https://cvs.khronos.org/svn/repos/registry/trunk/public/webgl/doc/spec/TypedArray-spec.html.

David