R Under development (unstable) (2025-02-12 r87715 ucrt) -- "Unsuffered Consequences" Copyright (C) 2025 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(flint) > > n <- 10L > x. <- seq_len(n); y. <- rev(x.); z. <- integer(length(x.)) > b. <- c(2L, 5L, 8L) > > g1 <- expand.grid(rightmost.closed = c(FALSE, TRUE), + all.inside = c(FALSE, TRUE), + left.open = c(FALSE, TRUE)) > g2 <- g1 |> + transform(include.lowest = rightmost.closed, + right = left.open) |> + subset(!all.inside, c(include.lowest, right)) > > f1 <- lapply(.mapply(findInterval, g1, list(x = x., vec = b.)), + as, "ulong") > f2 <- f1[!g1$all.inside] > > for (.cl in c("ulong", "slong", "fmpz", "fmpq", "mag", "arf", "acf", + "arb", "acb")) { + x <- new(.cl, x = x.); y <- new(.cl, x = y.); z <- new(.cl, x = z.) + stopifnot(identical(mtfrm(x), format(x, base = 62L, digits = 0L)), + identical(match(x, x, 0L), x.), + identical(match(x, y, 0L), y.), + identical(match(x, z, 0L), z.), + identical(anyDuplicated(x), 0L), + identical(anyDuplicated(x, fromLast = TRUE), 0L), + identical(anyDuplicated(z), 2L), + identical(anyDuplicated(z, fromLast = TRUE), n - 1L), + identical(anyDuplicated(z, incomparables = 0L), 0L), + identical(duplicated(x), logical(n)), + identical(duplicated(x, fromLast = TRUE), logical(n)), + identical(duplicated(z), !replace(logical(n), 1L, TRUE)), + identical(duplicated(z, fromLast = TRUE), !replace(logical(n), n, TRUE)), + identical(duplicated(z, incomparables = 0L), logical(n)), + flintIdentical(unique(x), x), + flintIdentical(unique(z), z[1L]), + flintIdentical(unique(z, incomparables = 0L), z)) + switch(.cl, + "acf" =, "arb" =, "acb" = NULL, + { + b <- new(.cl, x = b.) + stopifnot(all(mapply(flintIdentical, f1, .mapply(findInterval, g1, list(x = x, vec = b)))), + all(mapply(flintIdentical, f2, .mapply( cut, g2, list(x = x, breaks = b))))) + }) + } > > proc.time() user system elapsed 0.48 0.06 0.54