Namespace sc

namespace sc

Functions

auto writeJSONSchema(std::ostream &os) -> void

Writes a JSON schema with default values for the device configuration to the specified output stream.

Parameters:

os – is the output stream to write the JSON schema to.

Throws:

std::runtime_error – if the JSON conversion fails.

auto writeJSONSchema(const std::string &path) -> void

Writes a JSON schema with default values for the device configuration to the specified path.

Parameters:

path – The path to write the JSON schema to.

Throws:

std::runtime_error – if the JSON conversion fails or the file cannot be opened.

auto readJSON(std::istream &is) -> Device

Parses the device configuration from an input stream.

Parameters:

is – is the input stream containing the JSON representation of the device configuration.

Throws:

std::runtime_error – if the JSON cannot be parsed.

Returns:

The parsed device configuration as a sc::Device object.

auto readJSON(const std::string &path) -> Device

Parses the device configuration from a JSON file.

Parameters:

path – is the path to the JSON file containing the device configuration.

Throws:

std::runtime_error – if the JSON file does not exist, or the JSON file cannot be parsed.

Returns:

The parsed device configuration as a sc::Device object.

auto writeHeader(const Device &device, std::ostream &os) -> void

Writes a header file with the device configuration to the specified output stream.

Note

This implementation only supports multi-qubit gates up to two qubits.

Parameters:
  • device – is a parsed and in-memory representation of the device.

  • os – is the output stream to write the header file to.

Throws:

std::runtime_error – if the file cannot be opened or written to.

auto writeHeader(const Device &device, const std::string &path) -> void

Writes a header file with the device configuration to the specified path.

Note

This implementation only supports multi-qubit gates up to two qubits.

Parameters:
  • device – is a parsed and in-memory representation of the device.

  • path – is the path to write the header file to.

Throws:

std::runtime_error – if the file cannot be opened or written to.

struct Device
#include <Generator.hpp>

Represents a superconducting device configuration.

This struct defines the schema for the JSON representation of a superconducting device configuration. This struct, including all its sub-structs, implements functions to serialize and deserialize to and from JSON using the nlohmann::json library.

Public Members

std::string name

The name of the device.

uint64_t numQubits = 0

The number of qubits in the device.

std::vector<std::pair<uint64_t, uint64_t>> couplings

The list of couplings the device supports.

std::vector<Operation> operations

The list of operations the device supports.