Wolfram.com
WolframAlpha.com
WolframCloud.com
Wolfram Language
Example Repository
Ready-to-use examples of the Wolfram Language
Primary Navigation
Categories
Astronomy
Audio Processing
Calculus
Cellular Automata
Chemistry
Complex Systems
Computer Science
Computer Vision
Control Systems
Creative Arts
Data Science
Engineering
Finance & Economics
Finite Element Method
Food & Nutrition
Geography
Geometry
Graphs & Networks
Image Processing
Life Sciences
Machine Learning
Mathematics
Optimization
Physics
Puzzles and Recreation
Quantum Computation
Signal Processing
Social Sciences
System Modeling
Text & Language Processing
Time-Related Computation
Video Processing
Visualization & Graphics
Alphabetical List
Submit a New Resource
Learn More about
Wolfram Language
Related Pages
Related Categories
Computer Science
Mathematics
Physics
Quantum Computation
Convert Quantum Circuits To and From Qiskit
Example Notebook
Open in Cloud
Download Notebook
Install and load the QuantumFramework paclet:
I
n
[
1
]
:
=
P
a
c
l
e
t
I
n
s
t
a
l
l
[
"
W
o
l
f
r
a
m
/
Q
u
a
n
t
u
m
F
r
a
m
e
w
o
r
k
"
]
;
N
e
e
d
s
[
"
W
o
l
f
r
a
m
`
Q
u
a
n
t
u
m
F
r
a
m
e
w
o
r
k
`
"
]
;
Create the magic circuit with measurements:
I
n
[
2
]
:
=
q
c
=
Q
u
a
n
t
u
m
C
i
r
c
u
i
t
O
p
e
r
a
t
o
r
[
{
"
S
"
{
1
,
2
}
,
"
H
"
2
,
"
C
N
O
T
"
{
2
,
1
}
,
{
1
}
,
{
2
}
}
]
;
q
c
[
"
D
i
a
g
r
a
m
"
]
O
u
t
[
2
0
0
]
=
You need to
configure your system to evaluate external Python code
in order to use the Qiskit-related functionality of Wolfram Quantum Framework.
Make sure that Qiskit is installed:
I
n
[
3
]
:
=
R
e
s
o
u
r
c
e
F
u
n
c
t
i
o
n
[
"
P
y
t
h
o
n
P
a
c
k
a
g
e
I
n
s
t
a
l
l
e
d
Q
"
]
[
"
q
i
s
k
i
t
"
]
O
u
t
[
3
]
=
T
r
u
e
If needed, use
R
e
s
o
u
r
c
e
F
u
n
c
t
i
o
n
[
"
P
y
t
h
o
n
P
a
c
k
a
g
e
I
n
s
t
a
l
l
"
]
["qiskit"] to install it.
Transform magic circuit to its Qiskit circuit:
I
n
[
4
]
:
=
q
i
s
k
i
t
=
q
c
[
"
Q
i
s
k
i
t
"
]
O
u
t
[
4
]
=
Q
i
s
k
i
t
C
i
r
c
u
i
t
Q
u
b
i
t
s
:
2
D
e
p
t
h
:
4
Generate its Qiskit diagram:
I
n
[
5
]
:
=
q
i
s
k
i
t
[
"
D
i
a
g
r
a
m
"
]
O
u
t
[
2
0
5
]
=
Generate OPENQASM from Qiskit circuit:
I
n
[
6
]
:
=
q
i
s
k
i
t
[
"
Q
A
S
M
"
]
O
u
t
[
6
]
=
O
P
E
N
Q
A
S
M
2
.
0
;
i
n
c
l
u
d
e
"
q
e
l
i
b
1
.
i
n
c
"
;
q
r
e
g
q
[
2
]
;
c
r
e
g
c
[
2
]
;
s
q
[
0
]
;
u
3
(
p
i
/
2
,
0
,
-
p
i
/
2
)
q
[
1
]
;
c
x
q
[
1
]
,
q
[
0
]
;
m
e
a
s
u
r
e
q
[
1
]
-
>
c
[
0
]
;
m
e
a
s
u
r
e
q
[
0
]
-
>
c
[
1
]
;
Generate the corresponding circuit from OPENQASM:
I
n
[
7
]
:
=
I
m
p
o
r
t
Q
A
S
M
C
i
r
c
u
i
t
[
q
i
s
k
i
t
[
"
Q
A
S
M
"
]
]
O
u
t
[
7
]
=
Q
i
s
k
i
t
C
i
r
c
u
i
t
Q
u
b
i
t
s
:
2
D
e
p
t
h
:
3
Transform the Qiskit object back to the quantum circuit object:
I
n
[
8
]
:
=
q
i
s
k
i
t
[
"
Q
u
a
n
t
u
m
C
i
r
c
u
i
t
"
]
O
u
t
[
8
]
=
Q
u
a
n
t
u
m
C
i
r
c
u
i
t
O
p
e
r
a
t
o
r
Generate the outcome of a Qiskit circuit (by default, 1024 shots to find frequency of measurement results):
I
n
[
9
]
:
=
q
i
s
k
i
t
[
]
[
"
P
r
o
b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i
t
O
p
e
r
a
t
o
r
[
{
"
M
u
l
t
i
p
l
e
x
e
r
"
,
"
X
"
,
"
Y
"
,
"
Z
"
}
]
[
"
D
i
a
g
r
a
m
"
]
O
u
t
[
2
1
3
]
=
Decompose a complex circuit (such as Multiplexer) into simpler ones and return its Qiskit circuit:
I
n
[
1
3
]
:
=
Q
u
a
n
t
u
m
C
i
r
c
u
i
t
O
p
e
r
a
t
o
r
[
{
"
M
u
l
t
i
p
l
e
x
e
r
"
,
"
X
"
,
"
Y
"
,
"
Z
"
}
]
[
"
Q
i
s
k
i
t
"
]
[
"
D
e
c
o
m
p
o
s
e
"
]
[
"
D
i
a
g
r
a
m
"
]
O
u
t
[
1
9
4
]
=
Transpile a complex circuit (such as Multiplexer) into simpler ones and return its Qiskit circuit:
I
n
[
1
4
]
:
=
t
r
a
n
s
p
i
l
e
=
Q
u
a
n
t
u
m
C
i
r
c
u
i
t
O
p
e
r
a
t
o
r
[
{
"
M
u
l
t
i
p
l
e
x
e
r
"
,
"
X
"
,
"
Y
"
,
"
Z
"
}
]
[
"
Q
i
s
k
i
t
"
]
[
"
T
r
a
n
s
p
i
l
e
"
]
O
u
t
[
1
4
]
=
Q
i
s
k
i
t
C
i
r
c
u
i
t
Q
u
b
i
t
s
:
3
D
e
p
t
h
:
3
7
Transform Qiskit into a quantum circuit object and return its diagram:
I
n
[
1
5
]
:
=
t
r
a
n
s
p
i
l
e
[
"
Q
u
a
n
t
u
m
C
i
r
c
u
i
t
"
]
[
"
D
i
a
g
r
a
m
"
,
"
S
h
o
w
G
a
t
e
L
a
b
e
l
s
"
F
a
l
s
e
]
O
u
t
[
1
5
]
=
See Also
Wolfram/QuantumFramework
Publisher Information
Contributed by:
Wolfram Research, Quantum Computation Framework Team