Running ‘testthat.R’ [15s/16s]
Running the tests in ‘tests/testthat.R’ failed.
Complete output:
  > Sys.setenv("R_TESTS" = "")
  > library(testthat)
  > library(Matrix)
  > library(MatrixExtra)
  'MatrixExtra' modifies important behaviors from 'Matrix'. See ?MatrixExtra-options.
  > test_check("MatrixExtra")
  
   *** caught segfault ***
  address 0xfffffffe0ed5c798, cause 'memory not mapped'
  
  Traceback:
   1: multiply_coo_by_dense_ignore_NAs_logical(e1@i, e1@j, e1@x, e2,     nrow(e1), ncol(e1))
   2: multiply_csr_by_dvec_elemwise_internal(e1, e2, TRUE)
   3: X & v_factor
   4: X & v_factor
   5: as.matrix(X)
   6: as.lmatrix(X & v_factor)
   7: unname(as.lmatrix(X & v_factor))
   8: eval_bare(expr, quo_get_env(quo))
   9: quasi_label(enquo(object), label, arg = "object")
  10: expect_equal(unname(as.lmatrix(X & v_factor)), unname(X_dense &     as.numeric(v_factor)))
  11: withCallingHandlers(expr, warning = function(w) if (inherits(w,     classes)) tryInvokeRestart("muffleWarning"))
  12: suppressWarnings({    expect_equal(unname(as.matrix(X * v_exact)), unname(X_dense *         as.numeric(v_exact)))    expect_equal(unname(as.matrix(X * v_factor)), unname(X_dense *         as.numeric(v_factor)))    expect_equal(unname(as.matrix(X * v_factor_larger)), unname(X_dense *         as.numeric(v_factor_larger)))    expect_equal(unname(as.matrix(X * v_dense)), unname(X_dense *         as.numeric(v_dense)))    expect_error(X * v_longer)    expect_error(X_dense * v_longer)    expect_equal(unname(as.matrix(X * v_uneven)), unname(X_dense *         as.numeric(v_uneven)))    expect_equal(unname(as.matrix(X * v_uneven_longer)), unname(X_dense *         as.numeric(v_uneven_longer)))    expect_equal(unname(as.matrix(X * v_uneven_longer2)), unname(X_dense *         as.numeric(v_uneven_longer2)))    expect_equal(unname(as.matrix(X * v_scalar)), unname(X_dense *         as.numeric(v_scalar)))    expect_equal(unname(as.lmatrix(X & v_exact)), unname(X_dense &         as.numeric(v_exact)))    expect_equal(unname(as.lmatrix(X & v_factor)), unname(X_dense &         as.numeric(v_factor)))    expect_equal(unname(as.lmatrix(X & v_factor_larger)), unname(X_dense &         as.numeric(v_factor_larger)))    expect_equal(unname(as.lmatrix(X & v_dense)), unname(X_dense &         as.numeric(v_dense)))    expect_error(X & v_longer)    expect_error(X_dense & v_longer)    expect_equal(unname(as.lmatrix(X & v_uneven)), unname(X_dense &         as.numeric(v_uneven)))    expect_equal(unname(as.lmatrix(X & v_uneven_longer)), unname(X_dense &         as.numeric(v_uneven_longer)))    expect_equal(unname(as.lmatrix(X & v_uneven_longer2)), unname(X_dense &         as.numeric(v_uneven_longer2)))    expect_equal(unname(as.lmatrix(X & v_scalar)), unname(X_dense &         as.numeric(v_scalar)))    expect_equal(unname(as.matrix(X/v_exact)), unname(X_dense/as.numeric(v_exact)))    expect_equal(unname(as.matrix(X/v_factor)), unname(X_dense/as.numeric(v_factor)))    expect_equal(unname(as.matrix(X/v_factor_larger)), unname(X_dense/as.numeric(v_factor_larger)))    expect_equal(unname(as.matrix(X/v_dense)), unname(X_dense/as.numeric(v_dense)))    expect_error(X/v_longer)    expect_error(X_dense/v_longer)    expect_equal(unname(as.matrix(X/v_uneven)), unname(X_dense/as.numeric(v_uneven)))    expect_equal(unname(as.matrix(X/v_uneven_longer)), unname(X_dense/as.numeric(v_uneven_longer)))    expect_equal(unname(as.matrix(X/v_uneven_longer2)), unname(X_dense/as.numeric(v_uneven_longer2)))    expect_equal(unname(as.matrix(X/v_scalar)), unname(X_dense/as.numeric(v_scalar)))    if (!getOption("MatrixExtra.ignore_na")) {        expect_equal(unname(as.matrix(v_exact/X)), unname(as.numeric(v_exact)/X_dense))        expect_equal(unname(as.matrix(v_factor/X)), unname(as.numeric(v_factor)/X_dense))        expect_equal(unname(as.matrix(v_factor_larger/X)), unname(as.numeric(v_factor_larger)/X_dense))        expect_equal(unname(as.matrix(v_dense/X)), unname(as.numeric(v_dense)/X_dense))        expect_error(v_longer/X)        expect_error(v_longer/X_dense)        expect_equal(unname(as.matrix(v_uneven/X)), unname(as.numeric(v_uneven)/X_dense))        expect_equal(unname(as.matrix(v_uneven_longer/X)), unname(as.numeric(v_uneven_longer)/X_dense))        expect_equal(unname(as.matrix(v_uneven_longer2/X)), unname(as.numeric(v_uneven_longer2)/X_dense))        expect_equal(unname(as.matrix(v_scalar/X)), unname(as.numeric(v_scalar)/X_dense))    }    if (!getOption("MatrixExtra.ignore_na")) {        expect_equal(unname(as.matrix(X^v_exact)), unname(X_dense^as.numeric(v_exact)))        expect_equal(unname(as.matrix(X^v_factor)), unname(X_dense^as.numeric(v_factor)))        expect_equal(unname(as.matrix(X^v_factor_larger)), unname(X_dense^as.numeric(v_factor_larger)))        expect_equal(unname(as.matrix(X^v_dense)), unname(X_dense^as.numeric(v_dense)))        expect_error(X^v_longer)        expect_error(X_dense^v_longer)        expect_equal(unname(as.matrix(X^v_uneven)), unname(X_dense^as.numeric(v_uneven)))        expect_equal(unname(as.matrix(X^v_uneven_longer)), unname(X_dense^as.numeric(v_uneven_longer)))        expect_equal(unname(as.matrix(X^v_uneven_longer2)), unname(X_dense^as.numeric(v_uneven_longer2)))        expect_equal(unname(as.matrix(X^v_scalar)), unname(X_dense^as.numeric(v_scalar)))        expect_equal(unname(as.matrix(v_exact^X)), unname(as.numeric(v_exact)^X_dense))        expect_equal(unname(as.matrix(v_factor^X)), unname(as.numeric(v_factor)^X_dense))        expect_equal(unname(as.matrix(v_factor_larger^X)), unname(as.numeric(v_factor_larger)^X_dense))        expect_equal(unname(as.matrix(v_dense^X)), unname(as.numeric(v_dense)^X_dense))        expect_error(v_longer^X)        expect_error(v_longer^X_dense)        expect_equal(unname(as.matrix(v_uneven^X)), unname(as.numeric(v_uneven)^X_dense))        expect_equal(unname(as.matrix(v_uneven_longer^X)), unname(as.numeric(v_uneven_longer)^X_dense))        expect_equal(unname(as.matrix(v_uneven_longer2^X)), unname(as.numeric(v_uneven_longer2)^X_dense))        expect_equal(unname(as.matrix(v_scalar^X)), unname(as.numeric(v_scalar)^X_dense))    }    expect_equal(unname(as.matrix(X%%v_exact)), unname(X_dense%%as.numeric(v_exact)))    expect_equal(unname(as.matrix(X%%v_factor)), unname(X_dense%%as.numeric(v_factor)))    expect_equal(unname(as.matrix(X%%v_factor_larger)), unname(X_dense%%as.numeric(v_factor_larger)))    expect_equal(unname(as.matrix(X%%v_dense)), unname(X_dense%%as.numeric(v_dense)))    expect_error(X%%v_longer)    expect_error(X_dense%%v_longer)    expect_equal(unname(as.matrix(X%%v_uneven)), unname(X_dense%%as.numeric(v_uneven)))    expect_equal(unname(as.matrix(X%%v_uneven_longer)), unname(X_dense%%as.numeric(v_uneven_longer)))    expect_equal(unname(as.matrix(X%%v_uneven_longer2)), unname(X_dense%%as.numeric(v_uneven_longer2)))    expect_equal(unname(as.matrix(X%%v_scalar)), unname(X_dense%%as.numeric(v_scalar)))    if (!getOption("MatrixExtra.ignore_na")) {        expect_equal(unname(as.matrix(v_exact%%X)), unname(as.numeric(v_exact)%%X_dense))        expect_equal(unname(as.matrix(v_factor%%X)), unname(as.numeric(v_factor)%%X_dense))        expect_equal(unname(as.matrix(v_factor_larger%%X)), unname(as.numeric(v_factor_larger)%%X_dense))        expect_equal(unname(as.matrix(v_dense%%X)), unname(as.numeric(v_dense)%%X_dense))        expect_error(v_longer%%X)        expect_error(v_longer%%X_dense)        expect_equal(unname(as.matrix(v_uneven%%X)), unname(as.numeric(v_uneven)%%X_dense))        expect_equal(unname(as.matrix(v_uneven_longer%%X)), unname(as.numeric(v_uneven_longer)%%X_dense))        expect_equal(unname(as.matrix(v_uneven_longer2%%X)),             unname(as.numeric(v_uneven_longer2)%%X_dense))        expect_equal(unname(as.matrix(v_scalar%%X)), unname(as.numeric(v_scalar)%%X_dense))    }    expect_equal(unname(as.matrix(X%/%v_exact)), unname(X_dense%/%as.numeric(v_exact)))    expect_equal(unname(as.matrix(X%/%v_factor)), unname(X_dense%/%as.numeric(v_factor)))    expect_equal(unname(as.matrix(X%/%v_factor_larger)), unname(X_dense%/%as.numeric(v_factor_larger)))    expect_equal(unname(as.matrix(X%/%v_dense)), unname(X_dense%/%as.numeric(v_dense)))    expect_error(X%/%v_longer)    expect_error(X_dense%/%v_longer)    expect_equal(unname(as.matrix(X%/%v_uneven)), unname(X_dense%/%as.numeric(v_uneven)))    expect_equal(unname(as.matrix(X%/%v_uneven_longer)), unname(X_dense%/%as.numeric(v_uneven_longer)))    expect_equal(unname(as.matrix(X%/%v_uneven_longer2)), unname(X_dense%/%as.numeric(v_uneven_longer2)))    expect_equal(unname(as.matrix(X%/%v_scalar)), unname(X_dense%/%as.numeric(v_scalar)))    if (!getOption("MatrixExtra.ignore_na")) {        expect_equal(unname(as.matrix(v_exact%/%X)), unname(as.numeric(v_exact)%/%X_dense))        expect_equal(unname(as.matrix(v_factor%/%X)), unname(as.numeric(v_factor)%/%X_dense))        expect_equal(unname(as.matrix(v_factor_larger%/%X)),             unname(as.numeric(v_factor_larger)%/%X_dense))        expect_equal(unname(as.matrix(v_dense%/%X)), unname(as.numeric(v_dense)%/%X_dense))        expect_error(v_longer%/%X)        expect_error(v_longer%/%X_dense)        expect_equal(unname(as.matrix(v_uneven%/%X)), unname(as.numeric(v_uneven)%/%X_dense))        expect_equal(unname(as.matrix(v_uneven_longer%/%X)),             unname(as.numeric(v_uneven_longer)%/%X_dense))        expect_equal(unname(as.matrix(v_uneven_longer2%/%X)),             unname(as.numeric(v_uneven_longer2)%/%X_dense))        expect_equal(unname(as.matrix(v_scalar%/%X)), unname(as.numeric(v_scalar)%/%X_dense))    }})
  13: run_tests_(as.coo.matrix(X), X_dense, v_exact, v_factor, v_factor_larger,     v_dense, v_longer, v_uneven, v_uneven_longer, v_uneven_longer2,     v_scalar)
  14: run_tests(X, X_dense, v_exact, v_factor, v_factor_larger, v_dense,     v_longer, v_uneven, v_uneven_longer, v_uneven_longer2, v_scalar)
  15: eval(code, test_env)
  16: eval(code, test_env)
  17: withCallingHandlers({    eval(code, test_env)    if (!handled && !is.null(test)) {        skip_empty()    }}, expectation = handle_expectation, skip = handle_skip, warning = handle_warning,     message = handle_message, error = handle_error)
  18: doTryCatch(return(expr), name, parentenv, handler)
  19: tryCatchOne(expr, names, parentenv, handlers[[1L]])
  20: tryCatchList(expr, names[-nh], parentenv, handlers[-nh])
  21: doTryCatch(return(expr), name, parentenv, handler)
  22: tryCatchOne(tryCatchList(expr, names[-nh], parentenv, handlers[-nh]),     names[nh], parentenv, handlers[[nh]])
  23: tryCatchList(expr, classes, parentenv, handlers)
  24: tryCatch(withCallingHandlers({    eval(code, test_env)    if (!handled && !is.null(test)) {        skip_empty()    }}, expectation = handle_expectation, skip = handle_skip, warning = handle_warning,     message = handle_message, error = handle_error), error = handle_fatal,     skip = function(e) {    })
  25: test_code(desc, code, env = parent.frame(), reporter = reporter)
  26: test_that("Vector recycling", {    set.seed(1)    X <- as.csr.matrix(rsparsematrix(100, 30, 0.1))    v_exact <- rnorm(100)    v_factor <- rnorm(20)    v_factor_larger <- rnorm(500)    v_dense <- rnorm(3000)    v_longer <- rnorm(6000)    v_uneven <- rnorm(80)    v_uneven_longer <- rnorm(111)    v_uneven_longer2 <- rnorm(333)    v_scalar <- rnorm(1)    X_dense <- as.matrix(X)    add_rare <- function(v, pct) {        n <- ceiling(length(v) * pct/4)        v[sample(length(v), n, replace = FALSE)] <- 0.5        v[sample(length(v), n, replace = FALSE)] <- (-0.5)        v[sample(length(v), n, replace = FALSE)] <- (1/3)        v[sample(length(v), n, replace = FALSE)] <- (-1/3)        return(v)    }    add_zeros <- function(v, pct) {        n <- ceiling(length(v) * pct)        v[sample(length(v), n, replace = FALSE)] <- 0        return(v)    }    add_ones <- function(v, pct) {        n <- ceiling(length(v) * pct/2)        v[sample(length(v), n, replace = FALSE)] <- 1        v[sample(length(v), n, replace = FALSE)] <- (-1)        return(v)    }    add_inf <- function(v, pct) {        n <- ceiling(length(v) * pct/2)        v[sample(length(v), n, replace = FALSE)] <- Inf        v[sample(length(v), n, replace = FALSE)] <- -Inf        return(v)    }    as.lmatrix <- function(X) {        X <- as.matrix(X)        mode(X) <- "logical"        return(X)    }    run_tests_ <- function(X, X_dense, v_exact, v_factor, v_factor_larger,         v_dense, v_longer, v_uneven, v_uneven_longer, v_uneven_longer2,         v_scalar) {        suppressWarnings({            expect_equal(unname(as.matrix(X * v_exact)), unname(X_dense *                 as.numeric(v_exact)))            expect_equal(unname(as.matrix(X * v_factor)), unname(X_dense *                 as.numeric(v_factor)))            expect_equal(unname(as.matrix(X * v_factor_larger)),                 unname(X_dense * as.numeric(v_factor_larger)))            expect_equal(unname(as.matrix(X * v_dense)), unname(X_dense *                 as.numeric(v_dense)))            expect_error(X * v_longer)            expect_error(X_dense * v_longer)            expect_equal(unname(as.matrix(X * v_uneven)), unname(X_dense *                 as.numeric(v_uneven)))            expect_equal(unname(as.matrix(X * v_uneven_longer)),                 unname(X_dense * as.numeric(v_uneven_longer)))            expect_equal(unname(as.matrix(X * v_uneven_longer2)),                 unname(X_dense * as.numeric(v_uneven_longer2)))            expect_equal(unname(as.matrix(X * v_scalar)), unname(X_dense *                 as.numeric(v_scalar)))            expect_equal(unname(as.lmatrix(X & v_exact)), unname(X_dense &                 as.numeric(v_exact)))            expect_equal(unname(as.lmatrix(X & v_factor)), unname(X_dense &                 as.numeric(v_factor)))            expect_equal(unname(as.lmatrix(X & v_factor_larger)),                 unname(X_dense & as.numeric(v_factor_larger)))            expect_equal(unname(as.lmatrix(X & v_dense)), unname(X_dense &                 as.numeric(v_dense)))            expect_error(X & v_longer)            expect_error(X_dense & v_longer)            expect_equal(unname(as.lmatrix(X & v_uneven)), unname(X_dense &                 as.numeric(v_uneven)))            expect_equal(unname(as.lmatrix(X & v_uneven_longer)),                 unname(X_dense & as.numeric(v_uneven_longer)))            expect_equal(unname(as.lmatrix(X & v_uneven_longer2)),                 unname(X_dense & as.numeric(v_uneven_longer2)))            expect_equal(unname(as.lmatrix(X & v_scalar)), unname(X_dense &                 as.numeric(v_scalar)))            expect_equal(unname(as.matrix(X/v_exact)), unname(X_dense/as.numeric(v_exact)))            expect_equal(unname(as.matrix(X/v_factor)), unname(X_dense/as.numeric(v_factor)))            expect_equal(unname(as.matrix(X/v_factor_larger)),                 unname(X_dense/as.numeric(v_factor_larger)))            expect_equal(unname(as.matrix(X/v_dense)), unname(X_dense/as.numeric(v_dense)))            expect_error(X/v_longer)            expect_error(X_dense/v_longer)            expect_equal(unname(as.matrix(X/v_uneven)), unname(X_dense/as.numeric(v_uneven)))            expect_equal(unname(as.matrix(X/v_uneven_longer)),                 unname(X_dense/as.numeric(v_uneven_longer)))            expect_equal(unname(as.matrix(X/v_uneven_longer2)),                 unname(X_dense/as.numeric(v_uneven_longer2)))            expect_equal(unname(as.matrix(X/v_scalar)), unname(X_dense/as.numeric(v_scalar)))            if (!getOption("MatrixExtra.ignore_na")) {                expect_equal(unname(as.matrix(v_exact/X)), unname(as.numeric(v_exact)/X_dense))                expect_equal(unname(as.matrix(v_factor/X)), unname(as.numeric(v_factor)/X_dense))                expect_equal(unname(as.matrix(v_factor_larger/X)),                   unname(as.numeric(v_factor_larger)/X_dense))                expect_equal(unname(as.matrix(v_dense/X)), unname(as.numeric(v_dense)/X_dense))                expect_error(v_longer/X)                expect_error(v_longer/X_dense)                expect_equal(unname(as.matrix(v_uneven/X)), unname(as.numeric(v_uneven)/X_dense))                expect_equal(unname(as.matrix(v_uneven_longer/X)),                   unname(as.numeric(v_uneven_longer)/X_dense))                expect_equal(unname(as.matrix(v_uneven_longer2/X)),                   unname(as.numeric(v_uneven_longer2)/X_dense))                expect_equal(unname(as.matrix(v_scalar/X)), unname(as.numeric(v_scalar)/X_dense))            }            if (!getOption("MatrixExtra.ignore_na")) {                expect_equal(unname(as.matrix(X^v_exact)), unname(X_dense^as.numeric(v_exact)))                expect_equal(unname(as.matrix(X^v_factor)), unname(X_dense^as.numeric(v_factor)))                expect_equal(unname(as.matrix(X^v_factor_larger)),                   unname(X_dense^as.numeric(v_factor_larger)))                expect_equal(unname(as.matrix(X^v_dense)), unname(X_dense^as.numeric(v_dense)))                expect_error(X^v_longer)                expect_error(X_dense^v_longer)                expect_equal(unname(as.matrix(X^v_uneven)), unname(X_dense^as.numeric(v_uneven)))                expect_equal(unname(as.matrix(X^v_uneven_longer)),                   unname(X_dense^as.numeric(v_uneven_longer)))                expect_equal(unname(as.matrix(X^v_uneven_longer2)),                   unname(X_dense^as.numeric(v_uneven_longer2)))                expect_equal(unname(as.matrix(X^v_scalar)), unname(X_dense^as.numeric(v_scalar)))                expect_equal(unname(as.matrix(v_exact^X)), unname(as.numeric(v_exact)^X_dense))                expect_equal(unname(as.matrix(v_factor^X)), unname(as.numeric(v_factor)^X_dense))                expect_equal(unname(as.matrix(v_factor_larger^X)),                   unname(as.numeric(v_factor_larger)^X_dense))                expect_equal(unname(as.matrix(v_dense^X)), unname(as.numeric(v_dense)^X_dense))                expect_error(v_longer^X)                expect_error(v_longer^X_dense)                expect_equal(unname(as.matrix(v_uneven^X)), unname(as.numeric(v_uneven)^X_dense))                expect_equal(unname(as.matrix(v_uneven_longer^X)),                   unname(as.numeric(v_uneven_longer)^X_dense))                expect_equal(unname(as.matrix(v_uneven_longer2^X)),                   unname(as.numeric(v_uneven_longer2)^X_dense))                expect_equal(unname(as.matrix(v_scalar^X)), unname(as.numeric(v_scalar)^X_dense))            }            expect_equal(unname(as.matrix(X%%v_exact)), unname(X_dense%%as.numeric(v_exact)))            expect_equal(unname(as.matrix(X%%v_factor)), unname(X_dense%%as.numeric(v_factor)))            expect_equal(unname(as.matrix(X%%v_factor_larger)),                 unname(X_dense%%as.numeric(v_factor_larger)))            expect_equal(unname(as.matrix(X%%v_dense)), unname(X_dense%%as.numeric(v_dense)))            expect_error(X%%v_longer)            expect_error(X_dense%%v_longer)            expect_equal(unname(as.matrix(X%%v_uneven)), unname(X_dense%%as.numeric(v_uneven)))            expect_equal(unname(as.matrix(X%%v_uneven_longer)),                 unname(X_dense%%as.numeric(v_uneven_longer)))            expect_equal(unname(as.matrix(X%%v_uneven_longer2)),                 unname(X_dense%%as.numeric(v_uneven_longer2)))            expect_equal(unname(as.matrix(X%%v_scalar)), unname(X_dense%%as.numeric(v_scalar)))            if (!getOption("MatrixExtra.ignore_na")) {                expect_equal(unname(as.matrix(v_exact%%X)), unname(as.numeric(v_exact)%%X_dense))                expect_equal(unname(as.matrix(v_factor%%X)),                   unname(as.numeric(v_factor)%%X_dense))                expect_equal(unname(as.matrix(v_factor_larger%%X)),                   unname(as.numeric(v_factor_larger)%%X_dense))                expect_equal(unname(as.matrix(v_dense%%X)), unname(as.numeric(v_dense)%%X_dense))                expect_error(v_longer%%X)                expect_error(v_longer%%X_dense)                expect_equal(unname(as.matrix(v_uneven%%X)),                   unname(as.numeric(v_uneven)%%X_dense))                expect_equal(unname(as.matrix(v_uneven_longer%%X)),                   unname(as.numeric(v_uneven_longer)%%X_dense))                expect_equal(unname(as.matrix(v_uneven_longer2%%X)),                   unname(as.numeric(v_uneven_longer2)%%X_dense))                expect_equal(unname(as.matrix(v_scalar%%X)),                   unname(as.numeric(v_scalar)%%X_dense))            }            expect_equal(unname(as.matrix(X%/%v_exact)), unname(X_dense%/%as.numeric(v_exact)))            expect_equal(unname(as.matrix(X%/%v_factor)), unname(X_dense%/%as.numeric(v_factor)))            expect_equal(unname(as.matrix(X%/%v_factor_larger)),                 unname(X_dense%/%as.numeric(v_factor_larger)))            expect_equal(unname(as.matrix(X%/%v_dense)), unname(X_dense%/%as.numeric(v_dense)))            expect_error(X%/%v_longer)            expect_error(X_dense%/%v_longer)            expect_equal(unname(as.matrix(X%/%v_uneven)), unname(X_dense%/%as.numeric(v_uneven)))            expect_equal(unname(as.matrix(X%/%v_uneven_longer)),                 unname(X_dense%/%as.numeric(v_uneven_longer)))            expect_equal(unname(as.matrix(X%/%v_uneven_longer2)),                 unname(X_dense%/%as.numeric(v_uneven_longer2)))            expect_equal(unname(as.matrix(X%/%v_scalar)), unname(X_dense%/%as.numeric(v_scalar)))            if (!getOption("MatrixExtra.ignore_na")) {                expect_equal(unname(as.matrix(v_exact%/%X)),                   unname(as.numeric(v_exact)%/%X_dense))                expect_equal(unname(as.matrix(v_factor%/%X)),                   unname(as.numeric(v_factor)%/%X_dense))                expect_equal(unname(as.matrix(v_factor_larger%/%X)),                   unname(as.numeric(v_factor_larger)%/%X_dense))                expect_equal(unname(as.matrix(v_dense%/%X)),                   unname(as.numeric(v_dense)%/%X_dense))                expect_error(v_longer%/%X)                expect_error(v_longer%/%X_dense)                expect_equal(unname(as.matrix(v_uneven%/%X)),                   unname(as.numeric(v_uneven)%/%X_dense))                expect_equal(unname(as.matrix(v_uneven_longer%/%X)),                   unname(as.numeric(v_uneven_longer)%/%X_dense))                expect_equal(unname(as.matrix(v_uneven_longer2%/%X)),                   unname(as.numeric(v_uneven_longer2)%/%X_dense))                expect_equal(unname(as.matrix(v_scalar%/%X)),                   unname(as.numeric(v_scalar)%/%X_dense))            }        })    }    run_tests <- function(X, X_dense, v_exact, v_factor, v_factor_larger,         v_dense, v_longer, v_uneven, v_uneven_longer, v_uneven_longer2,         v_scalar) {        run_tests_(as.csr.matrix(X), X_dense, v_exact, v_factor,             v_factor_larger, v_dense, v_longer, v_uneven, v_uneven_longer,             v_uneven_longer2, v_scalar)        run_tests_(as.coo.matrix(X), X_dense, v_exact, v_factor,             v_factor_larger, v_dense, v_longer, v_uneven, v_uneven_longer,             v_uneven_longer2, v_scalar)    }    run_tests(X, X_dense, v_exact, v_factor, v_factor_larger,         v_dense, v_longer, v_uneven, v_uneven_longer, v_uneven_longer2,         v_scalar)    v_exact <- add_rare(v_exact, 0.3)    v_factor <- add_rare(v_factor, 0.3)    v_factor_larger <- add_rare(v_factor_larger, 0.3)    v_dense <- add_rare(v_dense, 0.3)    v_uneven <- add_rare(v_uneven, 0.3)    v_uneven_longer <- add_rare(v_uneven_longer, 0.3)    v_uneven_longer2 <- add_rare(v_uneven_longer2, 0.3)    X@x <- add_rare(X@x, 0.15)    X_dense <- as.matrix(X)    run_tests(X, X_dense, v_exact, v_factor, v_factor_larger,         v_dense, v_longer, v_uneven, v_uneven_longer, v_uneven_longer2,         v_scalar)    v_exact <- add_zeros(v_exact, 0.3)    v_factor <- add_zeros(v_factor, 0.3)    v_factor_larger <- add_zeros(v_factor_larger, 0.3)    v_dense <- add_zeros(v_dense, 0.3)    v_uneven <- add_zeros(v_uneven, 0.3)    v_uneven_longer <- add_zeros(v_uneven_longer, 0.3)    v_uneven_longer2 <- add_zeros(v_uneven_longer2, 0.3)    X@x <- add_zeros(X@x, 0.15)    X_dense <- as.matrix(X)    restore_old_matrix_behavior()    run_tests(X, X_dense, v_exact, v_factor, v_factor_larger,         v_dense, v_longer, v_uneven, v_uneven_longer, v_uneven_longer2,         v_scalar)    v_exact <- add_ones(v_exact, 0.15)    v_factor <- add_ones(v_factor, 0.15)    v_factor_larger <- add_ones(v_factor_larger, 0.15)    v_dense <- add_ones(v_dense, 0.15)    v_uneven <- add_ones(v_uneven, 0.15)    v_uneven_longer <- add_ones(v_uneven_longer, 0.15)    v_uneven_longer2 <- add_ones(v_uneven_longer2, 0.15)    X@x <- add_ones(X@x, 0.1)    X_dense <- as.matrix(X)    restore_old_matrix_behavior()    run_tests(X, X_dense, v_exact, v_factor, v_factor_larger,         v_dense, v_longer, v_uneven, v_uneven_longer, v_uneven_longer2,         v_scalar)    v_exact[c(1, 5, 7, 10, length(v_exact))] <- NA_real_    v_factor[c(1, 5, 7, 10, length(v_factor))] <- NA_real_    v_factor_larger[c(1, 5, 7, 10, length(v_factor_larger))] <- NA_real_    v_dense[c(1, 5, 7, 10, length(v_dense))] <- NA_real_    v_longer[c(1, 5, 7, 10, length(v_longer))] <- NA_real_    v_uneven[c(1, 5, 7, 10, length(v_uneven))] <- NA_real_    v_uneven_longer[c(1, 5, 7, 10, length(v_uneven_longer))] <- NA_real_    v_uneven_longer2[c(1, 5, 7, 10, length(v_uneven_longer2))] <- NA_real_    X@x[c(1, 5, 7, 10, length(X@x))] <- NA_real_    X_dense <- as.matrix(X)    restore_old_matrix_behavior()    run_tests(X, X_dense, v_exact, v_factor, v_factor_larger,         v_dense, v_longer, v_uneven, v_uneven_longer, v_uneven_longer2,         v_scalar)    v_exact <- add_inf(v_exact, 0.3)    v_factor <- add_inf(v_factor, 0.3)    v_factor_larger <- add_inf(v_factor_larger, 0.3)    v_dense <- add_inf(v_dense, 0.3)    v_uneven <- add_inf(v_uneven, 0.3)    v_uneven_longer <- add_inf(v_uneven_longer, 0.3)    v_uneven_longer2 <- add_inf(v_uneven_longer2, 0.3)    v_scalar <- Inf    X@x <- add_inf(X@x, 0.1)    X_dense <- as.matrix(X)    restore_old_matrix_behavior()    run_tests(X, X_dense, v_exact, v_factor, v_factor_larger,         v_dense, v_longer, v_uneven, v_uneven_longer, v_uneven_longer2,         v_scalar)    v_exact[5:20] <- NA_real_    v_factor[5:20] <- NA_real_    v_factor_larger[5:20] <- NA_real_    v_dense[5:20] <- NA_real_    v_longer[5:20] <- NA_real_    v_uneven[5:20] <- NA_real_    v_uneven_longer[5:20] <- NA_real_    v_uneven_longer2[5:20] <- NA_real_    v_scalar <- 1    restore_old_matrix_behavior()    run_tests(X, X_dense, v_exact, v_factor, v_factor_larger,         v_dense, v_longer, v_uneven, v_uneven_longer, v_uneven_longer2,         v_scalar)    v_exact[] <- NA_real_    v_factor[] <- NA_real_    v_factor_larger[] <- NA_real_    v_dense[] <- NA_real_    v_longer[] <- NA_real_    v_uneven[] <- NA_real_    v_uneven_longer[] <- NA_real_    v_uneven_longer2[] <- NA_real_    v_scalar <- NA_real_    X@x[] <- NA_real_    X_dense <- as.matrix(X)    restore_old_matrix_behavior()    run_tests(X, X_dense, v_exact, v_factor, v_factor_larger,         v_dense, v_longer, v_uneven, v_uneven_longer, v_uneven_longer2,         v_scalar)    v_exact[] <- 0    v_factor[] <- 0    v_factor_larger[] <- 0    v_dense[] <- 0    v_longer[] <- 0    v_uneven[] <- 0    v_uneven_longer[] <- 0    v_uneven_longer2[] <- 0    v_scalar <- 0    X@x[] <- 0    X_dense <- as.matrix(X)    restore_old_matrix_behavior()    run_tests(X, X_dense, v_exact, v_factor, v_factor_larger,         v_dense, v_longer, v_uneven, v_uneven_longer, v_uneven_longer2,         v_scalar)    test_scalar <- function(X, X_dense, v_scalar) {        suppressWarnings({            expect_equal(unname(as.matrix(X * v_scalar)), unname(X_dense *                 as.numeric(v_scalar)))            expect_equal(unname(as.lmatrix(X & v_scalar)), unname(X_dense &                 as.numeric(v_scalar)))            expect_equal(unname(as.matrix(X/v_scalar)), unname(X_dense/as.numeric(v_scalar)))            expect_equal(unname(as.matrix(v_scalar/X)), unname(as.numeric(v_scalar)/X_dense))            expect_equal(unname(as.matrix(X^v_scalar)), unname(X_dense^as.numeric(v_scalar)))            expect_equal(unname(as.matrix(v_scalar^X)), unname(as.numeric(v_scalar)^X_dense))            expect_equal(unname(as.matrix(X%%v_scalar)), unname(X_dense%%as.numeric(v_scalar)))            expect_equal(unname(as.matrix(v_scalar%%X)), unname(as.numeric(v_scalar)%%X_dense))            expect_equal(unname(as.matrix(X%/%v_scalar)), unname(X_dense%/%as.numeric(v_scalar)))            expect_equal(unname(as.matrix(v_scalar%/%X)), unname(as.numeric(v_scalar)%/%X_dense))        })    }    for (v_scalar in c(-Inf, -3, -2, -1.5, -1, -0.5, -1/3, 0,         1/3, 0.5, 1, 1.5, 2, 3, Inf, NA, numeric())) {        test_scalar(as.csr.matrix(X), X_dense, v_scalar)        test_scalar(as.coo.matrix(X), X_dense, v_scalar)    }})
  27: eval(code, test_env)
  28: eval(code, test_env)
  29: withCallingHandlers({    eval(code, test_env)    if (!handled && !is.null(test)) {        skip_empty()    }}, expectation = handle_expectation, skip = handle_skip, warning = handle_warning,     message = handle_message, error = handle_error)
  30: doTryCatch(return(expr), name, parentenv, handler)
  31: tryCatchOne(expr, names, parentenv, handlers[[1L]])
  32: tryCatchList(expr, names[-nh], parentenv, handlers[-nh])
  33: doTryCatch(return(expr), name, parentenv, handler)
  34: tryCatchOne(tryCatchList(expr, names[-nh], parentenv, handlers[-nh]),     names[nh], parentenv, handlers[[nh]])
  35: tryCatchList(expr, classes, parentenv, handlers)
  36: tryCatch(withCallingHandlers({    eval(code, test_env)    if (!handled && !is.null(test)) {        skip_empty()    }}, expectation = handle_expectation, skip = handle_skip, warning = handle_warning,     message = handle_message, error = handle_error), error = handle_fatal,     skip = function(e) {    })
  37: test_code(NULL, exprs, env)
  38: source_file(path, child_env(env), wrap = wrap)
  39: FUN(X[[i]], ...)
  40: lapply(test_paths, test_one_file, env = env, wrap = wrap)
  41: force(code)
  42: doWithOneRestart(return(expr), restart)
  43: withOneRestart(expr, restarts[[1L]])
  44: withRestarts(testthat_abort_reporter = function() NULL, force(code))
  45: with_reporter(reporters$multi, lapply(test_paths, test_one_file,     env = env, wrap = wrap))
  46: test_files(test_dir = test_dir, test_package = test_package,     test_paths = test_paths, load_helpers = load_helpers, reporter = reporter,     env = env, stop_on_failure = stop_on_failure, stop_on_warning = stop_on_warning,     wrap = wrap, load_package = load_package)
  47: test_files(test_dir = path, test_paths = test_paths, test_package = package,     reporter = reporter, load_helpers = load_helpers, env = env,     stop_on_failure = stop_on_failure, stop_on_warning = stop_on_warning,     wrap = wrap, load_package = load_package, parallel = parallel)
  48: test_dir("testthat", package = package, reporter = reporter,     ..., load_package = "installed")
  49: test_check("MatrixExtra")
  An irrecoverable exception occurred. R is aborting now ...