fredrick/gauss

Easy way to element-wise add/multiply/divide two vectors

pablojim opened this issue · 3 comments

Maybe I'm missing it but is there an easy way to element-wise add/multiply/divide two vectors.

If not, is this something you consider adding/accepting pull requests for?

This functionality currently does not exist, can you give an example of what you were thinking? Absolutely, I would welcome the contribution.

So I was thinking methods like these:

var a = new gauss.Vector(1, 2), b = new gauss.Vector(3, 4); var c= a.add(b); assert.equal(new gauss.Vector(4,6), c);

Probably will just throw an error if non-matching length vectors are passed in.

Maybe allow for scalar operations also:

assert.equal(new gauss.Vector(11,12), a.add(10));

Similar for multiply/divide/subtract.

I like it, if you do submit a pull request, I'd be more than happy to look at it.