[med-svn] r18161 - in trunk/packages/R/r-cran-igraph/trunk/debian: . patches

Andreas Tille tille at moszumanska.debian.org
Tue Sep 30 11:37:40 UTC 2014


Author: tille
Date: 2014-09-30 11:37:39 +0000 (Tue, 30 Sep 2014)
New Revision: 18161

Added:
   trunk/packages/R/r-cran-igraph/trunk/debian/README.test
   trunk/packages/R/r-cran-igraph/trunk/debian/patches/remove_arpack_test.patch
   trunk/packages/R/r-cran-igraph/trunk/debian/patches/remove_failing_tests.patch
Modified:
   trunk/packages/R/r-cran-igraph/trunk/debian/patches/series
Log:
Skip failing tests after discussion with upstream


Added: trunk/packages/R/r-cran-igraph/trunk/debian/README.test
===================================================================
--- trunk/packages/R/r-cran-igraph/trunk/debian/README.test	                        (rev 0)
+++ trunk/packages/R/r-cran-igraph/trunk/debian/README.test	2014-09-30 11:37:39 UTC (rev 18161)
@@ -0,0 +1,21 @@
+Notes on how this package can be tested.
+────────────────────────────────────────
+
+To run the unit tests provided by the package you can do
+
+LC_ALL=C R --no-save <<EOT
+library(igraph)
+igraphtest()
+EOT
+
+Please note that some tests are disabled (= removed from the installed
+package:
+
+  1. inst/tests/test_arpack.R
+     Upstream says: "an issue that has come up a couple of times so far with
+        ARPACK, but I don't know how to fix it in this case, I can't seem to
+        be able to reproduce it.
+
+     So for the moment this test is disabled and the issue delayed for further
+     investigation.
+

Added: trunk/packages/R/r-cran-igraph/trunk/debian/patches/remove_arpack_test.patch
===================================================================
--- trunk/packages/R/r-cran-igraph/trunk/debian/patches/remove_arpack_test.patch	                        (rev 0)
+++ trunk/packages/R/r-cran-igraph/trunk/debian/patches/remove_arpack_test.patch	2014-09-30 11:37:39 UTC (rev 18161)
@@ -0,0 +1,83 @@
+Author: Andreas Tille <tille at debian.org>
+Last-Changed: Thu, 25 Sep 2014 18:00:25 +0200
+Description: Remove ARPACK test
+ Upstream says: "an issue that has come up a couple of times so far with
+   ARPACK, but I don't know how to fix it in this case, I can't seem to
+   be able to reproduce it.
+ .
+ So for the moment this test is disabled and the issue delayed for further
+ investigation.
+
+--- a/inst/tests/test_arpack.R
++++ /dev/null
+@@ -1,70 +0,0 @@
+-
+-context("arpack")
+-
+-test_that("arpack works for identity matrix", {
+-  library(igraph)
+-  f <- function(x, extra=NULL) x
+-  res <- arpack(f, options=list(n=10, nev=2, ncv=4), sym=TRUE)
+-  expect_that(res$values, equals(c(1,1)))
+-})
+-
+-test_that("arpack works on the Laplacian of a star", {
+-  library(igraph)
+-  f <- function(x, extra=NULL) {
+-    y <- x
+-    y[1] <- (length(x)-1)*x[1] - sum(x[-1])
+-    for (i in 2:length(x)) {
+-      y[i] <- x[i] - x[1]
+-    }
+-    y
+-  }
+-  
+-  r1 <- arpack(f, options=list(n=10, nev=1, ncv=3), sym=TRUE)
+-  r2 <- eigen(graph.laplacian(graph.star(10, mode="undirected")))
+-  
+-  correctSign <- function(x) { if (x[1]<0) { -x } else { x } }
+-  expect_that(r1$values, equals(r2$values[1]))
+-  expect_that(correctSign(r1$vectors), equals(correctSign(r2$vectors[,1])))
+-})
+-
+-####
+-# Complex case
+-
+-test_that("arpack works for non-symmetric matrices", {
+-  library(igraph)
+-  A <- structure(c(-6, -6, 7, 6, 1, -9, -3, 2, -9, -7, 0, 1, -7, 8, 
+-                   -7, 10, 0, 0, 1, 1, 10, 0, 8, -4, -4, -5, 8, 9, -6, 9, 3, 8, 
+-                   6, -1, 9, -9, -6, -3, -1, -7, 8, -4, -4, 10, 0, 5, -2, 0, 7, 
+-                   10, 1, 4, -8, 3, 5, 3, -7, -9, 10, -1, -4, -7, -1, 7, 5, -5, 
+-                   1, -4, 9, -2, 10, 1, -7, 7, 6, 7, -3, 0, 9, -5, -8, 1, -3,
+-                   -3, -8, -7, -8, 10, 8, 7, 0, 6, -7, -8, 10, 10, 1, 0, -2, 6),
+-                 .Dim = c(10L, 10L))
+-
+-  f <- function(x, extra=NULL) A %*% x
+-  res <- arpack(f, options=list(n=10, nev=3, ncv=7), sym=FALSE)
+-  ## This is needed because they might return a different complex conjugate
+-  expect_that(abs(res$values/eigen(A)$values[1:3]), equals(c(1,1,1)))
+-  expect_that((res$values[1] * res$vectors[,1]) / (A %*% res$vectors[,1]),
+-              equals(cbind(rep(1+0i, nrow(A)))))
+-  expect_that((res$values[2] * res$vectors[,2]) / (A %*% res$vectors[,2]),
+-              equals(cbind(rep(1+0i, nrow(A)))))
+-  expect_that(abs((res$values[3] * res$vectors[,3]) / (A %*% res$vectors[,3])),
+-              equals(cbind(rep(1, nrow(A)))))
+-
+-  f <- function(x, extra=NULL) A %*% x
+-  res <- arpack(f, options=list(n=10, nev=4, ncv=9), sym=FALSE)
+-  ## This is needed because they might return a different complex conjugate
+-  expect_that(abs(res$values/eigen(A)$values[1:4]), equals(rep(1, 4)))
+-  expect_that((res$values[1] * res$vectors[,1]) / (A %*% res$vectors[,1]),
+-              equals(cbind(rep(1+0i, nrow(A)))))
+-  expect_that((res$values[2] * res$vectors[,2]) / (A %*% res$vectors[,2]),
+-              equals(cbind(rep(1+0i, nrow(A)))))
+-  expect_that(abs((res$values[3] * res$vectors[,3]) / (A %*% res$vectors[,3])),
+-              equals(cbind(rep(1, nrow(A)))))
+-  expect_that(abs((res$values[4] * res$vectors[,4]) / (A %*% res$vectors[,4])),
+-              equals(cbind(rep(1, nrow(A)))))
+-})
+-
+-####
+-
+-# TODO: further tests for typically hard cases

Added: trunk/packages/R/r-cran-igraph/trunk/debian/patches/remove_failing_tests.patch
===================================================================
--- trunk/packages/R/r-cran-igraph/trunk/debian/patches/remove_failing_tests.patch	                        (rev 0)
+++ trunk/packages/R/r-cran-igraph/trunk/debian/patches/remove_failing_tests.patch	2014-09-30 11:37:39 UTC (rev 18161)
@@ -0,0 +1,83 @@
+Author: Andreas Tille <tille at debian.org>
+Last-Changed: Thu, 25 Sep 2014 18:00:25 +0200
+Description: Remove leading.eigenvector.community test
+ Upstream says: "I can reproduce, and it will be fixed in the next version of igraph.
+ Don't wait, because it might not happen soon.
+ .
+ So for the moment this test is disabled and the issue delayed for further
+ investigation.
+
+--- a/inst/tests/test_leading.eigenvector.community.R
++++ /dev/null
+@@ -1,71 +0,0 @@
+-
+-context("leading.eigenvector.community")
+-
+-test_that("leading.eigenvector.community works", {
+-
+-  library(igraph)
+-
+-  ## Check-test
+-
+-  f <- function(membership, community, value, vector, multiplier, extra) {
+-    M <- sapply(1:length(vector), function(x) {
+-      v <- rep(0, length(vector))
+-      v[x] <- 1
+-      multiplier(v)
+-    })
+-    ev <- eigen(M)
+-    ret <- 0
+-    expect_that(ev$values[1], equals(value))
+-    if (sign(ev$vectors[1,1]) != sign(vector[1])) {
+-      ev$vectors <- -ev$vectors
+-    }
+-    expect_that(ev$vectors[,1], equals(vector))
+-  }
+-
+-  g <- graph.famous("Zachary")
+-  lc <- leading.eigenvector.community(g, callback=f)
+-  
+-  expect_that(lc$modularity, equals(modularity(g, lc$membership)))
+-  expect_that(membership(lc),
+-              equals(c(1, 3, 3, 3, 1, 1, 1, 3, 2, 2, 1, 1, 3, 3, 2, 2,
+-                       1, 3, 2, 3, 2, 3, 2, 4, 4, 4, 2, 4, 4, 2, 2, 4,
+-                       2, 2)))
+-  expect_that(length(lc), equals(4))
+-  expect_that(sizes(lc),
+-              equals(structure(c(7L, 12L, 9L, 6L), .Dim = 4L, .Dimnames =
+-                               structure(list(`Community sizes` =
+-                                              c("1", "2", "3", "4")),
+-                                         .Names = "Community sizes"),
+-                               class = "table")))
+-
+-  ## Check that the modularity matrix is correct
+-
+-  f <- function(membership, community, value, vector, multiplier, extra) {
+-    M <- sapply(1:length(vector), function(x) {
+-      v <- rep(0, length(vector))
+-      v[x] <- 1
+-      multiplier(v)
+-    })
+-    myc <- membership==community
+-    B <- A[myc,myc] - (deg[myc] %*% t(deg[myc]))/2/ec
+-    BG <- B-diag(rowSums(B))
+-    
+-    expect_that(M, equals(BG))
+-  }
+-
+-  g <- graph.famous("Zachary")
+-  A <- get.adjacency(g, sparse=FALSE)
+-  ec <- ecount(g)
+-  deg <- degree(g)
+-  lc <- leading.eigenvector.community(g, callback=f)
+-
+-  ## Stress-test
+-
+-  for (i in 1:100) {
+-    g <- erdos.renyi.game(20, sample(5:40, 1), type="gnm")
+-    lec1 <- leading.eigenvector.community(g)
+-    lec2 <- leading.eigenvector.community(g)
+-    expect_that(membership(lec1), equals(membership(lec2)))
+-  }
+-
+-})

Modified: trunk/packages/R/r-cran-igraph/trunk/debian/patches/series
===================================================================
--- trunk/packages/R/r-cran-igraph/trunk/debian/patches/series	2014-09-30 11:07:36 UTC (rev 18160)
+++ trunk/packages/R/r-cran-igraph/trunk/debian/patches/series	2014-09-30 11:37:39 UTC (rev 18161)
@@ -1 +1,3 @@
 spelling.patch
+remove_arpack_test.patch
+remove_failing_tests.patch




More information about the debian-med-commit mailing list