Try without reference, SGMatrix is just a wrapper of pointers.