Detailed description |
With version 1.2-14, taking the determinant of a Matrix caches the result even when the matrix is modified
> library(Matrix)
> M<-Diagonal(5)+0.5
> determinant(M)
$modulus
[1] 1.252763
attr(,"logarithm")
[1] TRUE
$sign
[1] 1
attr(,"class")
[1] "det"
> determinant(M*2)
$modulus
[1] 1.252763
attr(,"logarithm")
[1] TRUE
$sign
[1] 1
attr(,"class")
[1] "det"
> MM<-M*2
> determinant(MM)
$modulus
[1] 1.252763
attr(,"logarithm")
[1] TRUE
$sign
[1] 1
attr(,"class")
[1] "det"
> determinant(as.matrix(MM))
$modulus
[1] 4.718499
attr(,"logarithm")
[1] TRUE
$sign
[1] 1
attr(,"class")
[1] "det"
|
|