tests/testthat/test-create_Q.R

test_that("Test that QR decomposition of A works", {
  create_QR <- function(K) {
    A <- diag(K)
    A[K, 1:(K - 1)] <- -1
    A[K, K] <- 0
    qr.Q(qr(A))[, 1:(K - 1)]
  }
  set.seed(123)
  S <- 10
  x <- stats::rnorm(S - 1)
  expect_equal(create_QR(S), -create_Q(S))
  expect_equal(create_QR(S) %*% x, -create_Q(S) %*% x)
})

Try the seqHMM package in your browser

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

seqHMM documentation built on June 8, 2025, 10:16 a.m.