tests/testthat/helper-merge_by_partition.R

m <- matrix(
  c(1.0, 0.9, 0.0, 0.2, 0.0, 0.0,
    0.9, 1.0, 0.6, 0.0, 0.0, 0.0,
    0.0, 0.6, 1.0, 0.0, 0.5, 0.0,
    0.2, 0.0, 0.0, 1.0, 0.0, 0.0,
    0.0, 0.0, 0.5, 0.0, 1.0, 0.8,
    0.0, 0.0, 0.0, 0.0, 0.8, 1.0),
  nrow = 6,
  byrow = TRUE
)

m <- Matrix::Matrix(m, sparse = TRUE)

partition <- list(c(2,3,5), c(4,6), 1)

m_merge_rows <- matrix(
  c(0.9, 1.6, 2.1, 0.0, 1.5, 0.8,
    0.2, 0.0, 0.0, 1.0, 0.8, 1.0,
    1.0, 0.9, 0.0, 0.2, 0.0, 0.0),
  nrow = 3,
  byrow = TRUE
)

m_merged <- matrix(
  c(5.2, 0.8, 0.9,
    0.8, 2.0, 0.2,
    0.9, 0.2, 1.0),
  nrow = 3,
  byrow = TRUE
)
ytoren/simscaleR documentation built on April 17, 2021, 12:32 p.m.