SCM

[#6606] determinant() caches too much

Date:
2018-12-05 01:42
Priority:
3
State:
Closed
Submitted by:
Thomas Lumley (tlumley)
Assigned to:
Martin Maechler (mmaechler)
Hardware:
None
Product:
None
Operating System:
None
Component:
None
Version:
None
Severity:
None
Resolution:
Fixed
URL:
Summary:
determinant() caches too much

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"

Comments:

Message  ↓
Date: 2021-04-22 20:10
Sender: Martin Maechler

Fixed now, svn 3386

Date: 2021-04-22 05:23
Sender: Martin Maechler

This got forgotten entirely, thank you Thomas.

It's the LU() decomposition where the cache is kept wrongly, because "fast code" is used for arithmetic with a "scalar".

I've looked over these arithmetic ops quite thoroughly, and have hopefully fixed all such cases.
Needs regression tests etc ... so will commit the fix in a few days.

Attached Files:

Changes

Field Old Value Date By
status_idOpen2021-04-22 20:10mmaechler
close_dateNone2021-04-22 20:10mmaechler
ResolutionAccepted As Bug2021-04-22 20:10mmaechler
assigned_tonone2021-04-22 05:23mmaechler
ResolutionNone2021-04-22 05:23mmaechler
Thanks to:
Vienna University of Economics and Business Powered By FusionForge