tests/test-config.R

library(supc)
supc:::.set_num_threads(2)
wrong.dist <- function(x) {
  x[] <- 0
  stats::dist(x)
}
X <- structure(
  c(-0.125290762148466, 2.03672866484442, 0.832874277517991,  6.31905616042756, 8.06590155436307, 6.8359063231764,
    3.0974858104857,  5.14766494102584, 4.1151562703307, 0.164244239019618, 2.1187802642435,  1.18379547432164,
    6.15642726014621, 8.01491299667304, 6.60212966082732,  3.12396514957894, 4.9887742520942, 3.96884089865893,
    -0.0788579907420699,  1.98813732065776, 1.22000507439678, 6.15263514969151, 7.96709528074928,  6.9493276639727,
    3.13939267508095, 5.11133263973473, 3.8622488610901,  -0.0610776774312712, 0.30235623369017, 1.07796864728229,
    -0.124248116108361,  -0.4429399774355, 1.22498618362862, 2.99101327819695, 2.99676194738021,  4.18876724213706,
    -0.294150476779855, -0.0956300110217241, 1.08358831203994,  0.271735910305809, -0.0205575454685991, 1.07753432231187,
    2.98923899188342,  2.72458808863428, 3.91700108734006, -0.141499031392424, 0.0729163924273661,  1.15370658490308,
    -0.0224692424300456, 0.176221545290843, 1.07962117607341,  2.87759472134985, 3.06822393828489, 3.77412738078384
  ),
  .Dim = c(27L,  2L)
)
dist.mode("wrong", wrong.dist)
g2 <- supc1(X, r = .9, t = .75, implementation = "R")
stopifnot(g2$iteration == 2)
stopifnot(max(g2$cluster) == 1) # because all distance is zero, so there is only one cluster
wush978/supc documentation built on Sept. 19, 2024, 8:36 a.m.