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
qubitCount
Number of qubits in the circuit.
Return Value
Unitary matrix that represents entire list of
gates
. OrUnitaryError
error. -
Applies
gates
toinitialState
to produce a new statevector.Declaration
Swift
func statevector(withInitialState initialState: CircuitStatevector) -> Result<CircuitStatevector, StatevectorError>
Parameters
initialState
Used to initialized circuit to given state.
Return Value
Another
CircuitStatevector
instance, result of applyinggates
toinitialState
. OrStatevectorError
error.
-
statevector(withFactory:
Extension method) Applies
gates
to an initial statevector set to 0 to produce a new statevector.Declaration
Swift
public func statevector(withFactory factory: CircuitStatevectorFactory = MainCircuitStatevectorFactory()) -> Result<CircuitStatevector, StatevectorError>
Parameters
factory
Used to produce the initial statevector set to 0.
Return Value
Another
CircuitStatevector
instance, result of applyinggates
to 0. OrStatevectorError
error. -
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
. OrUnitaryError
error.