Misc. Utility Functions and Classes

Matrix Manipulation

qecc.directsum(A, B)[source]

Given two matrices A and B with two indices each, returns the direct sum A \oplus B.

Return type:ndarray, shape (sA[0] + sB[0], sA[1] + sB[1])
Returns:A \oplus B
qecc.parity(bitarray)[source]
Parameters:bitarray (list) – a list containing integers of value 0 or 1.
Returns:True if bitarray is of odd parity, False if it is of even parity.
Return type:bool