If using the dmdgretl library for matrix algebra, allocate a new matrix in R and copy the elements of the matrix into it.
RMatrix m = gm.mat;
See Implementation
If using the dmdgretl library for matrix algebra, allocate a new matrix in R and copy the elements of the matrix into it.