Linear algebra functions in javascript