specialized matrix functions for go