pygsti.algorithms.compilers.find_albert_factorization_transform_using_cnots#
- find_albert_factorization_transform_using_cnots(s, optype, position, qubit_labels, rand_state=None)#
Performs an Albert factorization transform on s.
Given a symplectic s matrix of the form ((A,B),(C,D)) with the submatrix in the position specified by position symmetric, this function
1. Finds an invertable M such that F = M M.T where F is the submatrix in position position, i.e., F is one of A, B, C and D. (this is known as an albert factorization). 2. Applies a CNOT circuit from the LHS (if optype = ‘row’) or RHS (if optyp`=’column’)) to `s so that F - > M.
For example, if s = ((A,I),(C,D)), position = ‘LR’ and optype = ‘column’ then it finds an M such that we may write s = ((A,I),(C,M M.T)) and it applies the CNOT circuit ((M,0),(0,M^(-1)^T) to the RHS of s, mapping s to s = ((AM,M),(CM^(-1)^T) ,M)), so that the upper RHS and lower RHS matrix of the new s are the same and are invertable.
This function returns a CNOT circuit that performs this action, with this CNOT circuit obtained from basic Gaussian elimination on M. Note that neither the returned s nor the CNOT circuit is deterministic: Both depend on M from albert factorisation, but this M is non-unique and our algorithm for finding such an M is randomized.
This function does not alter s, but rather returns an updated version of s.
- Parameters:
s (np.array) – A (2n,2n) matrix over [0,1].
optype ('row' or 'column') – If ‘row’, we use row-operation CNOTs (CNOTs from the LHS). If ‘column’, we use column-operation CNOTs (CNOTs from the RHS).
position ('UL', 'UR', 'LL', or 'LR') – The submatrix to perform the transformation on. ‘UL’ and ‘UR’ correspond to the upper left and right submatrices, respectively. ‘LL’ and ‘LR’ correspond to the lower left and right submatrices, respectively.
qubit_labels (list) – The qubit labels corresponding to the indices of s. This is required because otherwise it is ambiguous as to what the ‘name’ of a qubit associated with each indices is, so it is not possible to return a suitable list of CNOTs.
rand_state (np.random.RandomState, optional) – Random number generator to allow for determinism.
- Returns:
np.array – The updated s matrix.
list – A list of CNOT gates to implement the transformation requested.