no need to pass the result matrix by reference