[英]ket.draw() not showing |00> : Qiskit
ket.draw()
must give |00>
as result but I get: ket.draw()
必须给出|00>
作为结果,但我得到:
Statevector([1.+0.j, 0.+0.j, 0.+0.j, 0.+0.j],
dims=(2, 2))
what can I change to get the desired result?我可以更改什么以获得所需的结果?
This is my code:这是我的代码:
from qiskit import QuantumCircuit
from qiskit.quantum_info import Statevector
qc = QuantumCircuit(2)
# This calculates what the state vector of our qubits would be
# after passing through the circuit 'qc'
ket = Statevector(qc)
# The code below writes down the state vector.
# Since it's the last line in the cell, the cell will display it as output
ket.draw()
You can pass the keyword argument output='latex'
to the .draw
method.您可以将关键字参数output='latex'
传递给.draw
方法。
from qiskit import QuantumCircuit
from qiskit.quantum_info import Statevector
qc = QuantumCircuit(2)
# This calculates what the state vector of our qubits would be
# after passing through the circuit 'qc'
ket = Statevector(qc)
# The code below writes down the state vector.
# Since it's the last line in the cell, the cell will display it as output
ket.draw(output='latex')
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.