StatevectorConfiguration

public enum StatevectorConfiguration

Define performance and memory footprint of Circuit.statevector(withInitialState:)

  • Each Gate is expanded into a Matrix before applying to the CircuitStatevector for the entire circuit. Matrix expansion is performed with up to expansionConcurrency threads. If expansionConcurrency is 0 or less, it will be defaulted to 1. This configuration has the biggest memory footprint but it is faster than the others, except StatevectorConfiguration.direct.

    Declaration

    Swift

    case matrix(expansionConcurrency: Int = 1)
  • To apply a Gate to the CircuitStatevector for the entire circuit, up to calculationConcurrency rows in the Gate are expanded at the same time and applied to the statevector as needed. In turn, each row will be expanded with up to expansionConcurrency threads, so calculationConcurrency * expansionConcurrency threads might be running concurrently at any given moment. If calculationConcurrency or expansionConcurrency are set to 0 or less, they will be defaulted to 1.

    Declaration

    Swift

    case row(calculationConcurrency: Int = 1, expansionConcurrency: Int = 1)
  • To apply a Gate to the CircuitStatevector for the entire circuit, up to calculationConcurrency values in the statevector are calculated simultaneously. Values in Gate are requested one by one and when needed. If calculationConcurrency is 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 Gate to the CircuitStatevector for the entire circuit, up to calculationConcurrency values in the statevector are calculated simultaneously. If calculationConcurrency is 0 or less, it will be defaulted to 1. It is similar to StatevectorConfiguration.value but instead of calculating all positions in a Gate, 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 to StatevectorConfiguration.value.

    Declaration

    Swift

    case direct(calculationConcurrency: Int = 1)