test_that("tmpinv works for AP/TM on symmetric 10x10 matrix", {
# smaller dimensions to avoid LAPACK instability
# deterministic, stable matrix (no rnorm)
base <- matrix(seq_len(n_cells), nrow = m, ncol = p)
idx <- seq(1L, n_cells, length.out = max(1L, floor(0.1 * n_cells)))
M     <- diag(n_cells)[idx, , drop = FALSE]
b_val <- matrix(as.numeric(X_true)[idx], ncol = 1L)
M = M, b_row = b_row, b_col = b_col, b_val = b_val,
# minimal bootstrap test (small N to avoid CRAN timeouts)
test_that("tmpinv works for reduced AP/TM on 20x20 zero-diagonal matrix", {
idx <- seq(1L, n_cells, length.out = max(1L, floor(0.2 * n_cells)))
reduced = c(10L, 10L),   # smaller blocks → stable on Debian & Windows

"tmpinv works for AP/TM on symmetric 10x10 matrix"
"tmpinv works for reduced AP/TM on 20x20 zero-diagonal matrix"
# smaller blocks → stable on Debian & Windows

tmpinv works for reduced AP/TM on 20x20 zero-diagonal matrix