qsim::QSimRunner

#include <run_qsim.h>

Helper struct for running qsim.

Summary

Public types

MeasurementResult using
State using
typename StateSpace::State
StateSpace using

Public static functions

Run(const Parameter & param, const Circuit & circuit, MeasurementFunc measure)
bool
Runs the given circuit, only measuring at the end.
Run(const Parameter & param, const std::vector< unsigned > & times_to_measure_at, const Circuit & circuit, MeasurementFunc measure)
bool
Runs the given circuit, measuring at user-specified times.
Run(const Parameter & param, const Circuit & circuit, State & state, std::vector< MeasurementResult > & measure_results)
bool
Runs the given circuit and make the final state available to the caller, recording the result of any intermediate measurements in the circuit.
Run(const Parameter & param, const Circuit & circuit, State & state)
bool
Runs the given circuit and make the final state available to the caller, discarding the result of any intermediate measurements in the circuit.

Structs

qsim::QSimRunner::Parameter

User-specified parameters for gate fusion and simulation.

Public types

MeasurementResult

typename StateSpace::MeasurementResult qsim::QSimRunner::MeasurementResult

State

typename StateSpace::State qsim::QSimRunner::State

StateSpace

typename Simulator::StateSpace qsim::QSimRunner::StateSpace

Public static functions

Run

bool qsim::QSimRunner::Run(
  const Parameter & param,
  const Circuit & circuit,
  MeasurementFunc measure
)

Runs the given circuit, only measuring at the end.

Details
Parameters
param
Options for gate fusion, parallelism and logging.
circuit
The circuit to be simulated.
measure
Function that performs measurements (in the sense of computing expectation values, etc).
Returns
True if the simulation completed successfully; false otherwise.

Run

bool qsim::QSimRunner::Run(
  const Parameter & param,
  const std::vector< unsigned > & times_to_measure_at,
  const Circuit & circuit,
  MeasurementFunc measure
)

Runs the given circuit, measuring at user-specified times.

Details
Parameters
param
Options for gate fusion, parallelism and logging.
times_to_measure_at
Time steps at which to perform measurements.
circuit
The circuit to be simulated.
measure
Function that performs measurements (in the sense of computing expectation values, etc).
Returns
True if the simulation completed successfully; false otherwise.

Run

bool qsim::QSimRunner::Run(
  const Parameter & param,
  const Circuit & circuit,
  State & state,
  std::vector< MeasurementResult > & measure_results
)

Runs the given circuit and make the final state available to the caller, recording the result of any intermediate measurements in the circuit.

Details
Parameters
param
Options for gate fusion, parallelism and logging.
circuit
The circuit to be simulated.
state
As an input parameter, this should contain the initial state of the system. After a successful run, it will be populated with the final state of the system.
measure_results
As an input parameter, this should be empty. After a successful run, this will contain all measurements results from the run, ordered by time and qubit index.
Returns
True if the simulation completed successfully; false otherwise.

Run

bool qsim::QSimRunner::Run(
  const Parameter & param,
  const Circuit & circuit,
  State & state
)

Runs the given circuit and make the final state available to the caller, discarding the result of any intermediate measurements in the circuit.

Details
Parameters
param
Options for gate fusion, parallelism and logging.
circuit
The circuit to be simulated.
state
As an input parameter, this should contain the initial state of the system. After a successful run, it will be populated with the final state of the system.
Returns
True if the simulation completed successfully; false otherwise.