C++

QX simulator allows simulating a cQASM program via two APIs: execute_string and execute_file.

These functions are implemented in C++ code, and thus visible through a C++ header file: include/qx/qxelarator.hpp.

std::variant<std::monostate, qx::SimulationResult, qx::SimulationError> execute_string(const std::string& program, std::size_t iterations, std::optional<std::uint_fast64_t> seed, std::string version);

Simulates a cQASM program from a string.

Parameters:

  • program is a string containing the cQASM program.

  • iterations is the number of times the program is being simulated.

  • seed can be used in case a deterministic output is needed.

  • version is the cQASM program version.

Returns either a simulation result or an error.

std::variant<std::monostate, qx::SimulationResult, qx::SimulationError> execute_file(const std::string& file_path, std::size_t iterations, std::optional<std::uint_fast64_t> seed, std::string version);

Simulates a cQASM program from a file.

Parameters:

  • file_path is the file path of the cQASM program.

  • iterations is the number of times the program is being simulated.

  • seed can be used in case a deterministic output is needed.

  • version is the cQASM program version.

Returns either a simulation result or an error.