matrix

coinflip.randtests.matrix.binary_matrix_rank(series, candidate, matrix_dimen: Tuple[int, int] = None)[source]

Independence of neighbouring sequences is compared to expected result

Independence is determined by the matrix rank of a subsequence, where it is split into multiple rows to form a matrix. The counts of different rank bins is referenced to a hypothetically truly random RNG.

Parameters:
  • sequence (array-like) – Output of the RNG being tested
  • candidate (Value present in given sequence) – The value which is counted in each block
  • matrix_dimen (Tuple[int, int]) – Number of rows and columns in each matrix
Returns:

BinaryMatrixRankTestResult – Dataclass that contains the test’s statistic and p-value

coinflip.randtests.matrix.gf2_rank(matrix: Iterable[Iterable[int]]) → int[source]

Finds the rank of a binary matrix

Parameters:matrix (List[Tuple[int, …]]) – Binary matrix to rank
Returns:rank (int) – Rank of matrix

Notes

Implementaton inpisred by a StackOverflow answer from Mark Dickinson.