Learn R Programming

Matrix (version 0.3-24)

diagDet: Determinant of triangular matrices

Description

Return the determinant (or log-determinant) of triangular matrices.

Usage

diagDet(x, logarithm=TRUE, ...)

Arguments

x
a numeric vector representing the diagonal of a triangular or a diagonal 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

  • An object of class det as 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

The determinant of a triangular matrix can be calculated from its diagonal elements only.

See Also

det

Examples

Run this code
diagDet(1:5)  # log of product
diagDet(1:5, logarithm = FALSE)

Run the code above in your browser using DataLab