`det`

and `determinant`

calculate the determinant of a
symmetric, positive definite sparse matrix. `determinant`

returns
separately the modulus of the determinant, optionally on the logarithm scale,
and the sign of the determinant.

```
det(x, ...)
determinant(x, logarithm = TRUE, ...)
```

## Arguments

- x
sparse matrix of class `spam`

or a Cholesky factor of
class `spam.chol.NgPeyton`

.

- logarithm
logical; if `TRUE`

(default) return the logarithm of the
modulus of the determinant.

- ...
Optional arguments. Examples include `method`

argument
and additional parameters used by the method.

## Value

For `det`

, the determinant of `x`

. For `determinant`

, a
list with components

- modulus
a numeric value. The modulus (absolute value) of the
determinant if `logarithm`

is `FALSE`

; otherwise the
logarithm of the modulus.

- sign
+1, as only symmetric positive definite matrices are considered.

## Details

If the matrix is not positive definite, the function issues a
warning and returns `NA`

.

The determinant is based on the product of the diagonal entries of a
Cholesky factor, i.e. internally, a Cholesky decomposition is
performed. By default, the NgPeyton algorithm with minimal degree
ordering us used. To change the methods or supply additonal parameters
to the Cholesky factorization function, it is possible to pass via
`chol`

.

The determinant of a Cholesky factor is also defined.

## References

Ng, E. G. and B. W. Peyton (1993) Block sparse Cholesky algorithms
on advanced uniprocessor computers, *SIAM J. Sci. Comput.*, **14**,
1034--1056.

## Examples

```
x <- spam( c(4,3,0,3,5,1,0,1,4), 3)
det( x)
#> [1] 40
determinant( x)
#> $modulus
#> [1] 3.688879
#> attr(,"logarithm")
#> [1] TRUE
#>
#> $sign
#> [1] 1
#>
#> attr(,"class")
#> [1] "det"
det( chol( x))
#> [1] 6.324555
```