tests/testthat/test-duplication_mat.R

test_that("duplication matrix n = 2", {
  D <- duplication_mat(2)

  m <- matrix(c(1, 0, 0,
                0, 1, 0,
                0, 1, 0,
                0, 0, 1), ncol = 3, byrow = TRUE)

  expect_equal(D, m)
})

test_that("duplication matrix n = 3", {
  D <- duplication_mat(3)

  m <- matrix(c(1, 0, 0, 0, 0, 0,
                0, 1, 0, 0, 0, 0,
                0, 0, 1, 0, 0, 0,
                0, 1, 0, 0, 0, 0,
                0, 0, 0, 1, 0, 0,
                0, 0, 0, 0, 1, 0,
                0, 0, 1, 0, 0, 0,
                0, 0, 0, 0, 1, 0,
                0, 0, 0, 0, 0, 1), ncol = 6, byrow = TRUE)

  expect_equal(D, m)
})
alexanderlange53/BEKKs documentation built on Nov. 27, 2024, 7:37 p.m.