Skip to content

Bug in sumsymouter for sparse arrays #2

@baddstats

Description

@baddstats

The following example generates an error in the current release spatstat.sparse 3.1-0 but has been fixed in the current development version.

Afull <- array(1:50, dim=c(2,5,5))
Asparse <- as.sparse3Darray(Afull)
Mfull <- abs(.col(c(5,5)) - .row(c(5,5)))
Msparse  <- as(as(Mfull, "symmetricMatrix"), "sparseMatrix")
Bfull <- sumsymouter(Afull, Mfull)
Bsparse <- sumsymouterSparse(Asparse, Msparse)
if(!all(Bsparse==Bfull))
  stop(paste("sumsymouter(x, w): sparse and non-sparse algorithms disagree",
             "when w is symmetric"))

This bug arises because symmetric matrices in the Matrix package are sometimes stored using only the upper triangular entries for efficiency, and spatstat.sparse did not detect this.

The problem is now fixed in the development version.

This issue will be closed when the development version becomes the CRAN release.

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions