Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

mpfrMatrix-utils

Functions for mpfrMatrix Objects


Description

determinant(x, ..) computes the determinant of the mpfr square matrix x. May work via coercion to "numeric", i.e., compute determinant(asNumeric(x), logarithm), if asNumeric is true, by default, if the dimension is larger than three. Otherwise, use precision precBits for the “accumulator” of the result, and use the recursive mathematical definition of the determinant (with computational complexity n!, where n is the matrix dimension, i.e., very inefficient for all but small matrices!)

Usage

## S3 method for class 'mpfrMatrix'
determinant(x, logarithm = TRUE,
            asNumeric = (d[1] > 3), precBits = max(.getPrec(x)), ...)

Arguments

x

an mpfrMatrix object of square dimension.

logarithm

logical indicating if the log of the absolute determinant should be returned.

asNumeric

logical .. .. if rather determinant(asNumeric(x), ...) should be computed.

precBits

the number of binary digits for the result (and the intermediate accumulations).

...

unused (potentially further arguments passed to methods).

Value

as determinant(), an object of S3 class "det", a list with components

modulus

the (logarithm of) the absolute value (abs) of the determinant of x.

sign

the sign of the determinant.

Author(s)

Martin Maechler

See Also

determinant in base R, which relies on a fast LU decomposition. mpfrMatrix

Examples

m6 <- mpfrArray(1:6, prec=128, dim = c(2L, 3L))
m6
S2 <- m6[,-3] # 2 x 2
S3 <- rbind(m6, c(1:2,10))
det(S2)
str(determinant(S2))
det(S3)
stopifnot(all.equal(det(S2), det(asNumeric(S2)), tolerance=1e-15),
	  all.equal(det(S3), det(asNumeric(S3)), tolerance=1e-15))

Rmpfr

R MPFR - Multiple Precision Floating-Point Reliable

v0.8-4
GPL (>= 2)
Authors
Martin Maechler [aut, cre] (<https://orcid.org/0000-0002-8685-9910>), Richard M. Heiberger [ctb] (formatHex(), *Bin, *Dec), John C. Nash [ctb] (hjkMpfr(), origin of unirootR()), Hans W. Borchers [ctb] (optimizeR(*, "GoldenRatio"); origin of hjkMpfr())
Initial release
2021-04-08

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.