Circuit
public protocol Circuit
A quantum circuit
-
Gates in the circuit
Declaration
Swift
var gates: [Gate] { get } -
Produces unitary matrix that represents entire list of
gates.Declaration
Swift
func unitary(withQubitCount qubitCount: Int) -> Result<Matrix, UnitaryError>Parameters
qubitCountNumber of qubits in the circuit.
Return Value
Unitary matrix that represents entire list of
gates. OrUnitaryErrorerror. -
Applies
gatestoinitialStateto produce a new statevector.Declaration
Swift
func statevector(withInitialState initialState: CircuitStatevector) -> Result<CircuitStatevector, StatevectorError>Parameters
initialStateUsed to initialized circuit to given state.
Return Value
Another
CircuitStatevectorinstance, result of applyinggatestoinitialState. OrStatevectorErrorerror.
-
statevector(withFactory:Extension method) Applies
gatesto an initial statevector set to 0 to produce a new statevector.Declaration
Swift
public func statevector(withFactory factory: CircuitStatevectorFactory = MainCircuitStatevectorFactory()) -> Result<CircuitStatevector, StatevectorError>Parameters
factoryUsed to produce the initial statevector set to 0.
Return Value
Another
CircuitStatevectorinstance, result of applyinggatesto 0. OrStatevectorErrorerror. -
unitary()Extension methodProduces unitary matrix that represents entire list of
gates.Declaration
Swift
public func unitary() -> Result<Matrix, UnitaryError>Return Value
Unitary matrix that represents entire list of
gates. OrUnitaryErrorerror.
Circuit Protocol Reference