Skip to content

Symplectic group over GF2

numqi.group.spf2

canonical ordering of symplectic group elements, implements the algorithms in paper

doi-link How to efficiently select an arbitrary clifford group element

numqi.group.spf2.get_number(n, kind='base')

Get the number of elements in the symplectic group over GF(2) of order 2n.

Parameters:

Name Type Description Default
n int

The order of the symplectic group.

required
kind str

'base', 'order', or 'coset'. Default is 'base'.

'base'

Returns:

Name Type Description
ret (int, tuple[int])

for kind being 'base': The number of elements in the symplectic group (a1,b1,a2,b2,...,an,bn) 'order': The order of the symplectic group. a1b1a2b2...anbn 'coset': The number of cosets in the symplectic group. (a1b1,a2b2,...,an*bn)

numqi.group.spf2.get_inner_product(v0, v1)

Get symplectic inner product of two vectors GF(2).

Parameters:

Name Type Description Default
v0 ndarray

The first vector. dtype=np.uint8, ndim>=1, and shape[-1] is even.

required
v1 ndarray

The second vector. dtype=np.uint8, ndim=1

required

Returns:

Name Type Description
ret ndarray

The symplectic inner product of two vectors. dtype=np.uint8 and ndim=ndim(v0)-1

numqi.group.spf2.int_to_bitarray(i, n)

Convert an integer to a bit array.

int_to_bitarray(3, 4)==[1,1,0,0]

Parameters:

Name Type Description Default
i int

The integer to be converted.

required
n int

The length of the bit array.

required

Returns:

Name Type Description
ret ndarray

The bit array. dtype=np.uint8 and shape=(n,)

numqi.group.spf2.bitarray_to_int(b)

Convert a bit array to an integer.

bitarray_to_int([1,1,0,0])==3

Parameters:

Name Type Description Default
b ndarray

The bit array. dtype=np.uint8 and ndim=1

required

Returns:

Name Type Description
ret int

The integer.

numqi.group.spf2.schmidt_orthogonalization(vec_list)

Schmidt orthogonalization of a list of vectors using the symplectic inner product.

Parameters:

Name Type Description Default
vec_list list[ndarray]

A list of vectors. dtype=np.uint8, ndim=1, and size is even.

required

Returns:

Name Type Description
ret list[ndarray]

A list of orthogonal vectors.

numqi.group.spf2.transvection(x, *h_list)

Apply a transvection to a vector. see doi-link

Parameters:

Name Type Description Default
x ndarray

The vector. dtype=np.uint8, ndim>=1, and shape[-1] is even.

required
h_list tuple[ndarray]

The transvection. dtype=np.uint8, ndim=1, and size is even.

()

Returns:

Name Type Description
ret ndarray

of same shape as x. The result of applying the transvection.

numqi.group.spf2.find_transvection(v0, v1)

find a transvection that maps v0 to v1. see doi-link Lemma 2

h0,h1 = find_transvection(v0, v1)

v1 = transvection(transvection(v0, h0), h1) = transvection(v0, h0, h1)

Parameters:

Name Type Description Default
v0 ndarray

The first vector. dtype=np.uint8, ndim=1, and size is even.

required
v1 ndarray

The second vector. dtype=np.uint8, ndim=1, and size is even.

required

Returns:

Name Type Description
ret ndarray

The transvections. dtype=np.uint8, ndim=2, and shape=(2,size)

numqi.group.spf2.from_int_tuple(int_tuple)

Convert an integer tuple to a symplectic matrix over GF(2).

Parameters:

Name Type Description Default
int_tuple tuple[int]

The integer tuple. len(int_tuple)=2*N0

required

Returns:

Name Type Description
ret ndarray

The symplectic matrix. dtype=np.uint8, ndim=2, and shape=(2*N0,2*N0)

numqi.group.spf2.to_int_tuple(mat)

Convert a symplectic matrix over GF(2) to an integer tuple.

Parameters:

Name Type Description Default
mat ndarray

The symplectic matrix. dtype=np.uint8, ndim=2, and shape=(2*N0,2*N0)

required

Returns:

Name Type Description
ret tuple[int]

The integer tuple. len(ret)=2*N0

numqi.group.spf2.inverse(mat)

Get the inverse of a symplectic matrix over GF(2).

Parameters:

Name Type Description Default
mat ndarray

The symplectic matrix. dtype=np.uint8, ndim=2, and shape=(2*N0,2*N0)

required

Returns:

Name Type Description
ret ndarray

The inverse of the symplectic matrix. dtype=np.uint8, ndim=2, and shape=(2*N0,2*N0)