library(RationalMatrix)
x <- matrix(c(1:5, (1:5)^2), 5, 2)
x <- cbind(x, x[, 1L] + 3L*x[, 2L])
M <- crossprod(x)
UtDU <- QcholUtDU(M)
library(gmp)
U <- as.bigq(UtDU$U)
D <- matrix("0", 3L, 3L)
diag(D) <- UtDU$D
D <- as.bigq(D)
perm <- UtDU$perm
UP <- U[, perm]
t(UP) %*% D %*% UP # this is `M`
Run the code above in your browser using DataLab