tests/testthat/test-linearAlgebra-mcap-sym.R

## ---- test-linearAlgebra-mcap_sym
message("test-linearAlgebra-mcap-sym")
testthat::test_that(
  "test-linearAlgebra-mcap-sym 2 by 2",
  {
    testthat::expect_equal(
      mcap_sym(2),
      matrix(
        data = c(
          1, 0.0, 0.0, 0,
          0, 0.5, 0.5, 0,
          0, 0.5, 0.5, 0,
          0, 0.0, 0.0, 1
        ),
        nrow = 4
      )
    )
  }
)
testthat::test_that(
  "test-linearAlgebra-mcap-sym 3 by 3",
  {
    testthat::expect_equal(
      mcap_sym(3),
      matrix(
        data = c(
          1, 0.0, 0.0, 0.0, 0, 0.0, 0.0, 0.0, 0,
          0, 0.5, 0.0, 0.5, 0, 0.0, 0.0, 0.0, 0,
          0, 0.0, 0.5, 0.0, 0, 0.0, 0.5, 0.0, 0,
          0, 0.5, 0.0, 0.5, 0, 0.0, 0.0, 0.0, 0,
          0, 0.0, 0.0, 0.0, 1, 0.0, 0.0, 0.0, 0,
          0, 0.0, 0.0, 0.0, 0, 0.5, 0.0, 0.5, 0,
          0, 0.0, 0.5, 0.0, 0, 0.0, 0.5, 0.0, 0,
          0, 0.0, 0.0, 0.0, 0, 0.5, 0.0, 0.5, 0,
          0, 0.0, 0.0, 0.0, 0, 0.0, 0.0, 0.0, 1
        ),
        nrow = 9
      )
    )
  }
)
testthat::test_that(
  "test-linearAlgebra-mcap-sym 4 by 4",
  {
    testthat::expect_equal(
      mcap_sym(4),
      matrix(
        data = c(
          1, 0.0, 0.0, 0.0, 0.0, 0, 0.0, 0.0, 0.0, 0.0, 0, 0.0, 0.0, 0.0, 0.0, 0,
          0, 0.5, 0.0, 0.0, 0.5, 0, 0.0, 0.0, 0.0, 0.0, 0, 0.0, 0.0, 0.0, 0.0, 0,
          0, 0.0, 0.5, 0.0, 0.0, 0, 0.0, 0.0, 0.5, 0.0, 0, 0.0, 0.0, 0.0, 0.0, 0,
          0, 0.0, 0.0, 0.5, 0.0, 0, 0.0, 0.0, 0.0, 0.0, 0, 0.0, 0.5, 0.0, 0.0, 0,
          0, 0.5, 0.0, 0.0, 0.5, 0, 0.0, 0.0, 0.0, 0.0, 0, 0.0, 0.0, 0.0, 0.0, 0,
          0, 0.0, 0.0, 0.0, 0.0, 1, 0.0, 0.0, 0.0, 0.0, 0, 0.0, 0.0, 0.0, 0.0, 0,
          0, 0.0, 0.0, 0.0, 0.0, 0, 0.5, 0.0, 0.0, 0.5, 0, 0.0, 0.0, 0.0, 0.0, 0,
          0, 0.0, 0.0, 0.0, 0.0, 0, 0.0, 0.5, 0.0, 0.0, 0, 0.0, 0.0, 0.5, 0.0, 0,
          0, 0.0, 0.5, 0.0, 0.0, 0, 0.0, 0.0, 0.5, 0.0, 0, 0.0, 0.0, 0.0, 0.0, 0,
          0, 0.0, 0.0, 0.0, 0.0, 0, 0.5, 0.0, 0.0, 0.5, 0, 0.0, 0.0, 0.0, 0.0, 0,
          0, 0.0, 0.0, 0.0, 0.0, 0, 0.0, 0.0, 0.0, 0.0, 1, 0.0, 0.0, 0.0, 0.0, 0,
          0, 0.0, 0.0, 0.0, 0.0, 0, 0.0, 0.0, 0.0, 0.0, 0, 0.5, 0.0, 0.0, 0.5, 0,
          0, 0.0, 0.0, 0.5, 0.0, 0, 0.0, 0.0, 0.0, 0.0, 0, 0.0, 0.5, 0.0, 0.0, 0,
          0, 0.0, 0.0, 0.0, 0.0, 0, 0.0, 0.5, 0.0, 0.0, 0, 0.0, 0.0, 0.5, 0.0, 0,
          0, 0.0, 0.0, 0.0, 0.0, 0, 0.0, 0.0, 0.0, 0.0, 0, 0.5, 0.0, 0.0, 0.5, 0,
          0, 0.0, 0.0, 0.0, 0.0, 0, 0.0, 0.0, 0.0, 0.0, 0, 0.0, 0.0, 0.0, 0.0, 1
        ),
        nrow = 16
      )
    )
  }
)
jeksterslab/linearAlgebra documentation built on Dec. 20, 2021, 10:10 p.m.