Pass matrix pointers instead of copies.