# Matlab Programs developed by Li and his colleagues

Matlab Programs for plotting Generalized Numerical Ranges (by C.K. Li)

Central Groupoids and Centeral Digraphs

F. Curtis, J. Drew, C.K. Li and D. Pragel, Central Groupoids, Central Digraphs, and Zero-One Matrices \$A\$ Satisfying \$A^2 = J\$, J. Combinatorial Theory, Series A, 105 (2004), 35-50. pdf file.
F. Curtis and D. Pragel, Central groupoids, central digraphs, and zero-one matrices A satisfying A^2 = J, REU report, College of William and Mary, 2002. pdf file.
F. Curtis, J. Drew, C.K. Li and D. Pragel, Computer Programs and Examples in the study of Central groupoids, central digraphs, and zero-one matrices A satisfying A^2 = J. pdf file.

• MakeStandard(k) : creating the adjancy matrix of the standard central digraph.
• MakeSwitch(p,q;r,s,A) : performing the switch [p,q;r,s] on the adjancency matrix A of a central digraph.
• AllRanks(k) : creating adjacency matrices of central digraphs of all possible ranks.
• DRM(A) : applying a permutation similarity to A to get a matrix with decreasing row multiplicity.
• PerSim(A,B) : identifying adjacency matrices that correspond to the same central digraphs.

Decomposition of quantum gates

C.K. Li and D.C. Pelejo, Decomposition of quantum gates, Int. J. Quantum Inform. 12, 1450002 (2014) pdf file.

• decomposition.m (by Diane Pelejo)
The program uses the recurrence decomposition scheme in the paper at http://arxiv.org/abs/1311.3599 to reduce a quantum gate (unitary matrix) into the product of simple quantum gates with few controls.
It will display the order of entries to be annihilated, the (c_n...c_1)-gate used and the single qubit gate V used for the controlled gates. One use the command: [U,A,x,y,controls,num,V]=decomposition(n); in the command line, where n is the number of qubits and the program will prompt for the user to either choose to create a random unitary matrix or input the unitary matrix manually. The variable U is the unitary matrix being decomposed, the variable A is an array of strings that describe the form of the gate, and (x,y) are the row and column indices arranged according to their order of annihilation. The variable controls gives the total number of controls used and num is the number of nontrivial unitary controlled gates used. The variable V is the product of the controlled gates and hence, must always equal to the identity matrix. This is used to help the user check that the decomposition is correct.
• gatecount.m (by Diane Pelejo)
This program counts the total number of controls in our scheme and that in the paper of Vartiainen et al. at http://arxiv.org/abs/quant-ph/0312218.
• pud.m (by Rebecca Roberts)
This is a Matlab program for decomposing an n-by-n unitary matrix U as the product of N = n(n-1)/2 two-level matrices according to the permutation P = [i_1, ..., i_n] of [1, ..., n].
The Matlab command: A = pud(U,P) will generate the two-level matrices A{1}, ..., A{N}, whose product equal U.
One also needs the auxiliary Matlab program: genDeletePos.m to do the decomposition.
Factorization of Permutations.

Product of two positive contractions

C.K. Li, D.C. Pelejo, and K.Z. Wang, Product of two positive constractions, Linear Algebra Appl. 501 (2016), 409-423. pdf file.

• Twoposcon.m (by Diane Pelejo)
This program check whether a square matrix is the product of two positive contractions. One needs to apply a unitary similarity to the matrix A to put it in a certain form to use the program. Details are in the program file.