QPanda3
0.1.0
Supported by OriginQ
|
Prev Tutorial: Density Matrix
Next Tutorial: Kraus
The state vector is a core concept in quantum mechanics, used to abstractly represent the quantum state of a quantum system. The following is a detailed introduction to state vectors in the quantum field:
Quantum states are represented by vectors in Hilbert space, also known as state vector space or state space, and are called state vectors.
The state vector exists in the inner product space. Inner product space is a vector space with an additional inner product structure. The state vector satisfies all the axioms of the vector space and allows for the operation of inner product.
The norm of a state vector is 1, making it a unit vector. Linear combination: Every inner product space has a single norm-orthogonal basis, and the state vector is a linear combination of all the basis vectors of the single norm-orthogonal basis.
The state vector satisfies the linear property, which corresponds to the superposition principle of state in quantum mechanics. That is, if two quantum states are represented by state vectors \(\mathcal{ ψ } _1\) and \(\mathcal{ ψ } _2\), then their superposition state can be represented by a linear combination of these two state vectors.
The state vector can be seen as a probability distribution that describes all possible measurement results of a quantum system. For each measurement, there is a certain probability of obtaining different results, and the probability distribution of these results depends on the state vector of the system.
QPanda3 uses StateVector in Quantum Informaton to abstract and simulate state vectors
The default is to construct a state vector for a quantum system with only one qubit and a current state of all 0s
For internal tensor product operations, the qbit index with the larger value is used as the left operand. For example, when performing a tensor product operation on a quantum system consisting of \(q[0]\), \(q[1]\), and \(q[2]\), the result is \(\left | q[2] \right \rangle \otimes \left | q[1] \right \rangle \otimes \left | q[0] \right \rangle \)
Output
Specify the total number of qubits in the quantum system, and generate a state vector where the current state of each quantum is 0
For internal tensor product operations, the qbit index with the larger value is used as the left operand. For example, when performing a tensor product operation on a quantum system consisting of \(q[0]\), \(q[1]\), and \(q[2]\), the result is \(\left | q[2] \right \rangle \otimes \left | q[1] \right \rangle \otimes \left | q[0] \right \rangle \)
Output
Construct a state vector based on a given complex array. If the given complex array does not meet the normalization constraint, it will be automatically normalized. If the number of elements in a given complex array is not a power of 2, it will be automatically expanded to a power of 2. This expansion operation will expand the number of elements as little as possible
For internal tensor product operations, the qbit index with the larger value is used as the left operand. For example, when performing a tensor product operation on a quantum system consisting of \(q[0]\), \(q[1]\), and \(q[2]\), the result is \(\left | q[2] \right \rangle \otimes \left | q[1] \right \rangle \otimes \left | q[0] \right \rangle \)
Output
Construct a state vector based on the input dictionary
The keys of the dictionary are positive integers, representing the index of the quantum state; The value of the dictionary is the corresponding amplitude. If the normalization constraint is not met, automatic normalization processing will be performed. If the maximum value of the key of a given dictionary element is not a power of 2, it will be automatically expanded to a power of 2. This expansion operation will expand as few elements as possible
For internal tensor product operations, the qbit index with the larger value is used as the left operand. For example, when performing a tensor product operation on a quantum system consisting of \(q[0]\), \(q[1]\), and \(q[2]\), the result is \(\left | q[2] \right \rangle \otimes \left | q[1] \right \rangle \otimes \left | q[0] \right \rangle \)
Output
Get all the internal data in the form of numpy.ndarray
Here is API doc for StateVector.ndarray
Output
Get the value corresponding to a certain state by indexing
Here is API doc for StateVector.dim
Here is API doc for StateVector.at
Output
Use the quantum circuit QCircuit to evolve the quantum state without updating the internal data of the original StateVector object, and the result is returned as a new StateVector object
Here is API doc for StateVector.evolve
Output
Use the quantum circuit QCircuit to evolve the quantum state and update the internal data of the original StateVector object
Here is API doc for StateVector.update_by_evolve
Output
Obtain the corresponding density matrix representation
Here is API doc for StateVector.get_density_matrix
Output
Obtain the corresponding purity
Here is API doc for StateVector.purity
Output
Determine whether the internal data is legal
Here is API doc for StateVector.is_valid
Output
Determine whether the internal data of two state vectors are equal within the default tolerance
Output