QcholUtDU {RationalMatrix}R Documentation

'UtDU' decomposition of a rational matrix

Description

Cholesky-'UtDU' decomposition of a symmetric rational matrix.

Usage

QcholUtDU(M)

Arguments

M

a square matrix such that as.character(Mij) is a quoted integer or a quoted fraction for each entry Mij

Value

The Cholesky-'UtDU' decomposition of M in a list (see example).

Note

Symmetry is not checked! Only the lower triangular part of M is used.

Examples

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`

[Package RationalMatrix version 1.0.0 Index]