File: test-SparseArray-class.R

package info (click to toggle)
r-bioc-sparsearray 1.6.2%2Bdfsg-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 1,768 kB
  • sloc: ansic: 16,138; makefile: 2
file content (15 lines) | stat: -rw-r--r-- 514 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15

test_that("nzcount(), nzwhich() and nzvals() on CsparseMatrix objects", {
    ## With a "long object" (i.e. length(x) >= 2^31).
    set.seed(2009)
    x <- Matrix::rsparsematrix(1e5, 3e4, 0.0001)
    expect_equal(nzcount(x), 300000)
    nzidx <- nzwhich(x)
    expect_equal(length(nzidx), 300000)
    expect_false(is.unsorted(nzidx, strict=TRUE))
    expect_identical(nzidx, SparseArray:::default_nzwhich(x))
    nzvals0 <- x[nzidx]
    expect_true(all(nzvals0 != 0))
    expect_identical(nzvals(x), nzvals0)
})