Wolfram Language Paclet Repository

Community-contributed installable additions to the Wolfram Language

Primary Navigation

    • Cloud & Deployment
    • Core Language & Structure
    • Data Manipulation & Analysis
    • Engineering Data & Computation
    • External Interfaces & Connections
    • Financial Data & Computation
    • Geographic Data & Computation
    • Geometry
    • Graphs & Networks
    • Higher Mathematical Computation
    • Images
    • Knowledge Representation & Natural Language
    • Machine Learning
    • Notebook Documents & Presentation
    • Scientific and Medical Data & Computation
    • Social, Cultural & Linguistic Data
    • Strings & Text
    • Symbolic & Numeric Computation
    • System Operation & Setup
    • Time-Related Computation
    • User Interface Construction
    • Visualization & Graphics
    • Random Paclet
    • Alphabetical List
  • Using Paclets
    • Get Started
    • Download Definition Notebook
  • Learn More about Wolfram Language

QuantumPlaybook

Guides

  • QuantumPlaybook

Tech Notes

  • Addition of Numbers
  • Baker-Hausdorff Lemma
  • Chiral Fermion Random Circuit
  • Clifford Operators: How to Test
  • Commutation Relations for Qubits
  • Entanglement Distillation
  • Generalized Pauli Operators: Implementation
  • Hatano-Nelson-Kitaev Model: Monte Carlo Simulation
  • Hatano-Nelson Model: Monte Carlo Simulation
  • Kitaev Chain
  • Kitaev Random Circuit
  • Λ-Matter in a Cavity
  • Measurement of Total Pauli Z
  • Non-Unitary Dynamics of Quantum States
  • Partial Trace: Physical Meaning
  • Quantum Dot Systems
  • A Quantum Playbook
  • Magnetic Exchange Coupling
  • Solovay-Kitaev Algorithm
  • Spin Code
  • Symmetry Effects On Quantum Master Equations
  • Transmon: Quantum Phase Model
  • Transposition as a Supermap
  • Variational Quantum Classifier: Iris
  • Variational Quantum Classifier: Parity
  • Variational Quantum Eigensolver: Transverse-Field Ising Model

Symbols

  • BlochEnergy
  • BlochFunction
  • QuantumPlaybookCheckUpdate
  • QuantumPlaybookEdition
  • QuantumPlaybookUpdate
  • TransmonEnergy
  • TransmonExponent
  • TransmonFunction
  • TransmonHamiltonian
Clifford Operators: How to Test
Simple Test
Relation to Stabilizer States
Using Matrix Representations
​
See also Section 6.3 of the
Quantum Workbook (Springer, 2022)
.
Given a unitary operator
U
, how can we check whether
U
is a Clifford operator or not?
A Clifford operator
U
transforms Pauli operators to other Pauli operators. Since Pauli operators are generated by single-qubit Pauli-X and Pauli-Z operators, a Clifford operator is completely specified (up to a global phase factor
mπ/4
e
) by the transformation of Pauli operators under conjugation by
U
:
U
X
j
†
U
=
p
j
(-1)
n
Π
i=1
a
ij
X
i
b
ij
Z
i
​and
U
Z
j
†
U
=
q
j
(-1)
n
Π
i=1
c
ij
X
i
d
ij
Z
i
.
Here, we are going to use this observation.
CliffordQ
Test for Clifford operators
StabilizerStateQ
Test for stabilizer states
Functions providing a simple test for Clifford operators and related states.
In[1]:=
Needs["QuantumMob`Q3`"]
In[2]:=
Let[Qubit,S]
Simple Test
Let us start with simple examples.
In[3]:=
$n=2;​​kk=Range[$n];​​ss=S[kk,$];
The Clifford group is finite and yet increases quite fast in size with the number of qubits.
In[6]:=
grp=CliffordGroup[ss];​​elm=GroupElements[grp];
CliffordGroup
::toobig
:There are about 1.2×
4
10
elements in the group. Only the first 10 elements are returned.
​
Here is the total number of Clifford operators in this case.
In[8]:=
odr=GroupOrder[grp]
Out[8]=
11520
Let us choose one randomly.
In[9]:=
ptr=RandomInteger[{1,odr}]
Out[9]=
4014
In[10]:=
opc=First@GroupElements[grp,{ptr}]
Out[10]=

2
2
+
x
S
1
x
S
2
2
2
-

x
S
1
y
S
2
2
2
-

y
S
1
x
S
2
2
2
+
y
S
1
y
S
2
2
2
-

z
S
1
z
S
2
2
2
-

z
S
1
2
2
-

