From 9dd413970bfac3f4c40d8a0ebf5e99a55b495c44 Mon Sep 17 00:00:00 2001 From: Balasubramanian Narasimhan Date: Tue, 3 Oct 2023 18:01:57 -0700 Subject: [PATCH] Update test-sparse-coercion.R --- tests/testthat/test-sparse-coercion.R | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/tests/testthat/test-sparse-coercion.R b/tests/testthat/test-sparse-coercion.R index 5f099f8..7212dee 100644 --- a/tests/testthat/test-sparse-coercion.R +++ b/tests/testthat/test-sparse-coercion.R @@ -14,9 +14,14 @@ test_that("Dense P & A are properly coerced", { }) test_that("Triplet-form P & A are properly coerced", { + P <- list(i = c(1L, 2L, 1L, 2L), j = c(1L, 1L, 2L, 2L), v = c(11.0, 2.0, 2.0, 1.0)) + P$nrow <- 2L; P$ncol <- 2L; class(P) <- "simple_triplet_matrix" P <- slam::as.simple_triplet_matrix(matrix(c(11., 2.0, 2.0, 1.0), 2, 2)) q <- c(3., 4.) - A <- slam::as.simple_triplet_matrix(matrix(c(-1., 0., -1., 2., 3., 0., -1., -3., 5., 4.) , 5, 2)) + A <- list(i = c(1L, 3L, 4L, 5L, 2L, 3L, 4L, 5L), + j = c(1L, 1L, 1L, 1L, 2L, 2L, 2L, 2L), + v = c(-1.0, -1.0, 2.0, 3.0, -1.0, -3.0, 5.0, 4.0)) + A$nrow <- 5L; A$ncol <- 2L; class(A) <- "simple_triplet_matrix" u <- c(0., 0., -15., 100., 80) l <- rep_len(-Inf, 5)