Skip to content

Commit 8bff829

Browse files
committed
test: add comprehensive unit tests for esim, resim, and ppg_esim eigen selection index methods.
1 parent e2348d9 commit 8bff829

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

tests/testthat/test-eigen_indices.R

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -354,8 +354,9 @@ test_that("ppg_esim: K_P is a rank-1 projection matrix", {
354354

355355
expect_equal(K %*% K, K, tolerance = 1e-8)
356356

357-
# Rank 1
358-
rank_K <- sum(eigen(K, only.values = TRUE)$values > 0.5)
357+
# Rank 1: K_P is an oblique projection (not symmetric), so eigen() may return
358+
# complex values on some platforms; use Re() to discard numerical-noise imaginary parts.
359+
rank_K <- sum(Re(eigen(K, only.values = TRUE)$values) > 0.5)
359360
expect_equal(rank_K, 1L)
360361
})
361362

0 commit comments

Comments
 (0)