helpers.level_permutation(arr, b, modulus=None)
Apply level permutations to a Good lattice point (GLP) design
Parameters
arr |
numpy.numpy.ArrayLike |
A numpy ndarray |
required |
b |
typing.Union[int, list] |
Value by which each element in the array is to be level permuted. Can either be an integer or a list of integers |
required |
modulus |
int |
Modulus used for the permutation. Defaults to None. If None, the number of rows is used as the modulus. |
None |
Returns
| numpy.numpy.ndarray |
npt.ArrayLike: A new array where each element is the result of (arr + b) % modulus |
Examples:
import pyLHD
GLP = pyLHD.GoodLatticePoint(size = (10, pyLHD.euler_phi(10)))
GLP
array([[1, 3, 7, 9],
[2, 6, 4, 8],
[3, 9, 1, 7],
[4, 2, 8, 6],
[5, 5, 5, 5],
[6, 8, 2, 4],
[7, 1, 9, 3],
[8, 4, 6, 2],
[9, 7, 3, 1],
[0, 0, 0, 0]])
Apply a simple linear level permutation in the form of \(D = D+b (mod N)\)
pyLHD.level_permutation(GLP,b = 2)
array([[3, 5, 9, 1],
[4, 8, 6, 0],
[5, 1, 3, 9],
[6, 4, 0, 8],
[7, 7, 7, 7],
[8, 0, 4, 6],
[9, 3, 1, 5],
[0, 6, 8, 4],
[1, 9, 5, 3],
[2, 2, 2, 2]])
pyLHD.level_permutation(GLP, b = [1,4,3,2])
array([[2, 7, 0, 1],
[3, 0, 7, 0],
[4, 3, 4, 9],
[5, 6, 1, 8],
[6, 9, 8, 7],
[7, 2, 5, 6],
[8, 5, 2, 5],
[9, 8, 9, 4],
[0, 1, 6, 3],
[1, 4, 3, 2]])