The hardware and bandwidth for this mirror is donated by dogado GmbH, the Webhosting and Full Service-Cloud Provider. Check out our Wordpress Tutorial.
If you wish to report a bug, or if you are interested in having us mirror your free-software or open-source project, please feel free to contact us at mirror[@]dogado.de.

Type: Package
Title: Exact Matrix Algebra for Rational Matrices
Version: 1.0.0
Maintainer: Stéphane Laurent <laurent_step@outlook.fr>
Description: Provides functions to deal with matrix algebra for matrices with rational entries: determinant, rank, image and kernel, inverse, Cholesky decomposition. All computations are exact.
License: GPL-3
URL: https://github.com/stla/RationalMatrix
BugReports: https://github.com/stla/RationalMatrix/issues
Imports: gmp, Rcpp (≥ 1.0.9)
LinkingTo: BH, Rcpp, RcppEigen
Encoding: UTF-8
RoxygenNote: 7.2.3
SystemRequirements: C++ 17, gmp
NeedsCompilation: yes
Packaged: 2023-01-27 13:10:50 UTC; stla
Author: Stéphane Laurent [aut, cre]
Repository: CRAN
Date/Publication: 2023-01-27 16:50:09 UTC

'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`

Determinant of a rational matrix

Description

Determinant of a square matrix with rational entries.

Usage

Qdet(M)

Arguments

M

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

Value

A string: quoted rational number representing the determinant.

Examples

library(RationalMatrix)
M <- cbind(c("1/2", "3"), c("5/3", "-2/7"))
Qdet(M)

Inverse of a rational matrix

Description

Inverse matrix of a square rational matrix.

Usage

Qinverse(M)

Arguments

M

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

Value

A character matrix representing the inverse of M.

Examples

library(RationalMatrix)
M <- cbind(c("1/2", "3", "1"), c("5/3", "-2/7", "10/3"), c("0", "1", "2"))
Qinverse(M)

Check injectivity

Description

Checks whether a rational matrix represents an injective linear map (i.e. has trivial kernel).

Usage

QisInjective(M)

Arguments

M

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

Value

A Boolean value indicating whether the linear map corresponding to M is injective.

Examples

library(RationalMatrix)
set.seed(666L)
M <- matrix(rpois(35L, 1), 5L, 7L)
QisInjective(M)

Check invertibility

Description

Checks whether a square rational matrix is invertible.

Usage

QisInvertible(M)

Arguments

M

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

Value

A Boolean value indicating whether M is invertible.

Examples

library(RationalMatrix)
set.seed(666L)
M <- matrix(rpois(25L, 1), 5L, 5L)
QisInvertible(M)

Check surjectivity

Description

Checks whether a rational matrix represents a surjective linear map.

Usage

QisSurjective(M)

Arguments

M

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

Value

A Boolean value indicating whether the linear map corresponding to M is surjective.

Examples

library(RationalMatrix)
set.seed(666L)
M <- matrix(rpois(35L, 1), 7L, 5L)
QisSurjective(M)

Kernel of a rational matrix

Description

Kernel (null-space) of a rational matrix.

Usage

Qkernel(M)

Arguments

M

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

Value

A character matrix representing a basis of the kernel of M. Note that this basis is not orthogonal.

Examples

library(RationalMatrix)
set.seed(666L)
M <- matrix(rpois(30L, 6), 10L, 3L)
M <- cbind(M, M[,1] + M[,2], M[,2] + 2L*M[,3])
Qkernel(M)

Range of a rational matrix

Description

Range (column-space, image, span) of a rational matrix.

Usage

Qrange(M)

Arguments

M

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

Value

A character matrix representing a basis of the range of M. Note that this basis is not orthogonal.

Examples

library(RationalMatrix)
set.seed(666L)
M <- matrix(rpois(15L, 6), 3L, 5L)
Qrange(M)

Rank of a rational matrix

Description

Returns the rank of a rational matrix.

Usage

Qrank(M)

Arguments

M

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

Value

An integer, the rank of M.

Examples

library(RationalMatrix)
M <- cbind(c("1/2", "3", "1"), c("5/3", "-2/7", "10/3"), c("1", "1", "2"))
Qrank(M)

These binaries (installable software) and packages are in development.
They may not be fully stable and should be used with caution. We make no claims about them.
Health stats visible at Monitor.