StatevectorConfiguration
public enum StatevectorConfiguration
Define performance and memory footprint of Circuit.statevector(withInitialState:)
-
Each
Gateis expanded into aMatrixbefore applying to theCircuitStatevectorfor the entire circuit. Matrix expansion is performed with up toexpansionConcurrencythreads. IfexpansionConcurrencyis 0 or less, it will be defaulted to 1. This configuration has the biggest memory footprint but it is faster than the others, exceptStatevectorConfiguration.direct.Declaration
Swift
case matrix(expansionConcurrency: Int = 1) -
To apply a
Gateto theCircuitStatevectorfor the entire circuit, up tocalculationConcurrencyrows in theGateare expanded at the same time and applied to the statevector as needed. In turn, each row will be expanded with up toexpansionConcurrencythreads, socalculationConcurrency*expansionConcurrencythreads might be running concurrently at any given moment. IfcalculationConcurrencyorexpansionConcurrencyare set to 0 or less, they will be defaulted to 1.Declaration
Swift
case row(calculationConcurrency: Int = 1, expansionConcurrency: Int = 1) -
To apply a
Gateto theCircuitStatevectorfor the entire circuit, up tocalculationConcurrencyvalues in the statevector are calculated simultaneously. Values inGateare requested one by one and when needed. IfcalculationConcurrencyis 0 or less, it will be defaulted to 1. This configuration is the slowest but it has the smallest memory footprint.Declaration
Swift
case value(calculationConcurrency: Int = 1) -
To apply a
Gateto theCircuitStatevectorfor the entire circuit, up tocalculationConcurrencyvalues in the statevector are calculated simultaneously. IfcalculationConcurrencyis 0 or less, it will be defaulted to 1. It is similar toStatevectorConfiguration.valuebut instead of calculating all positions in aGate, only those that are needed (not zero) are generated. If each gate only uses a few qubits in the circuit, this is the fastest option and its memory footprint is almost identical toStatevectorConfiguration.value.Declaration
Swift
case direct(calculationConcurrency: Int = 1)
StatevectorConfiguration Enumeration Reference