convert itensor gate
From AbstractQuantumGate object, you can obtain gate defined in ITensorMPS.jl. Available gates are same as ones in ITensorMPS.jl
Documents
GroverAlgorithm.execute_circuit — Method
execute_circuit(circuit::QuantumCircuit, sites::Vector{<:Index}; init_state=nothing) -> MPSSimulates the quantum circuit using ITensors.
Arguments
circuit::QuantumCircuit: The circuit object containing a sequence of gates.sites::Vector{<:Index}: The site indices (e.g., generated bysiteinds("Qubit", N)).init_state: (Optional) Override initial state. Can be a singleString(e.g., "0") applied to all qubits, aVector{String}for specific site states, or anAbstractInitialState. Ifnothing, usescircuit.initial_states.
Returns
psi_final::MPS: The resulting Matrix Product State after applying all gates.
Throws
ArgumentError: If circuit qubit count doesn't match sites count.
GroverAlgorithm.to_itensor_op — Function
to_itensor_op(gate::QuantumGate, sites)convert a QuantumGate (SingleQubitGate, ControlledGate, etc.) to an ITensors operator using the provided site indices. This function is overloaded for different gate types, allowing for a seamless mapping from our abstract gate representation to the concrete ITensor operators. The sites argument is expected to be a collection of site indices corresponding to the qubits in the circuit, typically obtained from siteinds("Qubit", N). The function handles various gate types, including single-qubit gates, controlled gates, and multi-qubit gates, as well as their parametric versions. It constructs the appropriate ITensor operator based on the gate type and its parameters, ensuring that the resulting operator can be directly applied to an MPS representing the quantum state.