Matrix (version 0.3-19)

det: Calculate the Determinant of a Matrix

Description

det calculates the determinant (or its logarithm) of a matrix

Usage

## S3 method for class 'Matrix':
det(x, logarithm = TRUE, ...)

Arguments

x
numeric matrix.
logarithm
logical. When TRUE, the default, the logarithm of the determinant is returned. When FALSE, the determinant of x is returned.
...
further arguments passed to or from other methods.

Value

  • det.default returns a numeric value. Other det methods return a list with two elements
    • modulus
    {a numeric value. The modulus (absolute value) of the determinant or the logarithm of the modulus. The value of the logarithm argument is included as an attribute.}
  • signa numeric value, which is $\pm 1$ according to whether the determinant is positive or negative.

Details

det is a generic function with special methods for different types of matrices or decompositions. Use methods("det") to list all the methods for the det generic. The det function from the base R package has a slightly different calling sequence. In particular, it does not have a logarithm argument and always returns the determinant, never the logarithm of the determinant. It is used as the default method for the generic det function defined here. Be aware that the logarithm argument will only have an effect when det is called on objects that inherit from the Matrix class.

Examples

Run this code
h9 <- hilbert(9)
det(h9)
det(h9, log = FALSE)

Run the code above in your browser using DataLab