I don’t think the LinearAlgebra package has such a function; perhaps the following will work:
julia> function gs(H::Matrix{Td}) where {Td}
Q = copy(H)
n = size(H,2)
R = Matrix{Td}(I,n,n)
for i=1:n
for j=1:i-1
R[j,i] = H[:,i]'*Q[:,j]
Q[:,i]-= R[j,i]*Q[:,j]
end
end
return Q,R
end
gs (generic function with 1 method)
julia> N=2; a=rand(0:10,N,N); Q,R = gs(a); Q*R-a
2×2 Array{Int64,2}:
0 0
0 0
julia> N=2; a=rand(0:10,N,N).//rand(1:10,N,N); Q,R = gs(a); Q*R-a
2×2 Array{Rational{Int64},2}:
0//1 0//1
0//1 0//1