pygsti.tools.matrixmod2

pygsti.tools.matrixmod2#

General matrix utilities. Some, but not all, are specific to matrices over the ints modulo 2.

Functions

Axb_mod2(A, b)

Solves Ax = b over GF(2)

albert_factor(d[, failcount, rand_state])

Returns a matrix M such that d = M M.T for symmetric d, where d and M are matrices over [0,1] mod 2.

det_mod2(m)

Returns the determinant of a matrix over the integers modulo 2 (GL(n,2)).

diagonal_as_matrix(m)

Returns a diagonal matrix containing the diagonal of m.

diagonal_as_vec(m)

Returns a 1D array containing the diagonal of the input square 2D array m.

dot_mod2(m1, m2)

Returns the product over the integers modulo 2 of two matrices.

fix_top(a)

Computes the permutation matrix P such that the [1:t,1:t] submatrix of P a P is invertible.

gaussian_elimination_mod2(a)

Gaussian elimination mod2 of a.

inv_mod2(m)

Finds the inverse of a matrix over GL(n,2)

matrix_directsum(m1, m2)

Returns the direct sum of two square matrices of integers.

multidot_mod2(mlist)

Returns the product over the integers modulo 2 of a list of matrices.

onesify(a[, failcount, maxfailcount, rand_state])

Returns M such that M a M.T has ones along the main diagonal

permute_top(a, i)

Permutes the first row & col with the i'th row & col

proper_permutation(a)

Computes the permutation matrix P such that all [n:t,n:t] submatrices of P a P are invertible.

random_bitstring(n, p[, failcount, rand_state])

Constructs a random bitstring of length n with parity p

random_invertable_matrix(n[, failcount, ...])

Finds a random invertable matrix M over GL(n,2)

random_symmetric_invertable_matrix(n[, ...])

Creates a random, symmetric, invertible matrix from GL(n,2)

strictly_upper_triangle(m)

Returns a matrix containing the strictly upper triangle of m and zeros elsewhere.