Javascript object to deal with matrix stuff