Package {caverify}


Type: Package
Title: Fast Strength-t Coverage Verification for Covering Arrays
Version: 0.2.0
Description: Verifies that an array covers every t-way interaction, the certificate check for covering arrays, using compiled C code with optional 'OpenMP' threading. Supports uniform and mixed-level (per-column symbol counts) arrays. Missing values mark flexible ("don't care") entries, which contribute nothing to coverage, so a verified array remains covering however they are filled. Designed to be easy to embed in other packages: a single C file with a registered .Call entry point and one R wrapper.
License: MIT + file LICENSE
URL: https://github.com/chrispbsmolen/ca-tools
BugReports: https://github.com/chrispbsmolen/ca-tools/issues
Encoding: UTF-8
Language: en-US
Imports: parallel
NeedsCompilation: yes
Packaged: 2026-09-19 22:25:58 UTC; axviam
Author: Christopher Smolen [aut, cre]
Maintainer: Christopher Smolen <chrispbsmolen@gmail.com>
Repository: CRAN
Date/Publication: 2026-09-20 02:50:02 UTC

Verify strength-t coverage of a covering array

Description

Checks that an N \times k array covers every t-way interaction: for every choice of t columns and every combination of their symbols, at least one row exhibits that combination. This is the certificate check for a covering array, run in compiled C at speeds suitable for large arrays and strengths.

Both uniform arrays (every column has v symbols, v^t combinations per column set) and mixed-level arrays (column i has its own v_i symbols, \prod v_i combinations per column set) are supported; a uniform array is the degenerate mixed-radix case in which all radices coincide.

Usage

ca_verify(x, t, v = NULL, threads = NULL, report = 10L)

Arguments

x

an integer matrix or data frame of integers; rows are runs, columns are factors. NA marks a flexible ("don't care") entry: a row contributes nothing to a projection in which it has an NA, so a verified array is covering no matter how its NA entries are later filled.

t

interaction strength to verify (positive integer).

v

number of symbols. One of: NULL (the default) to infer per-column symbol counts from each column's own maximum ("auto" is an explicit alias); a single integer >= 2 declaring a uniform array; or an integer vector of length ncol(x) giving each column its own number of symbols. Versions 0.1.x inferred one uniform value from the global data range instead; changed on a recommendation by Ulrike Groemping, a default should not assume a uniform CA. Declare v explicitly when the check should also catch a column that fails to reach its intended number of symbols. Symbols may be coded 0..v-1 or 1..v (per column for mixed levels); 1-based input is detected and shifted automatically.

threads

number of threads. NULL (the default) picks automatically: half the machine's logical cores, single-threaded for small jobs, capped during CRAN checks. Override with options(caverify.threads = n) or this argument. Long runs are interruptible without aborting R.

report

maximum number of missing-tuple examples to collect.

Value

An object of class ca_verify: a list with covered (logical), colsets, gaps, missing_tuples, examples (matrix; first t entries per row are 1-based column indices, the rest the missing value combination in the input coding), and t, v (a single integer for uniform arrays, an integer vector of per-column symbol counts for mixed-level arrays), N, k.

Examples

ca <- rbind(c(0,0,0), c(0,1,1), c(1,0,1), c(1,1,0))
ca_verify(ca, t = 2)          # a covering array of strength 2
ca_verify(ca[-1, ], t = 2)    # removing a run breaks coverage

# a mixed-level array: one 3-level and two 2-level columns
mca <- as.matrix(expand.grid(0:2, 0:1, 0:1))
ca_verify(mca, t = 2, v = c(3, 2, 2))
ca_verify(mca, t = 2)   # the default infers each column's count

mirror server hosted at Truenetwork, Russian Federation.