|
Maestro 0.3.11
Unified interface for quantum circuit simulation
|
#include <FusionState.h>
Public Types | |
| using | Matrix8cd = Eigen::Matrix<std::complex<double>, 8, 8> |
Public Member Functions | |
| FusionState (std::shared_ptr< ISimulator > immediate) | |
| size_t | AllocateQubits (size_t n) override |
| Allocates qubits. | |
| std::vector< double > | AllProbabilities () override |
| Returns the probabilities of all possible outcomes. | |
| std::complex< double > | Amplitude (Types::qubit_t outcome) override |
| Returns the amplitude of the specified state. | |
| std::complex< double > | AmplitudeRaw (Types::qubit_t outcome) override |
| Gets the amplitude. | |
| void | ApplyAmplitudeDamping (Types::qubit_t qubit, double gamma) |
| void | ApplyBitFlipNoise (Types::qubit_t qubit, double probability) |
| void | ApplyBitPhaseFlipNoise (Types::qubit_t qubit, double probability) |
| virtual void | ApplyCCX (Types::qubit_t qubit0, Types::qubit_t qubit1, Types::qubit_t qubit2)=0 |
| Applies a controlled controlled not gate to the qubits. | |
| virtual void | ApplyCH (Types::qubit_t ctrl_qubit, Types::qubit_t tgt_qubit)=0 |
| Applies a CH gate to the qubits. | |
| void | ApplyChannel (const Types::qubits_vector &targets, const QuantumChannel::KrausOperators &krausOperators) |
| Alias matching the channel terminology used by QCSim's dense backend. | |
| void | ApplyCorrelatedPhaseFlipNoise (Types::qubit_t qubit0, Types::qubit_t qubit1, double probability) |
| void | ApplyCorrelatedPhaseFlipNoise (Types::qubit_t qubit0, Types::qubit_t qubit1, double probability, double correlation) |
| virtual void | ApplyCP (Types::qubit_t ctrl_qubit, Types::qubit_t tgt_qubit, double lambda)=0 |
| Applies a CP gate to the qubits. | |
| virtual void | ApplyCRx (Types::qubit_t ctrl_qubit, Types::qubit_t tgt_qubit, double theta)=0 |
| Applies a CRx gate to the qubits. | |
| virtual void | ApplyCRy (Types::qubit_t ctrl_qubit, Types::qubit_t tgt_qubit, double theta)=0 |
| Applies a CRy gate to the qubits. | |
| virtual void | ApplyCRz (Types::qubit_t ctrl_qubit, Types::qubit_t tgt_qubit, double theta)=0 |
| Applies a CRz gate to the qubits. | |
| virtual void | ApplyCSwap (Types::qubit_t ctrl_qubit, Types::qubit_t qubit0, Types::qubit_t qubit1)=0 |
| Applies a controlled swap gate to the qubits. | |
| virtual void | ApplyCSx (Types::qubit_t ctrl_qubit, Types::qubit_t tgt_qubit)=0 |
| Applies a CSx gate to the qubits. | |
| virtual void | ApplyCSxDAG (Types::qubit_t ctrl_qubit, Types::qubit_t tgt_qubit)=0 |
| Applies a CSx dagger gate to the qubits. | |
| virtual void | ApplyCU (Types::qubit_t ctrl_qubit, Types::qubit_t tgt_qubit, double theta, double phi, double lambda, double gamma)=0 |
| Applies a controlled U gate to the qubits. | |
| virtual void | ApplyCX (Types::qubit_t ctrl_qubit, Types::qubit_t tgt_qubit)=0 |
| Applies a CX gate to the qubits. | |
| virtual void | ApplyCY (Types::qubit_t ctrl_qubit, Types::qubit_t tgt_qubit)=0 |
| Applies a CY gate to the qubits. | |
| virtual void | ApplyCZ (Types::qubit_t ctrl_qubit, Types::qubit_t tgt_qubit)=0 |
| Applies a CZ gate to the qubits. | |
| void | ApplyDephasingNoise (Types::qubit_t qubit, double probability) |
| Noise.h dephasing is a stochastic phase flip, not phase damping. | |
| void | ApplyDepolarizingMixingNoise (Types::qubit_t qubit, double mixingProbability) |
| Depolarizing replacement (1-p)rho + p I/2, fully mixed at p=1. | |
| void | ApplyDepolarizingNoise (Types::qubit_t qubit, double errorProbability) |
| Depolarizing noise using total nonidentity-Pauli probability p. | |
| void | ApplyGeneralizedAmplitudeDamping (Types::qubit_t qubit, double gamma, double excitedStatePopulation) |
| virtual void | ApplyGenericOneQubitGate (Types::qubit_t qubit, const Eigen::Matrix2cd &gate)=0 |
| Apply a generic one-qubit gate to the specified qubit. | |
| virtual void | ApplyGenericThreeQubitGate (Types::qubit_t, Types::qubit_t, Types::qubit_t, const Matrix8cd &) |
| virtual void | ApplyGenericTwoQubitGate (Types::qubit_t qubit0, Types::qubit_t qubit1, const Eigen::Matrix4cd &gate)=0 |
| Apply a generic two-qubit gate to the specified qubits. | |
| virtual void | ApplyH (Types::qubit_t qubit)=0 |
| Applies a Hadamard gate to the qubit. | |
| virtual void | ApplyK (Types::qubit_t qubit)=0 |
| Applies a K gate to the qubit. | |
| void | ApplyKrausChannel (const Types::qubits_vector &targets, const QuantumChannel::KrausOperators &krausOperators) |
| Apply an arbitrary CPTP map supplied in Kraus form. | |
| virtual void | ApplyNop ()=0 |
| Applies a nop. | |
| void | ApplyOperator (const Types::qubits_vector &qubits, const Eigen::MatrixXcd &matrix, bool normalize=false) override |
| virtual void | ApplyP (Types::qubit_t qubit, double lambda)=0 |
| Applies a phase shift gate to the qubit. | |
| void | ApplyPauliChannel (const Types::qubits_vector &targets, const std::vector< double > &probabilities) |
| Apply an arbitrary one- or two-qubit Pauli channel. | |
| void | ApplyPauliChannel (Types::qubit_t qubit, double px, double py, double pz) |
| Apply a single-qubit Pauli channel specified by X/Y/Z probabilities. | |
| void | ApplyPhaseDamping (Types::qubit_t qubit, double gamma) |
| Phase damping with coherence multiplier sqrt(1-gamma). | |
| void | ApplyPhaseDampingFromTime (Types::qubit_t qubit, double duration, double tPhi) |
| Pure phase damping for a physical duration and T_phi. | |
| void | ApplyPhaseFlipNoise (Types::qubit_t qubit, double probability) |
| void | ApplyQuantumChannel (const Types::qubits_vector &qs, const QuantumChannel &channel) override |
| Applies a local CPTP quantum channel to one or two qubits. | |
| void | ApplyReset (const Types::qubits_vector &qs) override |
| Performs a reset of the specified qubits. | |
| virtual void | ApplyRx (Types::qubit_t qubit, double theta)=0 |
| Applies a Rx gate to the qubit. | |
| virtual void | ApplyRy (Types::qubit_t qubit, double theta)=0 |
| Applies a Ry gate to the qubit. | |
| virtual void | ApplyRz (Types::qubit_t qubit, double theta)=0 |
| Applies a Rz gate to the qubit. | |
| virtual void | ApplyS (Types::qubit_t qubit)=0 |
| Applies a S gate to the qubit. | |
| virtual void | ApplySDG (Types::qubit_t qubit)=0 |
| Applies a S dagger gate to the qubit. | |
| virtual void | ApplySwap (Types::qubit_t qubit0, Types::qubit_t qubit1)=0 |
| Applies a swap gate to the qubits. | |
| virtual void | ApplySx (Types::qubit_t qubit)=0 |
| Applies a Sx gate to the qubit. | |
| virtual void | ApplySxDAG (Types::qubit_t qubit)=0 |
| Applies a Sx dagger gate to the qubit. | |
| virtual void | ApplyT (Types::qubit_t qubit)=0 |
| Applies a T gate to the qubit. | |
| void | ApplyT1Relaxation (Types::qubit_t qubit, double gamma) |
| Alias for the exact T1 amplitude-damping channel. | |
| void | ApplyT1RelaxationFromTime (Types::qubit_t qubit, double duration, double t1) |
| Exact T1 relaxation for a physical duration and time constant. | |
| virtual void | ApplyTDG (Types::qubit_t qubit)=0 |
| Applies a T dagger gate to the qubit. | |
| void | ApplyThermalRelaxation (Types::qubit_t qubit, double duration, double t1, double t2, double excitedStatePopulation=0.0) |
| void | ApplyTwoQubitDepolarizingMixingNoise (Types::qubit_t qubit0, Types::qubit_t qubit1, double mixingProbability) |
| void | ApplyTwoQubitDepolarizingNoise (Types::qubit_t qubit0, Types::qubit_t qubit1, double errorProbability) |
| virtual void | ApplyU (Types::qubit_t qubit, double theta, double phi, double lambda, double gamma)=0 |
| Applies a U gate to the qubit. | |
| virtual void | ApplyX (Types::qubit_t qubit)=0 |
| Applies a not gate to the qubit. | |
| virtual void | ApplyY (Types::qubit_t qubit)=0 |
| Applies a Y gate to the qubit. | |
| virtual void | ApplyZ (Types::qubit_t qubit)=0 |
| Applies a Z gate to the qubit. | |
| void | Clear () override |
| Clears the state. | |
| void | ClearObservers () |
| Clears all observers. | |
| virtual std::unique_ptr< ISimulator > | Clone ()=0 |
| Clones the simulator. | |
| virtual std::unique_ptr< ISimulator > | CloneForExecution (uint64_t seed) |
| void | Configure (const char *key, const char *value) override |
| Configures the state. | |
| std::complex< double > | DensityMatrixElementBits (const std::vector< bool > &row, const std::vector< bool > &col) const override |
| double | DensityMatrixHermiticityResidual () const override |
| std::complex< double > | DensityMatrixOverlap (const IState &other) const override |
| double | DensityMatrixPurity () const override |
| std::complex< double > | DensityMatrixTrace () const override |
| Mixed-state diagnostics. | |
| std::complex< double > | DensityMatrixTraceOfSquare () const override |
| double | ExpectationValue (const std::string &pauli) override |
| Returns the expected value of a Pauli string. | |
| std::complex< double > | ExpectationValueComplex (const std::string &pauli, bool normalized=true) const override |
| std::complex< double > | ExpectationValueOperators (const Types::qubits_vector &qubits, const std::vector< Eigen::MatrixXcd > &matrices) override |
| std::vector< double > | ExpectationValues (const std::vector< std::string > &paulis) override |
| std::vector< std::complex< double > > | ExpectationValuesComplex (const std::vector< std::string > &paulis, bool normalized=true) const override |
| double | FidelityWithStatevector (const Eigen::VectorXcd &psi) const override |
| void | Flush () override |
| Flushes the applied operations. | |
| void | FlushPendingGates () override |
| const std::unordered_map< std::string, std::string > & | GetConfigMap () const override |
| std::string | GetConfiguration (const char *key) const override |
| Returns configuration value. | |
| size_t | GetCurrentMaxBondDimension () const override |
| Returns the maximum bond dimension reached. | |
| Eigen::MatrixXcd | GetDensityMatrix (bool normalized=true) const override |
| size_t | GetExecutedMaxBondDimension () const override |
| virtual unsigned | GetGateFusionMaxQubits () const |
| GateFusionStatistics | GetGateFusionStatistics () const override |
| long long | GetGatesCounter () const override |
| Returns the gates counter. | |
| int | GetGpuDevice () const override |
| double | getGrowthFactorGate () const override |
| double | getGrowthFactorSwap () const override |
| bool | GetMultithreading () const override |
| Get the multithreading flag. | |
| size_t | GetNumberOfQubits () const override |
| Returns the number of qubits. | |
| std::shared_ptr< ISimulator > | getptr () |
| Get a shared pointer to this object. | |
| SimulationType | GetSimulationType () const override |
| Returns the type of simulation. | |
| std::vector< std::complex< double > > | GetStateVector () override |
| SimulatorType | GetType () const override |
| Returns the type of simulator. | |
| const std::vector< std::shared_ptr< Circuits::IOperation< double > > > & | GetUpcomingRoutingOperations () const override |
| void | HermitizeDensityMatrix () override |
| void | IncrementGatesCounter () override |
| Increments the gates counter. | |
| void | Initialize () override |
| Initializes the state. | |
| void | InitializeState (size_t n, AER::Vector< std::complex< double > > &value) override |
| Initializes the state. | |
| void | InitializeState (size_t n, Eigen::VectorXcd &value) override |
| Initializes the state. | |
| void | InitializeState (size_t n, std::vector< std::complex< double > > &value) override |
| Initializes the state. | |
| void | InitializeToBasisState (size_t n, const std::vector< bool > &value) override |
| Initializes the state to a computational basis state. | |
| void | InitializeToBasisState (size_t n, Types::qubit_t value) override |
| Initializes the state to a computational basis state. | |
| void | InitializeToMixtureOfBasisStates (size_t n, const std::vector< std::pair< std::vector< bool >, double > > &value) override |
| Initializes the state to a classical mixture of computational basis states. | |
| void | InitializeToMixtureOfBasisStates (size_t n, const std::vector< std::pair< Types::qubit_t, double > > &value) override |
| Initializes the state to a classical mixture of computational basis states. | |
| bool | IsDensityMatrixHermitian (double eps=1e-10) const override |
| bool | IsGateFusionEnabled () const override |
| bool | IsQcsim () const override |
| Returns if the simulator is a qcsim simulator. | |
| bool | IsRoutingLookaheadEnabled () const override |
| size_t | Measure (const Types::qubits_vector &qs) override |
| Performs a measurement on the specified qubits. | |
| std::vector< bool > | MeasureMany (const Types::qubits_vector &qs) override |
| Performs a measurement on the specified qubits. | |
| Types::qubit_t | MeasureNoCollapse () override |
| Measures all the qubits without collapsing the state. | |
| std::vector< bool > | MeasureNoCollapseMany () override |
| Measures all the qubits without collapsing the state. | |
| void | MoveAtBeginningOfChain (const Types::qubits_vector &qubits) override |
| Eigen::MatrixXcd | PartialTrace (const Types::qubits_vector &qs) const override |
| std::vector< double > | Probabilities (const Types::qubits_vector &qs) override |
| Returns the probabilities of the specified outcomes. | |
| double | Probability (Types::qubit_t outcome) override |
| Returns the probability of the specified outcome. | |
| double | ProbabilityBits (const std::vector< bool > &bits) override |
| MPO extensions: bit vectors are q0-first; matrices use logical basis order. | |
| std::complex< double > | ProjectOnZero () override |
| Projects the state onto the zero state. | |
| double | RandomUniform () |
| Uniform random number in [0, 1) from the auxiliary stream. | |
| void | ReCanonicalize () override |
| Restore the canonical form of a matrix-product state or operator. | |
| void | RegisterObserver (const std::shared_ptr< ISimulatorObserver > &observer) |
| Registers an observer. | |
| void | Reset () override |
| Just resets the state to 0. | |
| void | RestoreDensityMatrixTrace () override |
| void | RestoreInternalDestructiveSavedState () override |
| Restores the state from the internally saved state. | |
| void | RestoreState () override |
| Restores the state from the internally saved state. | |
| std::unordered_map< Types::qubit_t, Types::qubit_t > | SampleCounts (const Types::qubits_vector &qs, size_t shots=1000) override |
| Returns the counts of the outcomes of measurement of the specified qubits, for repeated measurements. | |
| std::unordered_map< std::vector< bool >, Types::qubit_t > | SampleCountsMany (const Types::qubits_vector &qs, size_t shots=1000) override |
| Returns the counts of the outcomes of measurement of the specified qubits, for repeated measurements. | |
| void | SaveState () override |
| Saves the state to internal storage. | |
| void | SaveStateToInternalDestructive () override |
| Saves the state to internal storage. | |
| void | SetAutomaticLookaheadDepth (int value) override |
| virtual void | SetGatesCounter (long long int) |
| Sets the gates counter. | |
| void | SetGatesCounter (long long counter) override |
| void | setGrowthFactorGate (double value) override |
| void | setGrowthFactorSwap (double value) override |
| virtual void | SetInitialQubitsMap (const std::vector< long long int > &initialMap) |
| Sets the initial qubits map, if possible. | |
| void | SetInitialQubitsMap (const std::vector< long long > &value) override |
| void | SetLookaheadDepth (int value) override |
| Sets the lookahead depth for swap optimization. | |
| void | SetLookaheadDepthWithHeuristic (int value) override |
| Sets the lookahead depth for swap optimization. | |
| void | SetMultithreading (bool value=true) override |
| Enable/disable multithreading. | |
| void | SetSeed (uint64_t seed) override |
| Seed every random stream owned by this simulator. | |
| void | SetUpcomingGates (const std::vector< std::shared_ptr< Circuits::IOperation< double > > > &gates) override |
| Supplies upcoming gates for lookahead swap optimization. | |
| void | SetUseOptimalMeetingPosition (bool value) override |
| Enables or disables optimal meeting position for MPS swaps. | |
| bool | SupportsMPSSwapOptimization () const override |
| Returns if the simulator supports MPS swap optimization. | |
| bool | SupportsQuantumChannels () const override |
| Returns whether this state retains channel ensembles directly. | |
| bool | SwapGatesRelabelQubits () const override |
| void | Trim () override |
| Compress a matrix-product state or operator to its configured limits. | |
| void | UnregisterObserver (const std::shared_ptr< ISimulatorObserver > &observer) |
| Unregisters an observer. | |
Static Public Member Functions | |
| static uint64_t | DeriveSeed (uint64_t seed, uint64_t stream) |
Protected Types | |
| using | Cache = GateFusion<FusionGate> |
| using | Operation = std::shared_ptr<Circuits::IOperation<double>> |
Protected Member Functions | |
| void | CloneInto (FusionState ©, const uint64_t *executionSeed=nullptr) |
| void | ConsumeBoundary (Circuits::OperationType type) |
| virtual size_t | DefaultGateFusionMinQubits () const |
| void | DontNotify () |
| Stops notifying observers. | |
| virtual bool | InitializationPreservesSnapshots () const |
| bool | NotificationsEnabled () const noexcept |
| void | Notify () |
| Starts notifying observers. | |
| void | NotifyObservers (const Types::qubits_vector &affectedQubits) |
| Notifies observers. | |
| virtual bool | PreserveStructuredGates () const |
| void | SeedAuxiliaryRng (uint64_t seed) |
| Shared by SetSeed and backend Configure("seed") implementations. | |
| void | SubmitGate (const FusionGate &gate) |
| virtual bool | UsesDestructiveStateStorage () const |
Protected Attributes | |
| std::shared_ptr< ISimulator > | immediate_ |
Definition at line 12 of file FusionState.h.
|
protected |
Definition at line 719 of file FusionState.h.
|
inherited |
Definition at line 43 of file Simulator.h.
|
protected |
Definition at line 720 of file FusionState.h.
|
inlineexplicit |
Definition at line 15 of file FusionState.h.
References immediate_, and Simulators::IState::SeedAuxiliaryRng().
Referenced by CloneInto(), DensityMatrixOverlap(), and GetUpcomingRoutingOperations().
|
inlineoverridevirtual |
Allocates qubits.
This function is called to allocate qubits.
| num_qubits | The number of qubits to allocate. |
Implements Simulators::IState.
Definition at line 185 of file FusionState.h.
References Flush(), and immediate_.
|
inlineoverridevirtual |
Returns the probabilities of all possible outcomes.
Use it to obtain the probabilities of all possible outcomes.
Implements Simulators::IState.
Definition at line 380 of file FusionState.h.
References immediate_.
|
inlineoverridevirtual |
Returns the amplitude of the specified state.
Use it to obtain the amplitude of the specified state.
| outcome | The outcome to obtain the amplitude for. |
Implements Simulators::IState.
Definition at line 362 of file FusionState.h.
References immediate_.
|
inlineoverridevirtual |
Gets the amplitude.
Gets the amplitude, from the internal storage if needed. This is needed only for the composite simulator, for an optimization for qiskit aer.
Implements Simulators::IState.
Definition at line 368 of file FusionState.h.
References immediate_.
|
inlineinherited |
Definition at line 747 of file State.h.
References Simulators::QuantumChannel::AmplitudeDamping(), and ApplyQuantumChannel().
Referenced by ApplyT1Relaxation(), and ApplyT1RelaxationFromTime().
|
inlineinherited |
Definition at line 714 of file State.h.
References ApplyQuantumChannel(), and Simulators::QuantumChannel::BitFlip().
|
inlineinherited |
Definition at line 719 of file State.h.
References ApplyQuantumChannel(), and Simulators::QuantumChannel::BitPhaseFlip().
|
pure virtualinherited |
Applies a controlled controlled not gate to the qubits.
Applies a controlled controlled not gate to the specified qubits
| qubit0 | The first control qubit |
| qubit1 | The second control qubit |
| qubit2 | The target qubit |
Referenced by Simulators::FusionGate::Apply(), and ApplyCCX().
|
pure virtualinherited |
Applies a CH gate to the qubits.
Applies a controlled Hadamard gate to the specified qubits
| ctrl_qubit | The control qubit |
| tgt_qubit | The target qubit |
Referenced by Simulators::FusionGate::Apply(), and ApplyCH().
|
inlineinherited |
Alias matching the channel terminology used by QCSim's dense backend.
Definition at line 697 of file State.h.
References ApplyKrausChannel().
|
inlineinherited |
Definition at line 800 of file State.h.
References ApplyQuantumChannel(), and Simulators::QuantumChannel::CorrelatedPhaseFlip().
|
inlineinherited |
Definition at line 805 of file State.h.
References ApplyQuantumChannel(), and Simulators::QuantumChannel::CorrelatedPhaseFlip().
|
pure virtualinherited |
Applies a CP gate to the qubits.
Applies a controlled phase gate to the specified qubits
| ctrl_qubit | The control qubit |
| tgt_qubit | The target qubit |
| lambda | The phase shift angle. |
Referenced by Simulators::FusionGate::Apply(), and ApplyCP().
|
pure virtualinherited |
Applies a CRx gate to the qubits.
Applies a controlled x rotation gate to the specified qubits
| ctrl_qubit | The control qubit |
| tgt_qubit | The target qubit |
| theta | The rotation angle. |
Referenced by Simulators::FusionGate::Apply(), and ApplyCRx().
|
pure virtualinherited |
Applies a CRy gate to the qubits.
Applies a controlled y rotation gate to the specified qubits
| ctrl_qubit | The control qubit |
| tgt_qubit | The target qubit |
| theta | The rotation angle. |
Referenced by Simulators::FusionGate::Apply(), and ApplyCRy().
|
pure virtualinherited |
Applies a CRz gate to the qubits.
Applies a controlled z rotation gate to the specified qubits
| ctrl_qubit | The control qubit |
| tgt_qubit | The target qubit |
| theta | The rotation angle. |
Referenced by Simulators::FusionGate::Apply(), and ApplyCRz().
|
pure virtualinherited |
Applies a controlled swap gate to the qubits.
Applies a controlled swap gate to the specified qubits
| ctrl_qubit | The control qubit |
| qubit0 | The first qubit |
| qubit1 | The second qubit |
Referenced by Simulators::FusionGate::Apply(), and ApplyCSwap().
|
pure virtualinherited |
Applies a CSx gate to the qubits.
Applies a controlled squared root not gate to the specified qubits
| ctrl_qubit | The control qubit |
| tgt_qubit | The target qubit |
Referenced by Simulators::FusionGate::Apply(), and ApplyCSX().
|
pure virtualinherited |
Applies a CSx dagger gate to the qubits.
Applies a controlled squared root not dagger gate to the specified qubits
| ctrl_qubit | The control qubit |
| tgt_qubit | The target qubit |
Referenced by Simulators::FusionGate::Apply(), and ApplyCSXDG().
|
pure virtualinherited |
Applies a controlled U gate to the qubits.
Applies a controlled U gate to the specified qubits
| ctrl_qubit | The control qubit |
| tgt_qubit | The target qubit |
| theta | Theta parameter for the U gate |
| phi | Phi parameter for the U gate |
| lambda | Lambda parameter for the U gate |
| gamma | Gamma parameter for the U gate |
Referenced by Simulators::FusionGate::Apply(), and ApplyCU().
|
pure virtualinherited |
Applies a CX gate to the qubits.
Applies a controlled X gate to the specified qubits
| ctrl_qubit | The control qubit |
| tgt_qubit | The target qubit |
Referenced by Simulators::FusionGate::Apply(), and ApplyCX().
|
pure virtualinherited |
Applies a CY gate to the qubits.
Applies a controlled Y gate to the specified qubits
| ctrl_qubit | The control qubit |
| tgt_qubit | The target qubit |
Referenced by Simulators::FusionGate::Apply(), and ApplyCY().
|
pure virtualinherited |
Applies a CZ gate to the qubits.
Applies a controlled Z gate to the specified qubits
| ctrl_qubit | The control qubit |
| tgt_qubit | The target qubit |
Referenced by Simulators::FusionGate::Apply(), and ApplyCZ().
|
inlineinherited |
Noise.h dephasing is a stochastic phase flip, not phase damping.
Definition at line 730 of file State.h.
References ApplyPhaseFlipNoise().
|
inlineinherited |
Depolarizing replacement (1-p)rho + p I/2, fully mixed at p=1.
Definition at line 742 of file State.h.
References ApplyQuantumChannel(), and Simulators::QuantumChannel::DepolarizingMixing().
|
inlineinherited |
Depolarizing noise using total nonidentity-Pauli probability p.
Definition at line 736 of file State.h.
References ApplyQuantumChannel(), and Simulators::QuantumChannel::Depolarizing().
|
inlineinherited |
Definition at line 790 of file State.h.
References ApplyQuantumChannel(), and Simulators::QuantumChannel::GeneralizedAmplitudeDamping().
|
pure virtualinherited |
Apply a generic one-qubit gate to the specified qubit.
| qubit | The qubit to apply the gate to. |
| gate | The 2x2 matrix representing the gate. |
Referenced by Simulators::FusionGate::Apply().
|
inlinevirtualinherited |
Definition at line 67 of file Simulator.h.
Referenced by Simulators::FusionGate::Apply().
|
pure virtualinherited |
Apply a generic two-qubit gate to the specified qubits.
| qubit0 | The first qubit to apply the gate to. |
| qubit1 | The second qubit to apply the gate to. |
| gate | The 4x4 matrix representing the gate. |
Referenced by Simulators::FusionGate::Apply().
|
pure virtualinherited |
Applies a Hadamard gate to the qubit.
Applies a Hadamard gate to the specified qubit
| qubit | The qubit to apply the gate to. |
Referenced by Simulators::FusionGate::Apply(), and ApplyH().
|
pure virtualinherited |
Applies a K gate to the qubit.
Applies a K (Hy) gate to the specified qubit
| qubit | The qubit to apply the gate to. |
Referenced by Simulators::FusionGate::Apply(), and ApplyK().
|
inlineinherited |
Apply an arbitrary CPTP map supplied in Kraus form.
Definition at line 691 of file State.h.
References ApplyQuantumChannel().
Referenced by ApplyChannel().
|
pure virtualinherited |
Applies a nop.
Applies a nop (no operation). Typically does (almost) nothing. Equivalent to an identity. For qiskit aer it will send the 'nop' to the qiskit aer simulator.
|
inlineoverridevirtual |
Reimplemented from Simulators::IState.
Definition at line 474 of file FusionState.h.
References Flush(), immediate_, and Simulators::IState::NotifyObservers().
|
pure virtualinherited |
Applies a phase shift gate to the qubit.
Applies a specified phase shift gate to the qubit
| qubit | The qubit to apply the gate to. |
| lambda | The phase shift angle. |
Referenced by Simulators::FusionGate::Apply(), and ApplyP().
|
inlineinherited |
Apply an arbitrary one- or two-qubit Pauli channel.
Definition at line 703 of file State.h.
References ApplyQuantumChannel(), and Simulators::QuantumChannel::Pauli().
|
inlineinherited |
Apply a single-qubit Pauli channel specified by X/Y/Z probabilities.
Definition at line 709 of file State.h.
References ApplyQuantumChannel(), and Simulators::QuantumChannel::Pauli().
|
inlineinherited |
Phase damping with coherence multiplier sqrt(1-gamma).
Definition at line 770 of file State.h.
References ApplyQuantumChannel(), and Simulators::QuantumChannel::PhaseDamping().
Referenced by ApplyPhaseDampingFromTime().
|
inlineinherited |
Pure phase damping for a physical duration and T_phi.
gamma=1-exp(-2 duration/T_phi), so coherences decay as exp(-duration/T_phi).
Definition at line 780 of file State.h.
References ApplyPhaseDamping().
|
inlineinherited |
Definition at line 724 of file State.h.
References ApplyQuantumChannel(), and Simulators::QuantumChannel::PhaseFlip().
Referenced by ApplyDephasingNoise().
|
inlineoverridevirtual |
Applies a local CPTP quantum channel to one or two qubits.
The order of target qubits has the same matrix convention as ApplyGenericTwoQubitGate: targets[0] is the least-significant local basis bit. Backends that do not represent mixed states exactly throw.
Reimplemented from Simulators::IState.
Definition at line 265 of file FusionState.h.
References ConsumeBoundary(), Flush(), immediate_, Circuits::kQuantumChannel, and Simulators::IState::NotifyObservers().
|
inlineoverridevirtual |
Performs a reset of the specified qubits.
Measures the qubits and for those that are 1, applies X on them
| qubits | A vector with the qubits to be reset. |
Implements Simulators::IState.
Definition at line 257 of file FusionState.h.
References ConsumeBoundary(), Flush(), immediate_, Circuits::kReset, and Simulators::IState::NotifyObservers().
|
pure virtualinherited |
Applies a Rx gate to the qubit.
Applies an x rotation gate to the specified qubit
| qubit | The qubit to apply the gate to. |
| theta | The rotation angle. |
Referenced by Simulators::FusionGate::Apply(), and ApplyRx().
|
pure virtualinherited |
Applies a Ry gate to the qubit.
Applies a y rotation gate to the specified qubit
| qubit | The qubit to apply the gate to. |
| theta | The rotation angle. |
Referenced by Simulators::FusionGate::Apply(), and ApplyRy().
|
pure virtualinherited |
Applies a Rz gate to the qubit.
Applies a z rotation gate to the specified qubit
| qubit | The qubit to apply the gate to. |
| theta | The rotation angle. |
Referenced by Simulators::FusionGate::Apply(), and ApplyRz().
|
pure virtualinherited |
Applies a S gate to the qubit.
Applies a S gate to the specified qubit
| qubit | The qubit to apply the gate to. |
Referenced by Simulators::FusionGate::Apply(), and ApplyS().
|
pure virtualinherited |
Applies a S dagger gate to the qubit.
Applies a S dagger gate to the specified qubit
| qubit | The qubit to apply the gate to. |
Referenced by Simulators::FusionGate::Apply(), and ApplySDG().
|
pure virtualinherited |
Applies a swap gate to the qubits.
Applies a swap gate to the specified qubits
| qubit0 | The first qubit |
| qubit1 | The second qubit |
Referenced by Simulators::FusionGate::Apply(), and ApplySwap().
|
pure virtualinherited |
Applies a Sx gate to the qubit.
Applies a Sx gate to the specified qubit
| qubit | The qubit to apply the gate to. |
Referenced by Simulators::FusionGate::Apply(), and ApplySX().
|
pure virtualinherited |
Applies a Sx dagger gate to the qubit.
Applies a Sx dagger gate to the specified qubit
| qubit | The qubit to apply the gate to. |
Referenced by Simulators::FusionGate::Apply(), and ApplySXDG().
|
pure virtualinherited |
Applies a T gate to the qubit.
Applies a T gate to the specified qubit
| qubit | The qubit to apply the gate to. |
Referenced by Simulators::FusionGate::Apply(), and ApplyT().
|
inlineinherited |
Alias for the exact T1 amplitude-damping channel.
Definition at line 753 of file State.h.
References ApplyAmplitudeDamping().
|
inlineinherited |
Exact T1 relaxation for a physical duration and time constant.
Definition at line 759 of file State.h.
References ApplyAmplitudeDamping().
|
pure virtualinherited |
Applies a T dagger gate to the qubit.
Applies a T dagger gate to the specified qubit
| qubit | The qubit to apply the gate to. |
Referenced by Simulators::FusionGate::Apply(), and ApplyTDG().
|
inlineinherited |
Definition at line 795 of file State.h.
References ApplyQuantumChannel(), and Simulators::QuantumChannel::ThermalRelaxation().
|
inlineinherited |
Definition at line 815 of file State.h.
References ApplyQuantumChannel(), and Simulators::QuantumChannel::TwoQubitDepolarizingMixing().
|
inlineinherited |
Definition at line 810 of file State.h.
References ApplyQuantumChannel(), and Simulators::QuantumChannel::TwoQubitDepolarizing().
|
pure virtualinherited |
Applies a U gate to the qubit.
Applies a U gate to the specified qubit
| qubit | The qubit to apply the gate to. |
| theta | The first parameter. |
| phi | The second parameter. |
| lambda | The third parameter. |
| gamma | The fourth parameter. |
Referenced by Simulators::FusionGate::Apply(), and ApplyU().
|
pure virtualinherited |
Applies a not gate to the qubit.
Applies a not (X) gate to the specified qubit
| qubit | The qubit to apply the gate to. |
Referenced by Simulators::FusionGate::Apply(), ApplyX(), InitializeToBasisState(), and InitializeToBasisState().
|
pure virtualinherited |
Applies a Y gate to the qubit.
Applies a not (Y) gate to the specified qubit
| qubit | The qubit to apply the gate to. |
Referenced by Simulators::FusionGate::Apply(), and ApplyY().
|
pure virtualinherited |
Applies a Z gate to the qubit.
Applies a not (Z) gate to the specified qubit
| qubit | The qubit to apply the gate to. |
Referenced by Simulators::FusionGate::Apply(), and ApplyZ().
|
inlineoverridevirtual |
Clears the state.
Sets the number of allocated qubits to 0 and clears the state. After this qubits allocation is required then calling IState::AllocateQubits in order to use the simulator.
Implements Simulators::IState.
Definition at line 172 of file FusionState.h.
References immediate_.
|
inlineinherited |
|
pure virtualinherited |
Clones the simulator.
Clones the simulator, including the state, the configuration and the internally saved state, if any. Does not copy the observers. Should be used mainly internally, to optimise multiple shots execution, copying the state from the simulator used for timing.
Referenced by CloneForExecution().
|
inlinevirtualinherited |
Definition at line 426 of file Simulator.h.
References Clone().
|
inlineprotected |
Definition at line 723 of file FusionState.h.
References FusionState(), Flush(), Simulators::ISimulator::GetGateFusionMaxQubits(), GetSimulationType(), GetType(), immediate_, IsGateFusionEnabled(), Simulators::kMatrixProductOperator, Simulators::kMatrixProductState, Simulators::kQCSim, Simulators::IState::SeedAuxiliaryRng(), and Simulators::GateFusion< Gate >::SetWidth().
|
inlineoverridevirtual |
Configures the state.
This function is called to configure the simulator. Currently only aer supports configuration, qcsim will gracefully ignore this.
| key | The key of the configuration option. |
| value | The value of the configuration. |
Implements Simulators::IState.
Definition at line 40 of file FusionState.h.
References Flush(), Simulators::ISimulator::GetGateFusionMaxQubits(), immediate_, IsGateFusionEnabled(), IsRoutingLookaheadEnabled(), and Simulators::IState::SeedAuxiliaryRng().
|
inlineprotected |
Definition at line 837 of file FusionState.h.
References GetType(), and immediate_.
Referenced by ApplyQuantumChannel(), ApplyReset(), Measure(), and MeasureMany().
|
inlineprotectedvirtual |
Definition at line 695 of file FusionState.h.
Referenced by IsGateFusionEnabled().
|
inlineoverridevirtual |
Reimplemented from Simulators::IState.
Definition at line 448 of file FusionState.h.
References immediate_.
|
inlineoverridevirtual |
Reimplemented from Simulators::IState.
Definition at line 509 of file FusionState.h.
References immediate_.
|
inlineoverridevirtual |
Reimplemented from Simulators::IState.
Definition at line 273 of file FusionState.h.
References FusionState(), and immediate_.
|
inlineoverridevirtual |
Reimplemented from Simulators::IState.
Definition at line 497 of file FusionState.h.
References immediate_.
|
inlineoverridevirtual |
Mixed-state diagnostics.
Implemented by density-matrix and MPO backends.
Reimplemented from Simulators::IState.
Definition at line 491 of file FusionState.h.
References immediate_.
|
inlineoverridevirtual |
Reimplemented from Simulators::IState.
Definition at line 503 of file FusionState.h.
References immediate_.
|
inlinestaticinherited |
Definition at line 162 of file State.h.
References Utils::RandomStream::Derive().
Referenced by Circuits::Circuit< Time >::CloneForExecution(), Circuits::Random< Time >::CloneForExecution(), Network::ExecuteJob< Time >::DoWork(), Network::SimpleDisconnectedNetwork< Time, Controller >::ExecuteLogicalShotBlocks(), Network::SimpleDisconnectedNetwork< Time, Controller >::RepeatedExecute(), Network::SimpleDisconnectedNetwork< Time, Controller >::RepeatedExecuteOnHost(), and SeedAuxiliaryRng().
|
inlineprotectedinherited |
|
inlineoverridevirtual |
Returns the expected value of a Pauli string.
Use it to obtain the expected value of a Pauli string. The Pauli string is a string of characters representing the Pauli operators, e.g. "XIZY". The length of the string should be less or equal to the number of qubits (if it's less, it's completed with I).
| pauliString | The Pauli string to obtain the expected value for. |
Implements Simulators::IState.
Definition at line 424 of file FusionState.h.
References immediate_.
|
inlineoverridevirtual |
Reimplemented from Simulators::IState.
Definition at line 460 of file FusionState.h.
References immediate_.
|
inlineoverridevirtual |
Reimplemented from Simulators::IState.
Definition at line 392 of file FusionState.h.
References immediate_.
|
inlineoverridevirtual |
Reimplemented from Simulators::IState.
Definition at line 416 of file FusionState.h.
References immediate_.
|
inlineoverridevirtual |
Reimplemented from Simulators::IState.
Definition at line 466 of file FusionState.h.
References immediate_.
|
inlineoverridevirtual |
Reimplemented from Simulators::IState.
Definition at line 527 of file FusionState.h.
References immediate_.
|
inlineoverridevirtual |
Flushes the applied operations.
This function is called to flush the applied operations. qcsim applies them right away, so this has no effect on it, but qiskit aer does not.
Implements Simulators::IState.
Definition at line 95 of file FusionState.h.
References FlushPendingGates(), and immediate_.
Referenced by AllocateQubits(), ApplyOperator(), ApplyQuantumChannel(), ApplyReset(), CloneInto(), Configure(), HermitizeDensityMatrix(), Measure(), MeasureMany(), MoveAtBeginningOfChain(), ReCanonicalize(), RestoreDensityMatrixTrace(), RestoreInternalDestructiveSavedState(), RestoreState(), SaveState(), SaveStateToInternalDestructive(), setGrowthFactorGate(), setGrowthFactorSwap(), SetInitialQubitsMap(), SetMultithreading(), SetSeed(), SetUpcomingGates(), and Trim().
|
inlineoverridevirtual |
Reimplemented from Simulators::ISimulator.
Definition at line 90 of file FusionState.h.
Referenced by Flush(), SetGatesCounter(), and SubmitGate().
|
inlineoverridevirtual |
|
inlineoverridevirtual |
Returns configuration value.
This function is called get a configuration value.
| key | The key of the configuration value. |
Implements Simulators::IState.
Definition at line 69 of file FusionState.h.
References immediate_.
|
inlineoverridevirtual |
Returns the maximum bond dimension reached.
Returns the maximum bond dimension reached during execution, if applicable (mps simulator, either qcsim or gpu).
Reimplemented from Simulators::IState.
Definition at line 285 of file FusionState.h.
References immediate_.
|
inlineoverridevirtual |
Reimplemented from Simulators::IState.
Definition at line 454 of file FusionState.h.
References immediate_.
|
inlineoverridevirtual |
Reimplemented from Simulators::IState.
Definition at line 291 of file FusionState.h.
References immediate_.
|
inlinevirtualinherited |
Definition at line 46 of file Simulator.h.
Referenced by Simulators::Private::FusionState::CloneInto(), Simulators::Private::FusionState::Configure(), Simulators::Private::FusionState::IsGateFusionEnabled(), and Simulators::Private::FusionState::SubmitGate().
|
inlineoverridevirtual |
Reimplemented from Simulators::ISimulator.
Definition at line 22 of file FusionState.h.
|
inlineoverridevirtual |
Returns the gates counter.
Usually does nothing, except for MPS simulators that support swap optimization.
Reimplemented from Simulators::IState.
Definition at line 128 of file FusionState.h.
|
inlineoverridevirtual |
Reimplemented from Simulators::ISimulator.
Definition at line 311 of file FusionState.h.
References immediate_.
|
inlineoverridevirtual |
Reimplemented from Simulators::IState.
Definition at line 351 of file FusionState.h.
References immediate_.
|
inlineoverridevirtual |
Reimplemented from Simulators::IState.
Definition at line 346 of file FusionState.h.
References immediate_.
|
inlineoverridevirtual |
Get the multithreading flag.
Returns the multithreading flag.
Implements Simulators::IState.
Definition at line 321 of file FusionState.h.
References immediate_.
|
inlineoverridevirtual |
Returns the number of qubits.
This function is called to obtain the number of the allocated qubits.
Implements Simulators::IState.
Definition at line 296 of file FusionState.h.
References immediate_.
Referenced by Initialize(), IsGateFusionEnabled(), and SubmitGate().
|
inlineinherited |
Get a shared pointer to this object.
Returns a shared pointer to this object. The object needs to be already wrapped in a shared pointer.
Definition at line 440 of file Simulator.h.
|
inlineoverridevirtual |
Returns the type of simulation.
Returns the type of simulation.
Implements Simulators::IState.
Definition at line 306 of file FusionState.h.
References immediate_.
Referenced by CloneInto(), and GetUpcomingRoutingOperations().
|
inlineoverridevirtual |
Reimplemented from Simulators::IState.
Definition at line 386 of file FusionState.h.
References immediate_.
|
inlineoverridevirtual |
Returns the type of simulator.
Returns the type of simulator.
Implements Simulators::IState.
Definition at line 301 of file FusionState.h.
References immediate_.
Referenced by CloneInto(), and ConsumeBoundary().
|
inlineoverridevirtual |
Reimplemented from Simulators::IState.
Definition at line 111 of file FusionState.h.
References FusionState(), GetSimulationType(), IsGateFusionEnabled(), Simulators::kMatrixProductOperator, and Simulators::kMatrixProductState.
|
inlineoverridevirtual |
Reimplemented from Simulators::IState.
Definition at line 539 of file FusionState.h.
References Flush(), and immediate_.
|
inlineoverridevirtual |
Increments the gates counter.
Usually does nothing, except for MPS simulators that support swap optimization. Increments the position in the circuit from where the execution should continue. Useful for classically controlled gates, for the case when the controlled gate is not executed.
Reimplemented from Simulators::IState.
Definition at line 152 of file FusionState.h.
References SetGatesCounter().
|
inlineprotectedvirtual |
Definition at line 705 of file FusionState.h.
Referenced by Initialize().
|
inlineoverridevirtual |
Initializes the state.
This function is called when the simulator is initialized. Call it after the qubits allocation.
Implements Simulators::IState.
Definition at line 157 of file FusionState.h.
References GetNumberOfQubits(), immediate_, and InitializationPreservesSnapshots().
|
inlineoverridevirtual |
Initializes the state.
This function is called when the simulator is initialized. Call it only on a non-initialized state. This is good only for a statevector simulator and should be used only by calling from a composite simulator.
| num_qubits | The number of qubits to initialize the state with. |
| amplitudes | A vector with the amplitudes to initialize the state with. |
Implements Simulators::IState.
Definition at line 619 of file FusionState.h.
References immediate_.
|
inlineoverridevirtual |
Initializes the state.
This function is called when the simulator is initialized. Call it only on a non-initialized state. This is good only for a statevector simulator and should be used only by calling from a composite simulator.
| num_qubits | The number of qubits to initialize the state with. |
| amplitudes | A vector with the amplitudes to initialize the state with. |
Implements Simulators::IState.
Definition at line 631 of file FusionState.h.
References immediate_.
|
inlineoverridevirtual |
Initializes the state.
This function is called when the simulator is initialized. Call it only on a non-initialized state. This is good only for a statevector simulator and should be used only by calling from a composite simulator.
| num_qubits | The number of qubits to initialize the state with. |
| amplitudes | A vector with the amplitudes to initialize the state with. |
Implements Simulators::IState.
Definition at line 607 of file FusionState.h.
References immediate_.
|
inlineoverridevirtual |
Initializes the state to a computational basis state.
Same as the Types::qubit_t overload, but the basis state is given as one bool per qubit so it is not limited to 64 qubits.
| num_qubits | The number of qubits to initialize the state with. |
| basisState | The computational basis state, entry i selects qubit i. |
Reimplemented from Simulators::IState.
Definition at line 655 of file FusionState.h.
References immediate_.
|
inlineoverridevirtual |
Initializes the state to a computational basis state.
Call it only on a non-initialized state, it allocates the qubits and initializes the state itself. Every simulator supports this: backends with a direct primitive (density matrix, matrix product operator, matrix product state, statevector) use it; ISimulator provides a generic fallback (reset to |0...0>, then apply X on every set bit) for the rest.
Don't use it for more than 64 qubits, as the basis state is packed in a single Types::qubit_t; use the std::vector<bool> overload instead, which the matrix product operator and matrix product state backends (the only ones that can scale that far) support natively.
| num_qubits | The number of qubits to initialize the state with. |
| basisState | The computational basis state, bit i selects qubit i. |
Reimplemented from Simulators::IState.
Definition at line 643 of file FusionState.h.
References immediate_.
|
inlineoverridevirtual |
Initializes the state to a classical mixture of computational basis states.
Same as the Types::qubit_t-keyed overload, but each basis state is given as one bool per qubit so it is not limited to 64 qubits. Currently only the matrix product operator backend supports this.
| num_qubits | The number of qubits to initialize the state with. |
| mixture | The mixture, as pairs of (basis state, weight). |
Reimplemented from Simulators::IState.
Definition at line 679 of file FusionState.h.
References immediate_.
|
inlineoverridevirtual |
Initializes the state to a classical mixture of computational basis states.
Sets the state to rho = sum_k weights[k] |states[k]><states[k]|. Call it only on a non-initialized state, it allocates the qubits and initializes the state itself. Weights are normalized so the trace is 1; only backends that can represent a mixed state support this - currently the density matrix and matrix product operator backends. Other backends throw, and there is no generic fallback: unlike a basis state, a mixture cannot be reached with unitary gates alone.
Don't use it for more than 64 qubits, as each basis state is packed in a single Types::qubit_t; use the std::vector<bool>-keyed overload instead for the matrix product operator backend, which can scale that far.
| num_qubits | The number of qubits to initialize the state with. |
| mixture | The mixture, as pairs of (basis state, weight). |
Reimplemented from Simulators::IState.
Definition at line 667 of file FusionState.h.
References immediate_.
|
inlineoverridevirtual |
Reimplemented from Simulators::IState.
Definition at line 515 of file FusionState.h.
References immediate_.
|
inlineoverridevirtual |
Reimplemented from Simulators::ISimulator.
Definition at line 30 of file FusionState.h.
References DefaultGateFusionMinQubits(), Simulators::ISimulator::GetGateFusionMaxQubits(), and GetNumberOfQubits().
Referenced by CloneInto(), Configure(), GetUpcomingRoutingOperations(), and SubmitGate().
|
inlineoverridevirtual |
Returns if the simulator is a qcsim simulator.
Returns if the simulator is a qcsim simulator. This is just a helper function to ease things up: qcsim has different functionality exposed sometimes so it's good to know if we deal with qcsim or with qiskit aer.
Implements Simulators::IState.
Definition at line 316 of file FusionState.h.
References immediate_.
|
inlineoverridevirtual |
Reimplemented from Simulators::IState.
Definition at line 336 of file FusionState.h.
References immediate_.
Referenced by Configure(), setGrowthFactorGate(), and setGrowthFactorSwap().
|
inlineoverridevirtual |
Performs a measurement on the specified qubits.
Don't use it if the number of qubits is larger than the number of bits in the size_t type (usually 64), as the outcome will be undefined
| qubits | A vector with the qubits to be measured. |
Implements Simulators::IState.
Definition at line 239 of file FusionState.h.
References ConsumeBoundary(), Flush(), immediate_, Circuits::kMeasurement, and Simulators::IState::NotifyObservers().
|
inlineoverridevirtual |
Performs a measurement on the specified qubits.
| qubits | A vector with the qubits to be measured. |
Implements Simulators::IState.
Definition at line 248 of file FusionState.h.
References ConsumeBoundary(), Flush(), immediate_, Circuits::kMeasurement, and Simulators::IState::NotifyObservers().
|
inlineoverridevirtual |
Measures all the qubits without collapsing the state.
Measures all the qubits without collapsing the state, allowing to perform multiple shots. This is to be used only internally, only for the statevector simulators (or those based on them, as the composite ones). For the qiskit aer case, SaveStateToInternalDestructive is needed to be called before this. If one wants to use the simulator after such measurement(s), RestoreInternalDestructiveSavedState should be called at the end.
Don't use this for more qubits than the size of Types::qubit_t, as the result is packed in a limited number of bits (e.g. 64 bits for uint64_t)
Implements Simulators::IState.
Definition at line 430 of file FusionState.h.
References immediate_.
|
inlineoverridevirtual |
Measures all the qubits without collapsing the state.
Measures all the qubits without collapsing the state, allowing to perform multiple shots. This is to be used only internally, only for the statevector simulators (or those based on them, as the composite ones). For the qiskit aer case, SaveStateToInternalDestructive is needed to be called before this. If one wants to use the simulator after such measurement(s), RestoreInternalDestructiveSavedState should be called at the end.
Use this for more qubits than the size of Types::qubit_t
Implements Simulators::IState.
Definition at line 436 of file FusionState.h.
References immediate_.
|
inlineoverridevirtual |
Reimplemented from Simulators::IState.
Definition at line 482 of file FusionState.h.
References Flush(), and immediate_.
|
inlineprotectednoexceptinherited |
|
inlineprotectedinherited |
|
inlineprotectedinherited |
Notifies observers.
Called when the state changes, to notify observers about it.
| affectedQubits | A vector with the qubits that were affected by the change. |
Definition at line 1197 of file State.h.
Referenced by Simulators::Private::FusionState::ApplyOperator(), Simulators::Private::FusionState::ApplyQuantumChannel(), Simulators::Private::FusionState::ApplyReset(), Simulators::Private::FusionState::Measure(), Simulators::Private::FusionState::MeasureMany(), and Simulators::Private::FusionState::SubmitGate().
|
inlineoverridevirtual |
Reimplemented from Simulators::IState.
Definition at line 521 of file FusionState.h.
References immediate_.
|
inlineprotectedvirtual |
Definition at line 714 of file FusionState.h.
|
inlineoverridevirtual |
Returns the probabilities of the specified outcomes.
Use it to obtain the probabilities of the specified outcomes.
| qubits | A vector with the qubits configuration outcomes. |
Implements Simulators::IState.
Definition at line 398 of file FusionState.h.
References immediate_.
|
inlineoverridevirtual |
Returns the probability of the specified outcome.
Use it to obtain the probability to obtain the specified outcome, if all qubits are measured.
| outcome | The outcome to obtain the probability for. |
Implements Simulators::IState.
Definition at line 356 of file FusionState.h.
References immediate_.
|
inlineoverridevirtual |
MPO extensions: bit vectors are q0-first; matrices use logical basis order.
Element queries return the raw operator. Dense output and complex Pauli expectations are trace-normalized unless normalized is false. ApplyOperator computes A rho A^dagger; normalize also restores unit trace.
Reimplemented from Simulators::IState.
Definition at line 442 of file FusionState.h.
References immediate_.
|
inlineoverridevirtual |
Projects the state onto the zero state.
Use it to project the state onto the zero state. For most simulator is the same as calling Amplitude(0), but for some simulators it can be optimized to be faster than calling Amplitude(0). This for now is done for qcsim mps and gpu mps.
Implements Simulators::IState.
Definition at line 374 of file FusionState.h.
References immediate_.
|
inlineinherited |
Uniform random number in [0, 1) from the auxiliary stream.
Used for classical post-processing that happens during execution, such as readout-error flips applied when a measurement writes its bit. Each simulator instance owns its own stream, so the per-job clones in the multi-shot thread pool never share state. Deterministic after SetSeed or Configure("seed") on the built-in backends.
|
inlineoverridevirtual |
Restore the canonical form of a matrix-product state or operator.
Reimplemented from Simulators::IState.
Definition at line 551 of file FusionState.h.
References Flush(), and immediate_.
|
inlineinherited |
Registers an observer.
Registers an observer that will be notified when the state changes.
| observer | A smart pointer to an observer. |
|
inlineoverridevirtual |
Just resets the state to 0.
Does not destroy the internal state, just resets it to zero (as a 'reset' op on each qubit would do).
Implements Simulators::IState.
Definition at line 164 of file FusionState.h.
References immediate_.
|
inlineoverridevirtual |
Reimplemented from Simulators::IState.
Definition at line 533 of file FusionState.h.
References Flush(), and immediate_.
|
inlineoverridevirtual |
Restores the state from the internally saved state.
Restores the state from the internally saved state, if needed. This does something only for qiskit aer.
Implements Simulators::IState.
Definition at line 223 of file FusionState.h.
References Flush(), and immediate_.
|
inlineoverridevirtual |
Restores the state from the internally saved state.
Restores the state from the internally saved state, if needed. To be used in order to recover the state after doing measurements, for multiple shots executions. In the first phase, only qcsim will implement this.
Implements Simulators::IState.
Definition at line 198 of file FusionState.h.
References Flush(), and immediate_.
|
inlineoverridevirtual |
Returns the counts of the outcomes of measurement of the specified qubits, for repeated measurements.
Use it to obtain the counts of the outcomes of the specified qubits measurements. The state is not collapsed, so the measurement can be repeated 'shots' times.
Don't use it if the number of qubits is larger than the number of bits in the Types::qubit_t type (usually 64), as the outcome will be undefined.
| qubits | A vector with the qubits to be measured. |
| shots | The number of shots to perform. |
Implements Simulators::IState.
Definition at line 404 of file FusionState.h.
References immediate_.
|
inlineoverridevirtual |
Returns the counts of the outcomes of measurement of the specified qubits, for repeated measurements.
Use it to obtain the counts of the outcomes of the specified qubits measurements. The state is not collapsed, so the measurement can be repeated 'shots' times.
| qubits | A vector with the qubits to be measured. |
| shots | The number of shots to perform. |
Implements Simulators::IState.
Definition at line 410 of file FusionState.h.
References immediate_.
|
inlineoverridevirtual |
Saves the state to internal storage.
Saves the state to internal storage, if needed. Calling this will not destroy the internal state, unlike the 'Destructive' variant. To be used in order to recover the state after doing measurements, for multiple shots executions. In the first phase, only qcsim will implement this.
Implements Simulators::IState.
Definition at line 191 of file FusionState.h.
References Flush(), and immediate_.
|
inlineoverridevirtual |
Saves the state to internal storage.
Saves the state to internal storage, if needed. Calling this should consider as the simulator is gone to uninitialized. Either do not use it except for getting amplitudes, or reinitialize the simulator after calling it. This is needed only for the composite simulator, for an optimization for qiskit aer.
Implements Simulators::IState.
Definition at line 215 of file FusionState.h.
References Flush(), immediate_, and UsesDestructiveStateStorage().
|
inlineprotectedinherited |
Shared by SetSeed and backend Configure("seed") implementations.
Definition at line 1164 of file State.h.
References DeriveSeed().
Referenced by Simulators::Private::FusionState::FusionState(), Simulators::Private::FusionState::CloneInto(), Simulators::Private::FusionState::Configure(), SetSeed(), and Simulators::Private::FusionState::SetSeed().
|
inlineoverridevirtual |
Reimplemented from Simulators::IState.
Definition at line 579 of file FusionState.h.
References immediate_.
|
inlinevirtualinherited |
|
inlineoverride |
Definition at line 133 of file FusionState.h.
References FlushPendingGates(), and immediate_.
Referenced by IncrementGatesCounter().
|
inlineoverridevirtual |
Reimplemented from Simulators::IState.
Definition at line 598 of file FusionState.h.
References Flush(), immediate_, and IsRoutingLookaheadEnabled().
|
inlineoverridevirtual |
Reimplemented from Simulators::IState.
Definition at line 589 of file FusionState.h.
References Flush(), immediate_, and IsRoutingLookaheadEnabled().
|
inlinevirtualinherited |
Sets the initial qubits map, if possible.
This will do nothing for most simulators, but for the MPS simulator it will set the initial qubits if it supports it - that is, for qcsim and the gpu simulator it can set the mapping of the qubits to the positions in the chain, which can be used to optimize the swapping cost.
|
inlineoverride |
Definition at line 563 of file FusionState.h.
References Flush(), and immediate_.
|
inlineoverridevirtual |
Sets the lookahead depth for swap optimization.
Controls how many upcoming 2-qubit gates are considered when choosing the swap meeting position. 0 means no lookahead (immediate cost only). Only effective for MPS simulators. Requires upcoming gates to be supplied via SetUpcomingGates.
Reimplemented from Simulators::IState.
Definition at line 574 of file FusionState.h.
References immediate_.
|
inlineoverridevirtual |
Sets the lookahead depth for swap optimization.
Controls how many upcoming 2-qubit gates are considered when choosing the swap meeting position. 0 means no lookahead (immediate cost only). Only effective for MPS simulators. Requires upcoming gates to be supplied via SetUpcomingGates. This value sets a number of gates to lookahead without much cost increase.
Reimplemented from Simulators::IState.
Definition at line 584 of file FusionState.h.
References immediate_.
|
inlineoverridevirtual |
Enable/disable multithreading.
Enable/disable multithreading. Default is enabled.
| multithreading | A flag to indicate if multithreading should be enabled. |
Implements Simulators::IState.
Definition at line 557 of file FusionState.h.
References Flush(), and immediate_.
|
inlineoverridevirtual |
Seed every random stream owned by this simulator.
Reimplemented from Simulators::IState.
Definition at line 83 of file FusionState.h.
References Flush(), immediate_, and Simulators::IState::SeedAuxiliaryRng().
|
inlineoverridevirtual |
Supplies upcoming gates for lookahead swap optimization.
The simulator uses these to evaluate swap costs for future gates when choosing where to meet. Only effective for MPS simulators with lookahead depth > 0.
Reimplemented from Simulators::IState.
Definition at line 103 of file FusionState.h.
References Flush().
|
inlineoverridevirtual |
Enables or disables optimal meeting position for MPS swaps.
When enabled, the MPS simulator uses actual bond dimensions to find the cheapest meeting position for non-adjacent qubit swaps instead of the default heuristic. Does nothing for non-MPS simulators.
Reimplemented from Simulators::IState.
Definition at line 569 of file FusionState.h.
References immediate_.
|
inlineprotected |
Definition at line 755 of file FusionState.h.
References Simulators::FusionGate::Apply(), Simulators::FusionGate::Expand(), FlushPendingGates(), Simulators::FusionGate::FromCircuit(), Simulators::FusionGate::generic, Simulators::ISimulator::GetGateFusionMaxQubits(), GetNumberOfQubits(), immediate_, IsGateFusionEnabled(), Circuits::kConditionalGate, Simulators::FusionGate::kind, Simulators::IState::NotifyObservers(), Simulators::FusionGate::params, and Simulators::FusionGate::qubits.
|
inlineoverridevirtual |
Returns if the simulator supports MPS swap optimization.
Used to check if the simulator supports MPS swap optimization.
Reimplemented from Simulators::IState.
Definition at line 326 of file FusionState.h.
References immediate_.
|
inlineoverridevirtual |
Returns whether this state retains channel ensembles directly.
This is true for QCSim density-matrix/MPO states and Aer density-matrix states. MPO results remain subject to configured bond truncation. A statevector or MPS can sample Kraus trajectories, but does not retain the resulting ensemble in a single state.
Reimplemented from Simulators::IState.
Definition at line 341 of file FusionState.h.
References immediate_.
|
inlineoverridevirtual |
Reimplemented from Simulators::IState.
Definition at line 331 of file FusionState.h.
References immediate_.
|
inlineoverridevirtual |
Compress a matrix-product state or operator to its configured limits.
Reimplemented from Simulators::IState.
Definition at line 545 of file FusionState.h.
References Flush(), and immediate_.
|
inlineinherited |
Unregisters an observer.
Unegisters an observer.
| observer | A smart pointer to an observer. |
|
inlineprotectedvirtual |
Definition at line 700 of file FusionState.h.
Referenced by SaveStateToInternalDestructive().
|
protected |
Definition at line 721 of file FusionState.h.
Referenced by FusionState(), AllocateQubits(), AllProbabilities(), Amplitude(), AmplitudeRaw(), ApplyOperator(), ApplyQuantumChannel(), ApplyReset(), Clear(), CloneInto(), Configure(), ConsumeBoundary(), DensityMatrixElementBits(), DensityMatrixHermiticityResidual(), DensityMatrixOverlap(), DensityMatrixPurity(), DensityMatrixTrace(), DensityMatrixTraceOfSquare(), ExpectationValue(), ExpectationValueComplex(), ExpectationValueOperators(), ExpectationValues(), ExpectationValuesComplex(), FidelityWithStatevector(), Flush(), GetConfigMap(), GetConfiguration(), GetCurrentMaxBondDimension(), GetDensityMatrix(), GetExecutedMaxBondDimension(), GetGpuDevice(), getGrowthFactorGate(), getGrowthFactorSwap(), GetMultithreading(), GetNumberOfQubits(), GetSimulationType(), GetStateVector(), GetType(), HermitizeDensityMatrix(), Initialize(), InitializeState(), InitializeState(), InitializeState(), InitializeToBasisState(), InitializeToBasisState(), InitializeToMixtureOfBasisStates(), InitializeToMixtureOfBasisStates(), IsDensityMatrixHermitian(), IsQcsim(), IsRoutingLookaheadEnabled(), Measure(), MeasureMany(), MeasureNoCollapse(), MeasureNoCollapseMany(), MoveAtBeginningOfChain(), PartialTrace(), Probabilities(), Probability(), ProbabilityBits(), ProjectOnZero(), ReCanonicalize(), Reset(), RestoreDensityMatrixTrace(), RestoreInternalDestructiveSavedState(), RestoreState(), SampleCounts(), SampleCountsMany(), SaveState(), SaveStateToInternalDestructive(), SetAutomaticLookaheadDepth(), SetGatesCounter(), setGrowthFactorGate(), setGrowthFactorSwap(), SetInitialQubitsMap(), SetLookaheadDepth(), SetLookaheadDepthWithHeuristic(), SetMultithreading(), SetSeed(), SetUseOptimalMeetingPosition(), SubmitGate(), SupportsMPSSwapOptimization(), SupportsQuantumChannels(), SwapGatesRelabelQubits(), and Trim().