Namespace fomac

namespace fomac

Typedefs

template<typename T>
using remove_optional_t = typename remove_optional<T>::type

Helper type to strip std::optional from a type if it is present.

This is useful for template metaprogramming when you want to work with the underlying type of optional without caring about its optionality.

Template Parameters:

T – The type to strip optional from.

class Device
#include <FoMaC.hpp>

Class representing a quantum device.

This class provides methods to query properties of the device, its sites, and its operations.

The class can only be constructed by Session instances.

See also

QDMI_Device

Subclassed by na::Session::Device

Public Functions

std::string getName() const

See also

QDMI_DEVICE_PROPERTY_NAME

std::string getVersion() const

See also

QDMI_DEVICE_PROPERTY_VERSION

QDMI_Device_Status getStatus() const

See also

QDMI_DEVICE_PROPERTY_STATUS

std::string getLibraryVersion() const

See also

QDMI_DEVICE_PROPERTY_LIBRARYVERSION

size_t getQubitsNum() const

See also

QDMI_DEVICE_PROPERTY_QUBITSNUM

std::vector<Site> getSites() const

See also

QDMI_DEVICE_PROPERTY_SITES

std::vector<Site> getRegularSites() const

Returns the list of regular sites (without zone sites) available on the device.

Filters all sites and only returns regular sites, i.e., where isZone() yields false. These represent actual potential physical qubit locations on the device lattice.

See also

QDMI_DEVICE_PROPERTY_SITES

Returns:

vector of regular sites

std::vector<Site> getZones() const

Returns the list of zone sites (without regular sites) available on the device.

Filters all sites and only returns zone sites, i.e., where isZone() yields true. These represent a zone, i.e., an extent where zoned operations can be performed, not individual qubit locations.

See also

QDMI_DEVICE_PROPERTY_SITES

Returns:

a vector of zone sites

std::vector<Operation> getOperations() const

See also

QDMI_DEVICE_PROPERTY_OPERATIONS

std::optional<std::vector<std::pair<Site, Site>>> getCouplingMap() const

See also

QDMI_DEVICE_PROPERTY_COUPLINGMAP

std::optional<size_t> getNeedsCalibration() const

See also

QDMI_DEVICE_PROPERTY_NEEDSCALIBRATION

std::optional<std::string> getLengthUnit() const

See also

QDMI_DEVICE_PROPERTY_LENGTHUNIT

std::optional<double> getLengthScaleFactor() const

See also

QDMI_DEVICE_PROPERTY_LENGTHSCALEFACTOR

std::optional<std::string> getDurationUnit() const

See also

QDMI_DEVICE_PROPERTY_DURATIONUNIT

std::optional<double> getDurationScaleFactor() const

See also

QDMI_DEVICE_PROPERTY_DURATIONSCALEFACTOR

std::optional<uint64_t> getMinAtomDistance() const

See also

QDMI_DEVICE_PROPERTY_MINATOMDISTANCE

std::vector<QDMI_Program_Format> getSupportedProgramFormats() const

See also

QDMI_DEVICE_PROPERTY_SUPPORTEDPROGRAMFORMATS

Job submitJob(const std::string &program, QDMI_Program_Format format, size_t numShots) const

See also

QDMI_job_submit

class Job
#include <FoMaC.hpp>

Class representing a submitted job.

This class provides methods to query job status and retrieve results.

The class can only be constructed by Device instances.

See also

QDMI_Job

Public Functions

QDMI_Job_Status check() const

See also

QDMI_job_check

bool wait(size_t timeout = 0) const

See also

QDMI_job_wait

Parameters:

timeout – The maximum time to wait in seconds. 0 (default) means wait indefinitely.

Returns:

true if the job completed successfully, false if it timed out

void cancel() const

See also

QDMI_job_cancel

std::string getId() const

Get the job ID.

QDMI_Program_Format getProgramFormat() const

Get the program format.

std::string getProgram() const

Get the program to be executed.

size_t getNumShots() const

Get the number of shots.

std::vector<std::string> getShots() const

Returns the measurement shots as a vector of bitstrings.

See also

QDMI_JOB_RESULT_SHOTS

std::map<std::string, size_t> getCounts() const

Returns a map of measurement outcomes to their respective counts.

See also

QDMI_JOB_RESULT_HIST_KEYS

See also

QDMI_JOB_RESULT_HIST_VALUES

std::vector<std::complex<double>> getDenseStateVector() const

Returns the dense state vector as a vector of complex numbers.

See also

QDMI_JOB_RESULT_STATEVECTOR_DENSE

std::vector<double> getDenseProbabilities() const

Returns the dense probabilities as a vector of doubles.

See also

QDMI_JOB_RESULT_PROBABILITIES_DENSE

std::map<std::string, std::complex<double>> getSparseStateVector() const

Returns the sparse state vector as a map of bitstrings to complex amplitudes.

See also

QDMI_JOB_RESULT_STATEVECTOR_SPARSE_KEYS

See also

QDMI_JOB_RESULT_STATEVECTOR_SPARSE_VALUES

std::map<std::string, double> getSparseProbabilities() const

Returns the sparse probabilities as a map of bitstrings to probabilities.

See also

QDMI_JOB_RESULT_PROBABILITIES_SPARSE_KEYS

See also

QDMI_JOB_RESULT_PROBABILITIES_SPARSE_VALUES

class Operation
#include <FoMaC.hpp>

Class representing an operation (gate) supported by the device.

This class provides methods to query properties of the operation.

The class can only be constructed by Device instances.

See also

QDMI_Operation

Public Functions

std::string getName(const std::vector<Site> &sites = {}, const std::vector<double> &params = {}) const

See also

QDMI_OPERATION_PROPERTY_NAME

