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.
-
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
Subclassed by na::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).
-
~Session()¶
Destructor that releases the QDMI session.
-
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.
See also
QDMI_Device
Subclassed by na::Session::Device
Public Functions
-
inline Device(Session::Token, QDMI_Device device)¶
Constructs a Device object from a QDMI_Device handle.
- Parameters:
device – The QDMI_Device handle to wrap.
-
inline auto getQDMIDevice() const -> QDMI_Device¶
- Returns:
the underlying QDMI_Device object.
-
auto getName() const -> std::string¶
See also
QDMI_DEVICE_PROPERTY_NAME
-
auto getVersion() const -> std::string¶
See also
QDMI_DEVICE_PROPERTY_VERSION
-
auto getStatus() const -> QDMI_Device_Status¶
See also
QDMI_DEVICE_PROPERTY_STATUS
-
auto getLibraryVersion() const -> std::string¶
See also
QDMI_DEVICE_PROPERTY_LIBRARYVERSION
-
auto getQubitsNum() const -> size_t¶
See also
QDMI_DEVICE_PROPERTY_QUBITSNUM
-
auto getRegularSites() const -> std::vector<Site>¶
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()yieldsfalse. These represent actual potential physical qubit locations on the device lattice.See also
QDMI_DEVICE_PROPERTY_SITES
- Returns:
vector of regular sites
-
auto getZones() const -> std::vector<Site>¶
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()yieldstrue. 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
-
auto getCouplingMap() const -> std::optional<std::vector<std::pair<Site, Site>>>¶
See also
QDMI_DEVICE_PROPERTY_COUPLINGMAP
-
auto getNeedsCalibration() const -> std::optional<size_t>¶
See also
QDMI_DEVICE_PROPERTY_NEEDSCALIBRATION
-
auto getLengthUnit() const -> std::optional<std::string>¶
See also
QDMI_DEVICE_PROPERTY_LENGTHUNIT
-
auto getLengthScaleFactor() const -> std::optional<double>¶
See also
QDMI_DEVICE_PROPERTY_LENGTHSCALEFACTOR
-
auto getDurationUnit() const -> std::optional<std::string>¶
See also
QDMI_DEVICE_PROPERTY_DURATIONUNIT
-
auto getDurationScaleFactor() const -> std::optional<double>¶
See also
QDMI_DEVICE_PROPERTY_DURATIONSCALEFACTOR
-
auto getMinAtomDistance() const -> std::optional<uint64_t>¶
See also
QDMI_DEVICE_PROPERTY_MINATOMDISTANCE
-
auto getSupportedProgramFormats() const -> std::vector<QDMI_Program_Format>¶
See also
QDMI_DEVICE_PROPERTY_SUPPORTEDPROGRAMFORMATS
Public Static Functions
-
static inline auto fromQDMIDevice(QDMI_Device device) -> Device¶
Creates a Device object from a QDMI_Device handle.
Note
This is a factory method for use in bindings where Token construction is not accessible.
- Parameters:
device – The QDMI_Device handle to wrap.
- Returns:
A Device object wrapping the given handle.
-
class Operation¶
- #include <FoMaC.hpp>
Class representing an operation (gate) supported by the device.
This class provides methods to query properties of the operation.
See also
QDMI_Operation
Public Functions
-
inline Operation(Token, QDMI_Device device, QDMI_Operation operation)¶
Constructs an Operation object from a QDMI_Operation handle.
- Parameters:
device – The associated QDMI_Device handle.
operation – The QDMI_Operation handle to wrap.
-
inline auto getQDMIOperation() const -> QDMI_Operation¶
- Returns:
the underlying QDMI_Operation object.
-
auto getName(const std::vector<Site> &sites = {}, const std::vector<double> ¶ms = {}) const -> std::string¶
See also
QDMI_OPERATION_PROPERTY_NAME
-
auto getQubitsNum(const std::vector<Site> &sites = {}, const std::vector<double> ¶ms = {}) const -> std::optional<size_t>¶
See also
QDMI_OPERATION_PROPERTY_QUBITSNUM
-
auto getParametersNum(const std::vector<Site> &sites = {}, const std::vector<double> ¶ms = {}) const -> size_t¶
See also
QDMI_OPERATION_PROPERTY_PARAMETERSNUM
-
auto getDuration(const std::vector<Site> &sites = {}, const std::vector<double> ¶ms = {}) const -> std::optional<uint64_t>¶
See also
QDMI_OPERATION_PROPERTY_DURATION
-
auto getFidelity(const std::vector<Site> &sites = {}, const std::vector<double> ¶ms = {}) const -> std::optional<double>¶
See also
QDMI_OPERATION_PROPERTY_FIDELITY
-
auto getInteractionRadius(const std::vector<Site> &sites = {}, const std::vector<double> ¶ms = {}) const -> std::optional<uint64_t>¶
See also
QDMI_OPERATION_PROPERTY_INTERACTIONRADIUS
-
auto getBlockingRadius(const std::vector<Site> &sites = {}, const std::vector<double> ¶ms = {}) const -> std::optional<uint64_t>¶
See also
QDMI_OPERATION_PROPERTY_BLOCKINGRADIUS
-
auto getIdlingFidelity(const std::vector<Site> &sites = {}, const std::vector<double> ¶ms = {}) const -> std::optional<double>¶
See also
QDMI_OPERATION_PROPERTY_IDLINGFIDELITY
-
auto isZoned() const -> bool¶
See also
QDMI_OPERATION_PROPERTY_ISZONED
-
auto getSitePairs() const -> std::optional<std::vector<std::pair<Site, Site>>>¶
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.
-
inline Operation(Token, QDMI_Device device, QDMI_Operation operation)¶
-
class Site¶
- #include <FoMaC.hpp>
Class representing a site (qubit) on the device.
This class provides methods to query properties of the site.
See also
QDMI_Site
Public Functions
-
inline Site(Token, QDMI_Device device, QDMI_Site site)¶
Constructs a Site object from a QDMI_Site handle.
- Parameters:
device – The associated QDMI_Device handle.
site – The QDMI_Site handle to wrap.
-
inline auto getQDMISite() const -> QDMI_Site¶
- Returns:
the underlying QDMI_Site object.
-
auto getIndex() const -> size_t¶
See also
QDMI_SITE_PROPERTY_INDEX
-
auto getT1() const -> std::optional<uint64_t>¶
See also
QDMI_SITE_PROPERTY_T1
-
auto getT2() const -> std::optional<uint64_t>¶
See also
QDMI_SITE_PROPERTY_T2
-
auto getName() const -> std::optional<std::string>¶
See also
QDMI_SITE_PROPERTY_NAME
-
auto getXCoordinate() const -> std::optional<int64_t>¶
See also
QDMI_SITE_PROPERTY_XCOORDINATE
-
auto getYCoordinate() const -> std::optional<int64_t>¶
See also
QDMI_SITE_PROPERTY_YCOORDINATE
-
auto getZCoordinate() const -> std::optional<int64_t>¶
See also
QDMI_SITE_PROPERTY_ZCOORDINATE
-
auto isZone() const -> bool¶
See also
QDMI_SITE_PROPERTY_ISZONE
-
auto getXExtent() const -> std::optional<uint64_t>¶
See also
QDMI_SITE_PROPERTY_XEXTENT
-
auto getYExtent() const -> std::optional<uint64_t>¶
See also
QDMI_SITE_PROPERTY_YEXTENT
-
auto getZExtent() const -> std::optional<uint64_t>¶
See also
QDMI_SITE_PROPERTY_ZEXTENT
-
auto getModuleIndex() const -> std::optional<uint64_t>¶
See also
QDMI_SITE_PROPERTY_MODULEINDEX
-
auto getSubmoduleIndex() const -> std::optional<uint64_t>¶
See also
QDMI_SITE_PROPERTY_SUBMODULEINDEX
-
inline Site(Token, QDMI_Device device, QDMI_Site site)¶
-
inline Device(Session::Token, QDMI_Device device)¶
-
class Job¶
- #include <FoMaC.hpp>
Class representing a submitted job.
This class provides methods to query job status and retrieve results.
See also
QDMI_Job
Public Functions
-
inline explicit Job(QDMI_Job job)¶
Constructs a Job object from a QDMI_Job handle.
- Parameters:
job – The QDMI_Job handle to wrap.
-
inline ~Job()¶
Destructor that releases the underlying QDMI_Job resource.
-
inline auto getQDMIJob() const -> QDMI_Job¶
- Returns:
the underlying QDMI_Job object.
-
auto check() const -> QDMI_Job_Status¶
See also
QDMI_job_check
-
auto wait(size_t timeout = 0) const -> bool¶
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
-
auto cancel() const -> void¶
See also
QDMI_job_cancel
-
auto getId() const -> std::string¶
Get the job ID.
-
auto getProgramFormat() const -> QDMI_Program_Format¶
Get the program format.
-
auto getProgram() const -> std::string¶
Get the program to be executed.
-
auto getNumShots() const -> size_t¶
Get the number of shots.
-
auto getShots() const -> std::vector<std::string>¶
Returns the measurement shots as a vector of bitstrings.
See also
QDMI_JOB_RESULT_SHOTS
-
auto getCounts() const -> std::map<std::string, size_t>¶
Returns a map of measurement outcomes to their respective counts.
See also
QDMI_JOB_RESULT_HIST_KEYS
See also
QDMI_JOB_RESULT_HIST_VALUES
-
auto getDenseStateVector() const -> std::vector<std::complex<double>>¶
Returns the dense state vector as a vector of complex numbers.
See also
QDMI_JOB_RESULT_STATEVECTOR_DENSE
-
auto getDenseProbabilities() const -> std::vector<double>¶
Returns the dense probabilities as a vector of doubles.
See also
QDMI_JOB_RESULT_PROBABILITIES_DENSE
-
auto getSparseStateVector() const -> std::map<std::string, std::complex<double>>¶
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
-
auto getSparseProbabilities() const -> std::map<std::string, double>¶
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
-
inline explicit Job(QDMI_Job job)¶
-
explicit Session(const SessionConfig &config = {})¶
-
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.
-
std::optional<std::string> token¶
-
template<typename T>