'Copy the matrix to the CPU.'

def copy_to_host(self):

    if (not self.mat.on_host):
        m = self.mat.size[0]
        n = self.mat.size[1]
        self.numpy_array = np.empty((m, n), dtype=np.float32, order='F')
        self.mat.data_host = self.numpy_array.ctypes.data_as(ct.POINTER(ct.c_float))
        self.mat.on_host = 1
    err_code = _cudamat.copy_to_host(self.p_mat)
    if err_code:
        raise generate_exception(err_code)
