cphfCA: Making CA from CPHF

View source: R/cphfCA.R

cphfCAR Documentation

Making CA from CPHF

Description

according to the process outlined in Wagner, Colbourn and Simos (2022)

Usage

cphfCA(t, k, v, start0 = TRUE, ...)

N_cphfCA(t, k, v)

k_cphfCA(t, N, v)

WCS(cphf, q, t, type="2022", ...)

Arguments

t

integer: target strength

k

integer: requested number of columns

v

integer: number of levels, must be a prime power

start0

logical: should the levels of the output array start with 0 (otherwise with 1)?

...

currently not used

N

integer: affordable run size

cphf

matrix with integer entries that can be expanded into permutation vectors of length t; must be a CPHF

q

integer: number of levels, must be a prime power

type

character string providing the type of construction; for the built-in CPHFs, "2022" is the correct entry. It handles CPHFs for which the first entry of the permutation vector refers to the highest power, and which were constructed with Galois fields from SageMath or the Python numbthy module (relevant only for prime powers 8, 9, 16, 25; also implemented in this package via the internal function mygf)
Any type different from the default requests use of the built-in Galois fields of R package lhs.

Value

Function cphfCA returns a matrix of class ca with attributes, which is a covering array of strength 3, 4, 5 or 6.
Function WCS returns a matrix with entries in 0,...,v-1, which is a covering array of strength t, if a valid cphf for strength t is provided; the function is not primarily meant for direct use, but is the workhorse behind cphfCA.

Functions N_cphfCA and k_cphfCA return the required run size or the achievable number of columns, respectively.

Details

Function cphfCA implements CAs from the Wagner et al. (2022) construction for length t h-tuples to create length v^t permutation vectors for v levels and strength t. The workhorse function WCS uses a stored covering perfect hash family (CPHF); at present, only the CPHFs from Wagner, Colbourn and Simos (2022) are implemented via the function cphfCA (see WCS_CPHFs and CPHFcat).
Users who have their own valid CPHF (not SCPHF) that is not part of this package can use the function for creating a CA. Note that the creation of a CA can take a long time for large cases; for example, creation of a CA(501121, 4, 665, 17) from the relevant CPHF with 6 rows (6*(17^4-1)+1=501121) took approximately 140 minutes on the authors Windows computer with 32GB RAM (which appeared to be the limiting factor). This package is not optimized to handle cases as large as this.

The construction relies on a Galois field GF(v). The CPHFs from Wagner et al. (2022) for v=8, v=9, v=16 and v=25 require a different Galois field than otherwise used in this package; these deviating Galois fields are created with the internal function mygf; function WCS takes the argument type, with which these Galois fields are activated (per default), but can also be deactivated in favor of the Galois fields of package lhs by specifying any type different from "2022".
The data frame CPHFcat holds the overview information on which constructions are implemented for function cphfCA.

References

Wagner, Colbourn and Simos (2022)

Examples

# applying the construction for small CPHF from the Wagner et al. (2022) paper

# strength 3
head(CPHFcat[which(CPHFcat$v==4),])
## the CPHF for the first row
WCS_CPHFs[["3"]][["4"]][["71"]]
D <- cphfCA(3,71,4)
dim(D)

  coverage(D,3)

Ns(3,71,4)   ## size is current best but not eCAN

# strength 6
Ns(6, 10, 3)  ## by far best implemented,
              ## slightly better array from group who does not share their arrays
dim(D <- bestCA(6,10,3))
coverage(D, 6)

## the CPHF for the 91st row has flexible entries
CPHFcat[91,]
rowSums(is.na(WCS_CPHFs[["4"]][["3"]][["3504"]]))
## many flexible values in the last row,
## eCAN claims one row less for this construction
Ns(4,3504,3)   ## by far the best implemented

  ## creation of this CA is slow because of the many columns
  ## it can therefore be suppressed by the run.donttest argument
  ##       to function example()
  D <- cphfCA(4,3504,3)  ## about 1 minute on author's machine
  dim(D)



CAs documentation built on Nov. 29, 2026, 1:06 a.m.