added a few functions from go.matrix