std::optional<size_t> getQubitsNum(const std::vector<Site> &sites = {}, const std::vector<double> &params = {}) const

See also

QDMI_OPERATION_PROPERTY_QUBITSNUM

size_t getParametersNum(const std::vector<Site> &sites = {}, const std::vector<double> &params = {}) const

See also

QDMI_OPERATION_PROPERTY_PARAMETERSNUM

std::optional<uint64_t> getDuration(const std::vector<Site> &sites = {}, const std::vector<double> &params = {}) const

See also

QDMI_OPERATION_PROPERTY_DURATION

std::optional<double> getFidelity(const std::vector<Site> &sites = {}, const std::vector<double> &params = {}) const

See also

QDMI_OPERATION_PROPERTY_FIDELITY

std::optional<uint64_t> getInteractionRadius(const std::vector<Site> &sites = {}, const std::vector<double> &params = {}) const

See also

QDMI_OPERATION_PROPERTY_INTERACTIONRADIUS

std::optional<uint64_t> getBlockingRadius(const std::vector<Site> &sites = {}, const std::vector<double> &params = {}) const

See also

QDMI_OPERATION_PROPERTY_BLOCKINGRADIUS

std::optional<double> getIdlingFidelity(const std::vector<Site> &sites = {}, const std::vector<double> &params = {}) const

See also

QDMI_OPERATION_PROPERTY_IDLINGFIDELITY

bool isZoned() const

See also

QDMI_OPERATION_PROPERTY_ISZONED

std::optional<std::vector<Site>> getSites() const

See also

QDMI_OPERATION_PROPERTY_SITES

std::optional<std::vector<std::pair<Site, Site>>> getSitePairs() const

Returns the list of site pairs the local 2-qubit operation can be performed on.

For local 2-qubit operations, this function interprets the returned list of sites by QDMI as site pairs according to the QDMI specification. Hence, this function facilitates easier iteration over supported site pairs.

See also

QDMI_OPERATION_PROPERTY_SITES

Returns:

Optional vector of site pairs if this is a local 2-qubit operation, std::nullopt otherwise.

std::optional<uint64_t> getMeanShuttlingSpeed(const std::vector<Site> &sites = {}, const std::vector<double> &params = {}) const

See also

QDMI_OPERATION_PROPERTY_MEANSHUTTLINGSPEED

template<typename T>
struct remove_optional
#include <FoMaC.hpp>

See also

remove_optional_t

class Session
#include <FoMaC.hpp>

Class representing the Session library.

This class provides methods to query available devices and manage the QDMI session.

See also

QDMI_Session

Public Functions

explicit Session(const SessionConfig &config = {})

Constructs a new QDMI Session with optional authentication.

Creates, allocates, and initializes a new QDMI session.

Parameters:

config – Optional session configuration containing authentication parameters. If not provided, uses default (no authentication).

std::vector<Device> getDevices()

See also

QDMI_SESSION_PROPERTY_DEVICES

Public Static Functions

static Device createSessionlessDevice(QDMI_Device device)

Creates a Device object from a QDMI_Device handle.

Note

This is a factory method for use in bindings where a session is not accessible.

Parameters:

device – The QDMI_Device handle to wrap.

Returns:

A Device object wrapping the given handle.

struct SessionConfig
#include <FoMaC.hpp>

Configuration structure for session authentication parameters.

All parameters are optional. Only set the parameters needed for your authentication method. Parameters are validated when the session is constructed.

Public Members

std::optional<std::string> token

Authentication token.

std::optional<std::string> authFile

Path to file containing authentication information.

std::optional<std::string> authUrl

URL to authentication server.

std::optional<std::string> username

Username for authentication.

std::optional<std::string> password

Password for authentication.

std::optional<std::string> projectId

Project ID for session.

std::optional<std::string> custom1

Custom configuration parameter 1.

std::optional<std::string> custom2

Custom configuration parameter 2.

std::optional<std::string> custom3

Custom configuration parameter 3.

std::optional<std::string> custom4

Custom configuration parameter 4.

std::optional<std::string> custom5

Custom configuration parameter 5.

class Site
#include <FoMaC.hpp>

Class representing a site (qubit) on the device.

This class provides methods to query properties of the site.

The class can only be constructed by Device and Operation instances.

See also

QDMI_Site

Public Functions

size_t getIndex() const

See also

QDMI_SITE_PROPERTY_INDEX

std::optional<uint64_t> getT1() const

See also

QDMI_SITE_PROPERTY_T1

std::optional<uint64_t> getT2() const

See also

QDMI_SITE_PROPERTY_T2

std::optional<std::string> getName() const

See also

QDMI_SITE_PROPERTY_NAME

std::optional<int64_t> getXCoordinate() const

See also

QDMI_SITE_PROPERTY_XCOORDINATE

std::optional<int64_t> getYCoordinate() const

See also

QDMI_SITE_PROPERTY_YCOORDINATE

std::optional<int64_t> getZCoordinate() const

See also

QDMI_SITE_PROPERTY_ZCOORDINATE

bool isZone() const

See also

QDMI_SITE_PROPERTY_ISZONE

std::optional<uint64_t> getXExtent() const

See also

QDMI_SITE_PROPERTY_XEXTENT

std::optional<uint64_t> getYExtent() const

See also

QDMI_SITE_PROPERTY_YEXTENT

std::optional<uint64_t> getZExtent() const

See also

QDMI_SITE_PROPERTY_ZEXTENT

std::optional<uint64_t> getModuleIndex() const

See also

QDMI_SITE_PROPERTY_MODULEINDEX

std::optional<uint64_t> getSubmoduleIndex() const

See also

QDMI_SITE_PROPERTY_SUBMODULEINDEX