tests/testthat/test-hanowa.R

context("Involutory matrices")

# invol: involutory ------------------------------

test_that("hanowa matrix", {
  A <- hanowa(4)
  A2 <- hanowa(4, 2)

  B <- matrix(c(-1, 0, 1, 0, 0, -1, 0, 2, -1, 0, -1, 0, 0, -2, 0, -1),
              nrow = 4)

  C <- B
  diag(C) <- 2

  # Breaks on odd
  expect_error(hanowa(3))
  expect_error(hanowa(7))

  expect_equal(norm(A-B), 0)
  expect_equal(norm(A2-C), 0)
})

Try the gallery package in your browser

Any scripts or data that you put into this service are public.

gallery documentation built on Sept. 26, 2024, 5:07 p.m.