R Under development (unstable) (2024-09-15 r87152 ucrt) -- "Unsuffered Consequences" Copyright (C) 2024 The R Foundation for Statistical Computing Platform: x86_64-w64-mingw32/x64 R is free software and comes with ABSOLUTELY NO WARRANTY. You are welcome to redistribute it under certain conditions. Type 'license()' or 'licence()' for distribution details. R is a collaborative project with many contributors. Type 'contributors()' for more information and 'citation()' on how to cite R or R packages in publications. Type 'demo()' for some demos, 'help()' for on-line help, or 'help.start()' for an HTML browser interface to help. Type 'q()' to quit R. > library(supc) > supc:::.set_num_threads(2) > # test get_sorted_index > > r <- supc:::.get_sorted_index(1:10) > stopifnot(isTRUE(all.equal(r, 0:9))) > > r <- supc:::.get_sorted_index(10:1) > stopifnot(isTRUE(all.equal(r, 9:0))) > > r <- supc:::.get_sorted_index(c(1, 3, 2, 4, 0, -1)) > stopifnot(isTRUE(all.equal(r, c(5, 4, 0, 2, 1, 3)))) > > r <- supc:::.get_sorted_index(c(1, 1, 2, 2)) > stopifnot(isTRUE(all.equal(r, c(0, 1, 2, 3)))) > > r <- supc:::.get_sorted_index(c(2, 1, 1, 1)) > stopifnot(isTRUE(all.equal(r, c(1, 2, 3, 0)))) > > r <- supc:::.get_sorted_index(numeric(0)) > stopifnot(isTRUE(all.equal(r, integer(0)))) > > # test get_inverted_index_for_sorted_index > > r <- supc:::.get_inverted_index_for_sorted_index(0:9) > stopifnot(isTRUE(all.equal(r, 0:9))) > > r <- supc:::.get_inverted_index_for_sorted_index(9:0) > stopifnot(isTRUE(all.equal(r, 9:0))) > > r <- supc:::.get_inverted_index_for_sorted_index(c(5, 4, 0, 2, 1, 3)) > stopifnot(isTRUE(all.equal(r, c(2, 4, 3, 5, 1, 0)))) > > r <- supc:::.get_inverted_index_for_sorted_index(c(1, 2, 3, 0)) > stopifnot(isTRUE(all.equal(r, c(3, 0, 1, 2)))) > > r <- supc:::.get_inverted_index_for_sorted_index(integer(0)) > stopifnot(isTRUE(all.equal(r, integer(0)))) > > > proc.time() user system elapsed 0.18 0.07 0.25