tests/testthat/test-invol.R

context("Involutory matrices")

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

test_that("involutory matrix", {
  A <- invol(3)

  B <- matrix(c(-3, -36, 30, 1/2, 8, -7.5, 1/3, 6, -6),
              nrow=3)

  # Verify
  expect_equal(norm(A-B), 0)
  # Is involutory
  expect_equal(norm(A%*%A - diag(3)), 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.