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:
programis a string containing the cQASM program.iterationsis the number of times the program is being simulated.seedcan be used in case a deterministic output is needed.versionis 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_pathis the file path of the cQASM program.iterationsis the number of times the program is being simulated.seedcan be used in case a deterministic output is needed.versionis the cQASM program version.
Returns either a simulation result or an error.