tests/testthat/test-bmat.R

context("Block matrices")

test_that("String initializer works for block matrices", {
  # Example matrices
  A1 <- mat("1, 1; 1, 1")
  A2 <- mat("2, 2; 2, 2")
  A3 <- mat("3, 3, 3, 3")
  A <- mat("1, 1, 2, 2; 1, 1, 2, 2; 3, 3, 3, 3")

  # Construct a block matrix from matrices A1, A2, and A3
  blk <- bmat("A1, A2; A3")

  # Expectations
  expect_identical(blk, A)
})

Try the ramify package in your browser

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

ramify documentation built on June 24, 2025, 9:07 a.m.