diagDet {Matrix}R Documentation

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.

Details

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

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.
sign a numeric value, which is +/- 1 according to whether the determinant is positive or negative.

normal-bracket23bracket-normal

Note

Often, computing the determinant is not what you should be doing to solve a given problem.

See Also

det

Examples

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