torchquantum.functional#
MIT License
Copyright (c) 2020-present TorchQuantum Authors
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Functions#
|
Apply the unitary to the statevector using torch.einsum method. |
|
Apply the unitary to the statevector using torch.bmm method. |
|
Perform the phaseshift gate. |
|
|
|
Compute unitary matrix for rx gate. |
|
Compute unitary matrix for ry gate. |
|
Compute unitary matrix for rz gate. |
|
Compute unitary matrix for phaseshift gate. |
|
Compute unitary matrix for rot gate. |
|
Compute unitary matrix for multiqubit RZ gate. |
|
Compute unitary matrix for RXX gate. |
|
Compute unitary matrix for RYY gate. |
|
Compute unitary matrix for RZZ gate. |
|
Compute unitary matrix for RZX gate. |
|
Compute unitary matrix for CRX gate. |
|
Compute unitary matrix for CRY gate. |
|
Compute unitary matrix for CRZ gate. |
|
Compute unitary matrix for CRot gate. |
|
Compute unitary matrix for U1 gate. |
|
Compute unitary matrix for CU1 gate. |
|
Compute unitary matrix for U2 gate. |
|
Compute unitary matrix for CU2 gate. |
|
Compute unitary matrix for U3 gate. |
|
Compute unitary matrix for CU3 gate. |
|
Compute unitary matrix for Qubitunitary gate. |
|
Compute unitary matrix for Qubitunitary fast gate. |
|
Compute unitary matrix for Qubitunitary strict gate. |
|
Compute unitary matrix for Multi qubit CNOT gate. |
|
Compute unitary matrix for Multi qubit XCNOT gate. |
|
Perform the hadamard gate. |
|
Perform the shadamard gate. |
|
Perform the Pauli X gate. |
|
Perform the Pauli Y gate. |
|
Perform the Pauli Z gate. |
|
Perform the I gate. |
|
Perform the s gate. |
|
Perform the t gate. |
|
Perform the sx gate. |
|
Perform the cnot gate. |
|
Perform the cz gate. |
|
Perform the cy gate. |
|
Perform the rx gate. |
|
Perform the ry gate. |
|
Perform the rz gate. |
|
Perform the rxx gate. |
|
Perform the ryy gate. |
|
Perform the rzz gate. |
|
Perform the rzz gate. |
|
Perform the rzx gate. |
|
Perform the rzx gate. |
|
Perform the swap gate. |
|
Perform the sswap gate. |
|
Perform the cswap gate. |
|
Perform the toffoli gate. |
|
Perform the phaseshift gate. |
|
Perform the phaseshift gate. |
|
Perform the cu1 gate. |
|
Perform the rot gate. |
|
Perform the multi qubit RZ gate. |
|
Perform the crx gate. |
|
Perform the cry gate. |
|
Perform the crz gate. |
|
Perform the crot gate. |
|
Perform the u1 gate. |
|
Perform the u2 gate. |
|
Perform the u3 gate. |
|
Perform the u3 gate. |
|
Perform the cu1 gate. |
|
Perform the cu2 gate. |
|
Perform the cu3 gate. |
|
Perform the cu gate. :param q_device: The QuantumDevice. :type q_device: tq.QuantumDevice :param wires: Which qubit(s) to apply the gate. :type wires: Union[List[int], int] :param params: Parameters (if any) of the gate. Default to None. :type params: torch.Tensor, optional :param n_wires: Number of qubits the gate is applied to. Default to None. :type n_wires: int, optional :param static: Whether use static mode computation. Default to False. :type static: bool, optional :param parent_graph: Parent QuantumGraph of current operation. Default to None. :type parent_graph: tq.QuantumGraph, optional :param inverse: Whether inverse the gate. Default to False. :type inverse: bool, optional :param comp_method: Use 'bmm' or 'einsum' method to perform :type comp_method: bool, optional :param matrix vector multiplication. Default to 'bmm'.:. |
|
Perform the qubitunitary gate. |
|
Perform the qubitunitaryfast gate. |
|
Perform the qubitunitarystrict = gate. |
|
Perform the multi qubit cnot gate. |
|
Perform the multi qubit xcnot gate. |
|
Perform the Pauli X gate. |
|
Perform the Pauli Y gate. |
|
Perform the Pauli Z gate. |
|
Perform the rzz gate. |
|
Perform the cnot gate. |
|
Perform the toffoli gate. |
|
Perform the toffoli gate. |
|
|
|
Perform the single excitation gate. |
|
Perform the echoed cross-resonance gate. |
|
Perform the echoed cross-resonance gate. |