Here I will copy the following code snippet from this answer :
using Nemo # install with Pkg.add("Nemo") S = MatrixSpace(ZZ, 3, 4) mm = rand(-10:10,3,4) m = S(mm) (bmat,d) = nullspace(m)
Now bmat is of type Nemo.fmpz_mat . I want to convert it to regular Julia Matrix{Int} . I tried Matrix{Int}(bmat) , but it does not work.
bmat
Nemo.fmpz_mat
Matrix{Int}
Matrix{Int}(bmat)
See also: https://github.com/wbhart/Nemo.jl/issues/57
I defined my own convert :
convert
function Base.convert(::Type{Matrix{Int}}, x::Nemo.fmpz_mat) m,n = size(x) mat = Int[x[i,j] for i = 1:m, j = 1:n] return mat end Base.convert(::Type{Matrix}, x::Nemo.fmpz_mat) = convert(Matrix{Int}, x)