z
S
2
2
2
Using CliffordQ, check that it is indeed a Clifford operator.
In[11]:=
CliffordQ[opc]
Out[11]=
True
Pick up single-qubit Pauli-X and Pauli-Z operators.
In[12]:=
opx=S[kk,1]​​opz=S[kk,3]
Out[12]=
{
x
S
1
,
x
S
2
}
Out[13]=
{
z
S
1
,
z
S
2
}
Under the conjugation by the operator opc in question, the single-qubit Pauli-X and Pauli-Z operators result in certain Pauli operators, confirming again that the operator opc is a Clifford operator.
In[14]:=
EchoTiming[opc**opx**Dagger[opc]]​​EchoTiming[opc**opz**Dagger[opc]]
⌚
0.06739
Out[14]=
{-
x
S
1
z
S
2
,-
z
S
1
x
S
2
}
⌚
0.043417
Out[15]=

x
S
1
y
S
2
,
y
S
1
x
S
2

Now, consider a new operator involving the octant phase operator on the first qubit. Note that the octant phase operator is not a Clifford operator. Indeed, the results involve several terms of Pauli operators indicating that the operator opd is not a Clifford operator.
In[16]:=
opd=opc**S[1,8];
In[17]:=
EchoTiming[out=opd**opx**Dagger[opd]]​​EchoTiming[out=opd**opz**Dagger[opd]]
⌚
0.291104
Out[17]=
-
x
S
1
z
S
2
2
+
1
16
(-2+
2
)
z
S
1
x
S
2
+
1
16
(-2+
2
)
z
S
1
y
S
2
+

8
-
1
8
+

8
2
T
S
1
x
S
2
+
1
8
-
1
8
-

8
2
T
S
1
y
S
2
-
7
x
S
2
8
2
-

y
S
2
8
2
,
1
8
-1+
1/4
(-1)

†
T
S
1
x
S
2
+
1
8
-1+
1/4
(-1)

†
T
S
1
y
S
2
+
1
8
(-6-
2
)
z
S
1
x
S
2
+-
1
8
+
1
8
-

8
2
T
S
1
x
S
2
+

8
-
1
8
+

8
2
T
S
1
y
S
2
+
y
S
2
4
2

⌚
0.159939
Out[18]=

1
32
(2+
2
)+

1
8
+

8

†
T
S
1
z
S
2
2
+
x
S
1
y
S
2
+
1
32
(4-(2+)
2
)
z
S
1
z
S
2
-
((-1+)+
2
)
T
S
1
z
S
2
16
2
-
1
8
1/4
(-1)
†
T
S
1
+
1
32
(-4+(2+)
2
)
z
S
1
+
((-1+)+
2
)
T
S
1
16
2
+
1
32
(-2-
2
)
z
S
2
,
y
S
1
x
S
2

Using Matrix Representations
In principle, the above test works. Unfortunately, however, the method quickly gets slower with the number of qubits. To improve the speed of the test, we use the matrix representations.
Here is the matrix representation of the given operator opc.
In[19]:=
matc=Matrix[opc,ss];​​matc//MatrixForm
Out[20]//MatrixForm=
-

2
0
0
-
1
2
0

2
1
2
0
0
1
2

2
0
1
2
0
0

2
These are the matrix representations of the single-qubit Pauli-X and Pauli-Z operators.
In[21]:=
matx=Matrix[opx,ss];​​matz=Matrix[opz,ss];​​MatrixForm/@matx​​MatrixForm/@matz
Out[23]=

0
0
1
0
0
0
0
1
1
0
0
0
0
1
0
0
,
0
1
0
0
1
0
0
0
0
0
0
1
0
0
1
0

Out[24]=

1
0
0
0
0
1
0
0
0
0
-1
0
0
0
0
-1
,
1
0
0
0
0
-1
0
0
0
0
1
0
0
0
0
-1

The single-qubit Pauli-X and Pauli-Z operators (i.e., their matrix representation) transform under the given operator as follows.
In[25]:=
outx=matc.#.Topple[matc]&/@matx;​​outz=matc.#.Topple[matc]&/@matz;​​MatrixForm/@outx​​MatrixForm/@outz
Out[27]=

0
0
-1
0
0
0
0
1
-1
0
0
0
0
1
0
0
,
0
-1
0
0
-1
0
0
0
0
0
0
1
0
0
1
0

Out[28]=

0
0
0
-
0
0

0
0
-
0
0

0
0
0
,
0
0
0
-
0
0
-
0
0

0
0

0
0
0

These results represents Pauli operators. This is seen by taking the
Pauli decomposition
.
In[29]:=
rrx=PauliDecompose/@outx​​rrz=PauliDecompose/@outz
Out[29]=
{{1,3}-1,{3,1}-1}
Out[30]=
{{1,2}1,{2,1}1}
Relation to Stabilizer States
So, we consider the following typical initial state.
A Clifford operator transforms both states to different stablizer states.
On the other hand, a non-Clifford operator transforms either or both states to a non-stabilizer state.

© 2025 Wolfram. All rights reserved.

  • Legal & Privacy Policy
  • Contact Us
  • WolframAlpha.com
  • WolframCloud.com