mpfrMatrix-utils {Rmpfr} | R Documentation |
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 |
logarithm |
logical indicating if the |
asNumeric |
logical .. .. if rather
|
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
( |
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))