Removed the SAL annotations. (#989)
This commit is contained in:
Родитель
07fb90aac0
Коммит
ad38c5ed4f
|
@ -13,13 +13,7 @@
|
|||
#include <chrono>
|
||||
#include <cstdint>
|
||||
|
||||
// clang-format off
|
||||
#pragma clang diagnostic push
|
||||
// Ignore warnings for reserved macro names `_In_`, `_In_reads_(n)`:
|
||||
#pragma clang diagnostic ignored "-Wreserved-id-macro"
|
||||
#include "capi.hpp"
|
||||
#pragma clang diagnostic pop
|
||||
// clang-format on
|
||||
#include "capi.hpp"
|
||||
|
||||
|
||||
#include "FloatUtils.hpp"
|
||||
|
|
|
@ -15,27 +15,27 @@ extern "C"
|
|||
return Microsoft::Quantum::Simulator::create();
|
||||
}
|
||||
|
||||
MICROSOFT_QUANTUM_DECL void destroy(_In_ unsigned id)
|
||||
MICROSOFT_QUANTUM_DECL void destroy(unsigned id)
|
||||
{
|
||||
Microsoft::Quantum::Simulator::destroy(id);
|
||||
}
|
||||
|
||||
MICROSOFT_QUANTUM_DECL void seed(_In_ unsigned id, _In_ unsigned s)
|
||||
MICROSOFT_QUANTUM_DECL void seed(unsigned id, unsigned s)
|
||||
{
|
||||
Microsoft::Quantum::Simulator::get(id)->seed(s);
|
||||
}
|
||||
|
||||
// non-quantum
|
||||
MICROSOFT_QUANTUM_DECL std::size_t random_choice(_In_ unsigned id, _In_ std::size_t n, _In_reads_(n) double* p)
|
||||
MICROSOFT_QUANTUM_DECL std::size_t random_choice(unsigned id, std::size_t n, double* p)
|
||||
{
|
||||
return Microsoft::Quantum::Simulator::get(id)->random(n, p);
|
||||
}
|
||||
|
||||
MICROSOFT_QUANTUM_DECL double JointEnsembleProbability(
|
||||
_In_ unsigned id,
|
||||
_In_ unsigned n,
|
||||
_In_reads_(n) int* b,
|
||||
_In_reads_(n) unsigned* q)
|
||||
unsigned id,
|
||||
unsigned n,
|
||||
int* b,
|
||||
unsigned* q)
|
||||
{
|
||||
std::vector<Gates::Basis> bv;
|
||||
bv.reserve(n);
|
||||
|
@ -46,11 +46,11 @@ extern "C"
|
|||
}
|
||||
|
||||
MICROSOFT_QUANTUM_DECL bool InjectState(
|
||||
_In_ unsigned sid,
|
||||
_In_ unsigned n,
|
||||
_In_reads_(n) unsigned* q,
|
||||
_In_ double* re,
|
||||
_In_ double* im)
|
||||
unsigned sid,
|
||||
unsigned n,
|
||||
unsigned* q,
|
||||
double* re,
|
||||
double* im)
|
||||
{
|
||||
const size_t N = (static_cast<size_t>(1) << n);
|
||||
std::vector<ComplexType> amplitudes;
|
||||
|
@ -64,30 +64,30 @@ extern "C"
|
|||
return Microsoft::Quantum::Simulator::get(sid)->InjectState(qubits, amplitudes);
|
||||
}
|
||||
|
||||
MICROSOFT_QUANTUM_DECL void allocateQubit(_In_ unsigned id, _In_ unsigned q)
|
||||
MICROSOFT_QUANTUM_DECL void allocateQubit(unsigned id, unsigned q)
|
||||
{
|
||||
Microsoft::Quantum::Simulator::get(id)->allocateQubit(q);
|
||||
}
|
||||
|
||||
MICROSOFT_QUANTUM_DECL bool release(_In_ unsigned id, _In_ unsigned q)
|
||||
MICROSOFT_QUANTUM_DECL bool release(unsigned id, unsigned q)
|
||||
{
|
||||
// The underlying simulator function will return True if and only if the qubit being released
|
||||
// was in the ground state prior to release.
|
||||
return Microsoft::Quantum::Simulator::get(id)->release(q);
|
||||
}
|
||||
|
||||
MICROSOFT_QUANTUM_DECL unsigned num_qubits(_In_ unsigned id)
|
||||
MICROSOFT_QUANTUM_DECL unsigned num_qubits(unsigned id)
|
||||
{
|
||||
return Microsoft::Quantum::Simulator::get(id)->num_qubits();
|
||||
}
|
||||
|
||||
#define FWDGATE1(G) \
|
||||
MICROSOFT_QUANTUM_DECL void G(_In_ unsigned id, _In_ unsigned q) \
|
||||
MICROSOFT_QUANTUM_DECL void G(unsigned id, unsigned q) \
|
||||
{ \
|
||||
Microsoft::Quantum::Simulator::get(id)->G(q); \
|
||||
}
|
||||
#define FWDCSGATE1(G) \
|
||||
MICROSOFT_QUANTUM_DECL void MC##G(_In_ unsigned id, _In_ unsigned n, _In_reads_(n) unsigned* c, _In_ unsigned q) \
|
||||
MICROSOFT_QUANTUM_DECL void MC##G(unsigned id, unsigned n, unsigned* c, unsigned q) \
|
||||
{ \
|
||||
std::vector<unsigned> vc(c, c + n); \
|
||||
Microsoft::Quantum::Simulator::get(id)->C##G(vc, q); \
|
||||
|
@ -112,19 +112,19 @@ extern "C"
|
|||
|
||||
// rotations
|
||||
|
||||
MICROSOFT_QUANTUM_DECL void R(_In_ unsigned id, _In_ unsigned b, _In_ double phi, _In_ unsigned q)
|
||||
MICROSOFT_QUANTUM_DECL void R(unsigned id, unsigned b, double phi, unsigned q)
|
||||
{
|
||||
Microsoft::Quantum::Simulator::get(id)->R(static_cast<Gates::Basis>(b), phi, q);
|
||||
}
|
||||
|
||||
// multi-controlled rotations
|
||||
MICROSOFT_QUANTUM_DECL void MCR(
|
||||
_In_ unsigned id,
|
||||
_In_ unsigned b,
|
||||
_In_ double phi,
|
||||
_In_ unsigned nc,
|
||||
_In_reads_(nc) unsigned* c,
|
||||
_In_ unsigned q)
|
||||
unsigned id,
|
||||
unsigned b,
|
||||
double phi,
|
||||
unsigned nc,
|
||||
unsigned* c,
|
||||
unsigned q)
|
||||
{
|
||||
std::vector<unsigned> cv(c, c + nc);
|
||||
Microsoft::Quantum::Simulator::get(id)->CR(static_cast<Gates::Basis>(b), phi, cv, q);
|
||||
|
@ -132,11 +132,11 @@ extern "C"
|
|||
|
||||
// Exponential of Pauli operators
|
||||
MICROSOFT_QUANTUM_DECL void Exp(
|
||||
_In_ unsigned id,
|
||||
_In_ unsigned n,
|
||||
_In_reads_(n) unsigned* b,
|
||||
_In_ double phi,
|
||||
_In_reads_(n) unsigned* q)
|
||||
unsigned id,
|
||||
unsigned n,
|
||||
unsigned* b,
|
||||
double phi,
|
||||
unsigned* q)
|
||||
{
|
||||
std::vector<Gates::Basis> bv;
|
||||
for (unsigned i = 0; i < n; ++i)
|
||||
|
@ -145,13 +145,13 @@ extern "C"
|
|||
Microsoft::Quantum::Simulator::get(id)->Exp(bv, phi, qv);
|
||||
}
|
||||
MICROSOFT_QUANTUM_DECL void MCExp(
|
||||
_In_ unsigned id,
|
||||
_In_ unsigned n,
|
||||
_In_reads_(n) unsigned* b,
|
||||
_In_ double phi,
|
||||
_In_ unsigned nc,
|
||||
_In_reads_(nc) unsigned* c,
|
||||
_In_reads_(n) unsigned* q)
|
||||
unsigned id,
|
||||
unsigned n,
|
||||
unsigned* b,
|
||||
double phi,
|
||||
unsigned nc,
|
||||
unsigned* c,
|
||||
unsigned* q)
|
||||
{
|
||||
std::vector<Gates::Basis> bv;
|
||||
for (unsigned i = 0; i < n; ++i)
|
||||
|
@ -162,15 +162,15 @@ extern "C"
|
|||
}
|
||||
|
||||
// measurements
|
||||
MICROSOFT_QUANTUM_DECL unsigned M(_In_ unsigned id, _In_ unsigned q)
|
||||
MICROSOFT_QUANTUM_DECL unsigned M(unsigned id, unsigned q)
|
||||
{
|
||||
return (unsigned)Microsoft::Quantum::Simulator::get(id)->M(q);
|
||||
}
|
||||
MICROSOFT_QUANTUM_DECL unsigned Measure(
|
||||
_In_ unsigned id,
|
||||
_In_ unsigned n,
|
||||
_In_reads_(n) unsigned* b,
|
||||
_In_reads_(n) unsigned* q)
|
||||
unsigned id,
|
||||
unsigned n,
|
||||
unsigned* b,
|
||||
unsigned* q)
|
||||
{
|
||||
std::vector<Gates::Basis> bv;
|
||||
for (unsigned i = 0; i < n; ++i)
|
||||
|
@ -181,54 +181,54 @@ extern "C"
|
|||
|
||||
// apply permutation of basis states to the wave function
|
||||
MICROSOFT_QUANTUM_DECL void PermuteBasis(
|
||||
_In_ unsigned id,
|
||||
_In_ unsigned n,
|
||||
_In_reads_(n) unsigned* q,
|
||||
_In_ std::size_t table_size,
|
||||
_In_reads_(table_size) std::size_t* permutation_table)
|
||||
unsigned id,
|
||||
unsigned n,
|
||||
unsigned* q,
|
||||
std::size_t table_size,
|
||||
std::size_t* permutation_table)
|
||||
{
|
||||
const std::vector<unsigned> qs(q, q + n);
|
||||
Microsoft::Quantum::Simulator::get(id)->permuteBasis(qs, table_size, permutation_table, false);
|
||||
}
|
||||
MICROSOFT_QUANTUM_DECL void AdjPermuteBasis(
|
||||
_In_ unsigned id,
|
||||
_In_ unsigned n,
|
||||
_In_reads_(n) unsigned* q,
|
||||
_In_ std::size_t table_size,
|
||||
_In_reads_(table_size) std::size_t* permutation_table)
|
||||
unsigned id,
|
||||
unsigned n,
|
||||
unsigned* q,
|
||||
std::size_t table_size,
|
||||
std::size_t* permutation_table)
|
||||
{
|
||||
const std::vector<unsigned> qs(q, q + n);
|
||||
Microsoft::Quantum::Simulator::get(id)->permuteBasis(qs, table_size, permutation_table, true);
|
||||
}
|
||||
|
||||
// dump wavefunction to given callback until callback returns false
|
||||
MICROSOFT_QUANTUM_DECL void Dump(_In_ unsigned id, _In_ bool (*callback)(const char*, double, double))
|
||||
MICROSOFT_QUANTUM_DECL void Dump(unsigned id, bool (*callback)(const char*, double, double))
|
||||
{
|
||||
Microsoft::Quantum::Simulator::get(id)->dump(callback);
|
||||
}
|
||||
|
||||
MICROSOFT_QUANTUM_DECL void DumpToLocation(_In_ unsigned id, _In_ TDumpToLocationCallback callback, _In_ TDumpLocation location)
|
||||
MICROSOFT_QUANTUM_DECL void DumpToLocation(unsigned id, TDumpToLocationCallback callback, TDumpLocation location)
|
||||
{
|
||||
Microsoft::Quantum::Simulator::get(id)->dump(callback, location);
|
||||
}
|
||||
|
||||
// dump the wavefunction of the subset of qubits to the given callback returns false
|
||||
MICROSOFT_QUANTUM_DECL bool DumpQubits(
|
||||
_In_ unsigned id,
|
||||
_In_ unsigned n,
|
||||
_In_reads_(n) unsigned* q,
|
||||
_In_ bool (*callback)(const char*, double, double))
|
||||
unsigned id,
|
||||
unsigned n,
|
||||
unsigned* q,
|
||||
bool (*callback)(const char*, double, double))
|
||||
{
|
||||
std::vector<unsigned> qs(q, q + n);
|
||||
return Microsoft::Quantum::Simulator::get(id)->dumpQubits(qs, callback);
|
||||
}
|
||||
|
||||
MICROSOFT_QUANTUM_DECL bool DumpQubitsToLocation(
|
||||
_In_ unsigned id,
|
||||
_In_ unsigned n,
|
||||
_In_reads_(n) unsigned* q,
|
||||
_In_ TDumpToLocationCallback callback,
|
||||
_In_ TDumpLocation location)
|
||||
unsigned id,
|
||||
unsigned n,
|
||||
unsigned* q,
|
||||
TDumpToLocationCallback callback,
|
||||
TDumpLocation location)
|
||||
{
|
||||
std::vector<unsigned> qs(q, q + n);
|
||||
return Microsoft::Quantum::Simulator::get(id)->dumpQubits(qs, callback, location);
|
||||
|
@ -236,7 +236,7 @@ extern "C"
|
|||
|
||||
|
||||
// dump the list of logical qubit ids to given callback
|
||||
MICROSOFT_QUANTUM_DECL void DumpIds(_In_ unsigned id, _In_ void (*callback)(unsigned))
|
||||
MICROSOFT_QUANTUM_DECL void DumpIds(unsigned id, void (*callback)(unsigned))
|
||||
{
|
||||
Microsoft::Quantum::Simulator::get(id)->dumpIds(callback);
|
||||
}
|
||||
|
|
|
@ -6,34 +6,26 @@
|
|||
#include "config.hpp"
|
||||
#include <complex>
|
||||
|
||||
// SAL only defined in windows.
|
||||
#ifndef _In_
|
||||
// NOLINTNEXTLINE
|
||||
#define _In_
|
||||
// NOLINTNEXTLINE
|
||||
#define _In_reads_(n)
|
||||
#endif
|
||||
|
||||
extern "C"
|
||||
{
|
||||
// non-quantum
|
||||
|
||||
MICROSOFT_QUANTUM_DECL unsigned init(); // NOLINT
|
||||
MICROSOFT_QUANTUM_DECL void destroy(_In_ unsigned sid); // NOLINT
|
||||
MICROSOFT_QUANTUM_DECL void seed(_In_ unsigned sid, _In_ unsigned s); // NOLINT
|
||||
MICROSOFT_QUANTUM_DECL void Dump(_In_ unsigned sid, _In_ bool (*callback)(const char*, double, double));
|
||||
MICROSOFT_QUANTUM_DECL void destroy(unsigned sid); // NOLINT
|
||||
MICROSOFT_QUANTUM_DECL void seed(unsigned sid, unsigned s); // NOLINT
|
||||
MICROSOFT_QUANTUM_DECL void Dump(unsigned sid, bool (*callback)(const char*, double, double));
|
||||
MICROSOFT_QUANTUM_DECL bool DumpQubits(
|
||||
_In_ unsigned sid,
|
||||
_In_ unsigned n,
|
||||
_In_reads_(n) unsigned* q,
|
||||
_In_ bool (*callback)(const char*, double, double));
|
||||
unsigned sid,
|
||||
unsigned n,
|
||||
unsigned* q,
|
||||
bool (*callback)(const char*, double, double));
|
||||
|
||||
typedef void* TDumpLocation;
|
||||
typedef bool (*TDumpToLocationCallback)(size_t, double, double, TDumpLocation);
|
||||
// TDumpToLocationAPI is the siugnature of DumpToLocation. The caller needs to cast the address to TDumpToLocationAPI
|
||||
// to correctly call DumpToLocation from outside of this dynamic library.
|
||||
typedef void (*TDumpToLocationAPI)(unsigned sid, TDumpToLocationCallback callback, TDumpLocation location);
|
||||
MICROSOFT_QUANTUM_DECL void DumpToLocation(_In_ unsigned sid, _In_ TDumpToLocationCallback callback, _In_ TDumpLocation location);
|
||||
MICROSOFT_QUANTUM_DECL void DumpToLocation(unsigned sid, TDumpToLocationCallback callback, TDumpLocation location);
|
||||
|
||||
// TDumpQubitsToLocationAPI is the siugnature of DumpQubitsToLocation. The caller needs to cast the address to TDumpQubitsToLocationAPI
|
||||
// to correctly call DumpQubitsToLocation from outside of this dynamic library.
|
||||
|
@ -44,104 +36,104 @@ extern "C"
|
|||
TDumpToLocationCallback callback,
|
||||
TDumpLocation location);
|
||||
MICROSOFT_QUANTUM_DECL bool DumpQubitsToLocation(
|
||||
_In_ unsigned sid,
|
||||
_In_ unsigned n,
|
||||
_In_reads_(n) unsigned* q,
|
||||
_In_ TDumpToLocationCallback callback,
|
||||
_In_ TDumpLocation location);
|
||||
unsigned sid,
|
||||
unsigned n,
|
||||
unsigned* q,
|
||||
TDumpToLocationCallback callback,
|
||||
TDumpLocation location);
|
||||
|
||||
MICROSOFT_QUANTUM_DECL void DumpIds(_In_ unsigned sid, _In_ void (*callback)(unsigned));
|
||||
MICROSOFT_QUANTUM_DECL void DumpIds(unsigned sid, void (*callback)(unsigned));
|
||||
|
||||
MICROSOFT_QUANTUM_DECL std::size_t random_choice(_In_ unsigned sid, _In_ std::size_t n, _In_reads_(n) double* p); // NOLINT
|
||||
MICROSOFT_QUANTUM_DECL std::size_t random_choice(unsigned sid, std::size_t n, double* p); // NOLINT
|
||||
|
||||
MICROSOFT_QUANTUM_DECL double JointEnsembleProbability(
|
||||
_In_ unsigned sid,
|
||||
_In_ unsigned n,
|
||||
_In_reads_(n) int* b,
|
||||
_In_reads_(n) unsigned* q);
|
||||
unsigned sid,
|
||||
unsigned n,
|
||||
int* b,
|
||||
unsigned* q);
|
||||
|
||||
MICROSOFT_QUANTUM_DECL bool InjectState(
|
||||
_In_ unsigned sid,
|
||||
_In_ unsigned n,
|
||||
_In_reads_(n) unsigned* q, // The listed qubits must be unentangled and in state |0>
|
||||
_In_ double* re, // 2^n real parts of the amplitudes of the superposition the listed qubits should be put into
|
||||
_In_ double* im // 2^n imaginary parts of the amplitudes
|
||||
unsigned sid,
|
||||
unsigned n,
|
||||
unsigned* q, // The listed qubits must be unentangled and in state |0>
|
||||
double* re, // 2^n real parts of the amplitudes of the superposition the listed qubits should be put into
|
||||
double* im // 2^n imaginary parts of the amplitudes
|
||||
);
|
||||
|
||||
// allocate and release
|
||||
MICROSOFT_QUANTUM_DECL void allocateQubit(_In_ unsigned sid, _In_ unsigned qid); // NOLINT
|
||||
MICROSOFT_QUANTUM_DECL bool release(_In_ unsigned sid, _In_ unsigned q); // NOLINT
|
||||
MICROSOFT_QUANTUM_DECL unsigned num_qubits(_In_ unsigned sid); // NOLINT
|
||||
MICROSOFT_QUANTUM_DECL void allocateQubit(unsigned sid, unsigned qid); // NOLINT
|
||||
MICROSOFT_QUANTUM_DECL bool release(unsigned sid, unsigned q); // NOLINT
|
||||
MICROSOFT_QUANTUM_DECL unsigned num_qubits(unsigned sid); // NOLINT
|
||||
|
||||
// single-qubit gates
|
||||
MICROSOFT_QUANTUM_DECL void X(_In_ unsigned sid, _In_ unsigned q);
|
||||
MICROSOFT_QUANTUM_DECL void Y(_In_ unsigned sid, _In_ unsigned q);
|
||||
MICROSOFT_QUANTUM_DECL void Z(_In_ unsigned sid, _In_ unsigned q);
|
||||
MICROSOFT_QUANTUM_DECL void H(_In_ unsigned sid, _In_ unsigned q);
|
||||
MICROSOFT_QUANTUM_DECL void S(_In_ unsigned sid, _In_ unsigned q);
|
||||
MICROSOFT_QUANTUM_DECL void T(_In_ unsigned sid, _In_ unsigned q);
|
||||
MICROSOFT_QUANTUM_DECL void AdjS(_In_ unsigned sid, _In_ unsigned q);
|
||||
MICROSOFT_QUANTUM_DECL void AdjT(_In_ unsigned sid, _In_ unsigned q);
|
||||
MICROSOFT_QUANTUM_DECL void X(unsigned sid, unsigned q);
|
||||
MICROSOFT_QUANTUM_DECL void Y(unsigned sid, unsigned q);
|
||||
MICROSOFT_QUANTUM_DECL void Z(unsigned sid, unsigned q);
|
||||
MICROSOFT_QUANTUM_DECL void H(unsigned sid, unsigned q);
|
||||
MICROSOFT_QUANTUM_DECL void S(unsigned sid, unsigned q);
|
||||
MICROSOFT_QUANTUM_DECL void T(unsigned sid, unsigned q);
|
||||
MICROSOFT_QUANTUM_DECL void AdjS(unsigned sid, unsigned q);
|
||||
MICROSOFT_QUANTUM_DECL void AdjT(unsigned sid, unsigned q);
|
||||
|
||||
// multi-controlled single-qubit gates
|
||||
|
||||
MICROSOFT_QUANTUM_DECL void MCX(_In_ unsigned sid, _In_ unsigned n, _In_reads_(n) unsigned* c, _In_ unsigned q);
|
||||
MICROSOFT_QUANTUM_DECL void MCY(_In_ unsigned sid, _In_ unsigned n, _In_reads_(n) unsigned* c, _In_ unsigned q);
|
||||
MICROSOFT_QUANTUM_DECL void MCZ(_In_ unsigned sid, _In_ unsigned n, _In_reads_(n) unsigned* c, _In_ unsigned q);
|
||||
MICROSOFT_QUANTUM_DECL void MCH(_In_ unsigned sid, _In_ unsigned n, _In_reads_(n) unsigned* c, _In_ unsigned q);
|
||||
MICROSOFT_QUANTUM_DECL void MCS(_In_ unsigned sid, _In_ unsigned n, _In_reads_(n) unsigned* c, _In_ unsigned q);
|
||||
MICROSOFT_QUANTUM_DECL void MCT(_In_ unsigned sid, _In_ unsigned n, _In_reads_(n) unsigned* c, _In_ unsigned q);
|
||||
MICROSOFT_QUANTUM_DECL void MCAdjS(_In_ unsigned sid, _In_ unsigned n, _In_reads_(n) unsigned* c, _In_ unsigned q);
|
||||
MICROSOFT_QUANTUM_DECL void MCAdjT(_In_ unsigned sid, _In_ unsigned n, _In_reads_(n) unsigned* c, _In_ unsigned q);
|
||||
MICROSOFT_QUANTUM_DECL void MCX(unsigned sid, unsigned n, unsigned* c, unsigned q);
|
||||
MICROSOFT_QUANTUM_DECL void MCY(unsigned sid, unsigned n, unsigned* c, unsigned q);
|
||||
MICROSOFT_QUANTUM_DECL void MCZ(unsigned sid, unsigned n, unsigned* c, unsigned q);
|
||||
MICROSOFT_QUANTUM_DECL void MCH(unsigned sid, unsigned n, unsigned* c, unsigned q);
|
||||
MICROSOFT_QUANTUM_DECL void MCS(unsigned sid, unsigned n, unsigned* c, unsigned q);
|
||||
MICROSOFT_QUANTUM_DECL void MCT(unsigned sid, unsigned n, unsigned* c, unsigned q);
|
||||
MICROSOFT_QUANTUM_DECL void MCAdjS(unsigned sid, unsigned n, unsigned* c, unsigned q);
|
||||
MICROSOFT_QUANTUM_DECL void MCAdjT(unsigned sid, unsigned n, unsigned* c, unsigned q);
|
||||
|
||||
// rotations
|
||||
MICROSOFT_QUANTUM_DECL void R(_In_ unsigned sid, _In_ unsigned b, _In_ double phi, _In_ unsigned q);
|
||||
MICROSOFT_QUANTUM_DECL void R(unsigned sid, unsigned b, double phi, unsigned q);
|
||||
|
||||
// multi-controlled rotations
|
||||
MICROSOFT_QUANTUM_DECL void MCR(
|
||||
_In_ unsigned sid,
|
||||
_In_ unsigned b,
|
||||
_In_ double phi,
|
||||
_In_ unsigned n,
|
||||
_In_reads_(n) unsigned* c,
|
||||
_In_ unsigned q);
|
||||
unsigned sid,
|
||||
unsigned b,
|
||||
double phi,
|
||||
unsigned n,
|
||||
unsigned* c,
|
||||
unsigned q);
|
||||
|
||||
// Exponential of Pauli operators
|
||||
MICROSOFT_QUANTUM_DECL void Exp(
|
||||
_In_ unsigned sid,
|
||||
_In_ unsigned n,
|
||||
_In_reads_(n) unsigned* b,
|
||||
_In_ double phi,
|
||||
_In_reads_(n) unsigned* q);
|
||||
unsigned sid,
|
||||
unsigned n,
|
||||
unsigned* b,
|
||||
double phi,
|
||||
unsigned* q);
|
||||
MICROSOFT_QUANTUM_DECL void MCExp(
|
||||
_In_ unsigned sid,
|
||||
_In_ unsigned n,
|
||||
_In_reads_(n) unsigned* b,
|
||||
_In_ double phi,
|
||||
_In_ unsigned nc,
|
||||
_In_reads_(nc) unsigned* cs,
|
||||
_In_reads_(n) unsigned* q);
|
||||
unsigned sid,
|
||||
unsigned n,
|
||||
unsigned* b,
|
||||
double phi,
|
||||
unsigned nc,
|
||||
unsigned* cs,
|
||||
unsigned* q);
|
||||
|
||||
// measurements
|
||||
MICROSOFT_QUANTUM_DECL unsigned M(_In_ unsigned sid, _In_ unsigned q);
|
||||
MICROSOFT_QUANTUM_DECL unsigned M(unsigned sid, unsigned q);
|
||||
MICROSOFT_QUANTUM_DECL unsigned Measure(
|
||||
_In_ unsigned sid,
|
||||
_In_ unsigned n,
|
||||
_In_reads_(n) unsigned* b,
|
||||
_In_reads_(n) unsigned* q);
|
||||
unsigned sid,
|
||||
unsigned n,
|
||||
unsigned* b,
|
||||
unsigned* q);
|
||||
|
||||
// permutation oracle emulation
|
||||
MICROSOFT_QUANTUM_DECL void PermuteBasis(
|
||||
_In_ unsigned sid,
|
||||
_In_ unsigned n,
|
||||
_In_reads_(n) unsigned* q,
|
||||
_In_ std::size_t table_size, // NOLINT
|
||||
_In_reads_(table_size) std::size_t* permutation_table); // NOLINT
|
||||
unsigned sid,
|
||||
unsigned n,
|
||||
unsigned* q,
|
||||
std::size_t table_size, // NOLINT
|
||||
std::size_t* permutation_table); // NOLINT
|
||||
MICROSOFT_QUANTUM_DECL void AdjPermuteBasis(
|
||||
_In_ unsigned sid,
|
||||
_In_ unsigned n,
|
||||
_In_reads_(n) unsigned* q,
|
||||
_In_ std::size_t table_size, // NOLINT
|
||||
_In_reads_(table_size) std::size_t* permutation_table); // NOLINT
|
||||
unsigned sid,
|
||||
unsigned n,
|
||||
unsigned* q,
|
||||
std::size_t table_size, // NOLINT
|
||||
std::size_t* permutation_table); // NOLINT
|
||||
|
||||
}
|
||||
|
|
|
@ -33,7 +33,7 @@ extern "C"
|
|||
destroySimulator(sim_id);
|
||||
}
|
||||
|
||||
MICROSOFT_QUANTUM_DECL void seed_cpp(simulator_id_type sim_id, _In_ unsigned int s){
|
||||
MICROSOFT_QUANTUM_DECL void seed_cpp(simulator_id_type sim_id, unsigned int s){
|
||||
getSimulator(sim_id)->set_random_seed(s);
|
||||
}
|
||||
|
||||
|
@ -54,13 +54,13 @@ extern "C"
|
|||
|
||||
// Generic single-qubit gate
|
||||
#define FWDGATE1(G) \
|
||||
MICROSOFT_QUANTUM_DECL void G##_cpp(simulator_id_type sim_id, _In_ logical_qubit_id q) \
|
||||
MICROSOFT_QUANTUM_DECL void G##_cpp(simulator_id_type sim_id, logical_qubit_id q) \
|
||||
{ \
|
||||
getSimulator(sim_id)->G(q); \
|
||||
}
|
||||
// Generic multi-qubit gate
|
||||
#define FWDCSGATE1(G) \
|
||||
MICROSOFT_QUANTUM_DECL void MC##G##_cpp(simulator_id_type sim_id, _In_ int n, _In_reads_(n) logical_qubit_id* c, _In_ logical_qubit_id q) \
|
||||
MICROSOFT_QUANTUM_DECL void MC##G##_cpp(simulator_id_type sim_id, int n, logical_qubit_id* c, logical_qubit_id q) \
|
||||
{ \
|
||||
\
|
||||
getSimulator(sim_id)->MC##G(std::vector<logical_qubit_id>(c, c + n), q); \
|
||||
|
@ -92,37 +92,37 @@ extern "C"
|
|||
|
||||
|
||||
|
||||
MICROSOFT_QUANTUM_DECL void SWAP_cpp(simulator_id_type sim_id, _In_ logical_qubit_id q1, _In_ logical_qubit_id q2){
|
||||
MICROSOFT_QUANTUM_DECL void SWAP_cpp(simulator_id_type sim_id, logical_qubit_id q1, logical_qubit_id q2){
|
||||
getSimulator(sim_id)->SWAP(q1, q2);
|
||||
}
|
||||
|
||||
MICROSOFT_QUANTUM_DECL void MCSWAP_cpp(simulator_id_type sim_id, _In_ int n, _In_reads_(n) logical_qubit_id* c, _In_ logical_qubit_id q1, _In_ logical_qubit_id q2){
|
||||
MICROSOFT_QUANTUM_DECL void MCSWAP_cpp(simulator_id_type sim_id, int n, logical_qubit_id* c, logical_qubit_id q1, logical_qubit_id q2){
|
||||
getSimulator(sim_id)->CSWAP(std::vector<logical_qubit_id>(c, c + n), q1, q2);
|
||||
}
|
||||
|
||||
MICROSOFT_QUANTUM_DECL void MCApplyAnd_cpp(simulator_id_type sim_id,_In_ int length, _In_reads_(length) logical_qubit_id* controls, _In_ logical_qubit_id target){
|
||||
MICROSOFT_QUANTUM_DECL void MCApplyAnd_cpp(simulator_id_type sim_id, int length, logical_qubit_id* controls, logical_qubit_id target){
|
||||
getSimulator(sim_id)->MCApplyAnd(std::vector<logical_qubit_id>(controls, controls + length), target);
|
||||
}
|
||||
|
||||
MICROSOFT_QUANTUM_DECL void MCAdjointApplyAnd_cpp(simulator_id_type sim_id,_In_ int length, _In_reads_(length) logical_qubit_id* controls, _In_ logical_qubit_id target){
|
||||
MICROSOFT_QUANTUM_DECL void MCAdjointApplyAnd_cpp(simulator_id_type sim_id, int length, logical_qubit_id* controls, logical_qubit_id target){
|
||||
getSimulator(sim_id)->MCApplyAndAdj(std::vector<logical_qubit_id>(controls, controls + length), target);
|
||||
}
|
||||
|
||||
// rotations
|
||||
|
||||
MICROSOFT_QUANTUM_DECL void R_cpp(simulator_id_type sim_id, _In_ int b, _In_ double phi, _In_ logical_qubit_id q)
|
||||
MICROSOFT_QUANTUM_DECL void R_cpp(simulator_id_type sim_id, int b, double phi, logical_qubit_id q)
|
||||
{
|
||||
getSimulator(sim_id)->R(static_cast<Gates::Basis>(b), phi, q);
|
||||
}
|
||||
MICROSOFT_QUANTUM_DECL void Rfrac_cpp(simulator_id_type sim_id, _In_ int b, _In_ std::int64_t numerator, _In_ std::int64_t power, _In_ logical_qubit_id q)
|
||||
MICROSOFT_QUANTUM_DECL void Rfrac_cpp(simulator_id_type sim_id, int b, std::int64_t numerator, std::int64_t power, logical_qubit_id q)
|
||||
{
|
||||
getSimulator(sim_id)->RFrac(static_cast<Gates::Basis>(b), numerator, power, q);
|
||||
}
|
||||
MICROSOFT_QUANTUM_DECL void R1_cpp(simulator_id_type sim_id,_In_ double phi, _In_ logical_qubit_id q)
|
||||
MICROSOFT_QUANTUM_DECL void R1_cpp(simulator_id_type sim_id, double phi, logical_qubit_id q)
|
||||
{
|
||||
getSimulator(sim_id)->R1(phi, q);
|
||||
}
|
||||
MICROSOFT_QUANTUM_DECL void R1frac_cpp(simulator_id_type sim_id, _In_ std::int64_t numerator, _In_ std::int64_t power, _In_ logical_qubit_id q)
|
||||
MICROSOFT_QUANTUM_DECL void R1frac_cpp(simulator_id_type sim_id, std::int64_t numerator, std::int64_t power, logical_qubit_id q)
|
||||
{
|
||||
getSimulator(sim_id)->R1Frac(numerator, power, q);
|
||||
}
|
||||
|
@ -130,11 +130,11 @@ extern "C"
|
|||
// multi-controlled rotations
|
||||
MICROSOFT_QUANTUM_DECL void MCR_cpp(
|
||||
simulator_id_type sim_id,
|
||||
_In_ int b,
|
||||
_In_ double phi,
|
||||
_In_ logical_qubit_id nc,
|
||||
_In_reads_(nc) logical_qubit_id* c,
|
||||
_In_ logical_qubit_id q)
|
||||
int b,
|
||||
double phi,
|
||||
logical_qubit_id nc,
|
||||
logical_qubit_id* c,
|
||||
logical_qubit_id q)
|
||||
{
|
||||
std::vector<logical_qubit_id> cv(c, c + nc);
|
||||
getSimulator(sim_id)->MCR(cv, static_cast<Gates::Basis>(b), phi, q);
|
||||
|
@ -142,12 +142,12 @@ extern "C"
|
|||
|
||||
MICROSOFT_QUANTUM_DECL void MCRFrac_cpp(
|
||||
simulator_id_type sim_id,
|
||||
_In_ int b,
|
||||
_In_ std::int64_t numerator,
|
||||
_In_ std::int64_t power,
|
||||
_In_ logical_qubit_id nc,
|
||||
_In_reads_(nc) logical_qubit_id* c,
|
||||
_In_ logical_qubit_id q)
|
||||
int b,
|
||||
std::int64_t numerator,
|
||||
std::int64_t power,
|
||||
logical_qubit_id nc,
|
||||
logical_qubit_id* c,
|
||||
logical_qubit_id q)
|
||||
{
|
||||
std::vector<logical_qubit_id> cv(c, c + nc);
|
||||
getSimulator(sim_id)->MCRFrac(cv, static_cast<Gates::Basis>(b), numerator, power, q);
|
||||
|
@ -155,10 +155,10 @@ extern "C"
|
|||
|
||||
MICROSOFT_QUANTUM_DECL void MCR1_cpp(
|
||||
simulator_id_type sim_id,
|
||||
_In_ double phi,
|
||||
_In_ int nc,
|
||||
_In_reads_(nc) logical_qubit_id* c,
|
||||
_In_ logical_qubit_id q)
|
||||
double phi,
|
||||
int nc,
|
||||
logical_qubit_id* c,
|
||||
logical_qubit_id q)
|
||||
{
|
||||
std::vector<logical_qubit_id> cv(c, c + nc);
|
||||
getSimulator(sim_id)->MCR1(cv, phi, q);
|
||||
|
@ -166,11 +166,11 @@ extern "C"
|
|||
|
||||
MICROSOFT_QUANTUM_DECL void MCR1Frac_cpp(
|
||||
simulator_id_type sim_id,
|
||||
_In_ std::int64_t numerator,
|
||||
_In_ std::int64_t power,
|
||||
_In_ int nc,
|
||||
_In_reads_(nc) logical_qubit_id* c,
|
||||
_In_ logical_qubit_id q)
|
||||
std::int64_t numerator,
|
||||
std::int64_t power,
|
||||
int nc,
|
||||
logical_qubit_id* c,
|
||||
logical_qubit_id q)
|
||||
{
|
||||
std::vector<logical_qubit_id> cv(c, c + nc);
|
||||
getSimulator(sim_id)->MCR1Frac(cv, numerator, power, q);
|
||||
|
@ -179,10 +179,10 @@ extern "C"
|
|||
// Exponential of Pauli operators
|
||||
MICROSOFT_QUANTUM_DECL void Exp_cpp(
|
||||
simulator_id_type sim_id,
|
||||
_In_ int n,
|
||||
_In_reads_(n) int* b,
|
||||
_In_ double phi,
|
||||
_In_reads_(n) logical_qubit_id* q)
|
||||
int n,
|
||||
int* b,
|
||||
double phi,
|
||||
logical_qubit_id* q)
|
||||
{
|
||||
std::vector<Gates::Basis> bv;
|
||||
bv.reserve(n);
|
||||
|
@ -194,12 +194,12 @@ extern "C"
|
|||
|
||||
MICROSOFT_QUANTUM_DECL void MCExp_cpp(
|
||||
simulator_id_type sim_id,
|
||||
_In_ int nc,
|
||||
_In_ int n,
|
||||
_In_reads_(nc) logical_qubit_id* c,
|
||||
_In_reads_(n) int* b,
|
||||
_In_ double phi,
|
||||
_In_reads_(n) logical_qubit_id* q)
|
||||
int nc,
|
||||
int n,
|
||||
logical_qubit_id* c,
|
||||
int* b,
|
||||
double phi,
|
||||
logical_qubit_id* q)
|
||||
{
|
||||
std::vector<Gates::Basis> bv;
|
||||
bv.reserve(n);
|
||||
|
@ -211,20 +211,20 @@ extern "C"
|
|||
}
|
||||
|
||||
// measurements
|
||||
MICROSOFT_QUANTUM_DECL unsigned M_cpp(simulator_id_type sim_id, _In_ logical_qubit_id q)
|
||||
MICROSOFT_QUANTUM_DECL unsigned M_cpp(simulator_id_type sim_id, logical_qubit_id q)
|
||||
{
|
||||
return getSimulator(sim_id)->M(q);
|
||||
}
|
||||
|
||||
MICROSOFT_QUANTUM_DECL void Reset_cpp(simulator_id_type sim_id, _In_ logical_qubit_id q){
|
||||
MICROSOFT_QUANTUM_DECL void Reset_cpp(simulator_id_type sim_id, logical_qubit_id q){
|
||||
getSimulator(sim_id)->Reset(q);
|
||||
}
|
||||
|
||||
MICROSOFT_QUANTUM_DECL unsigned Measure_cpp(
|
||||
simulator_id_type sim_id,
|
||||
_In_ int n,
|
||||
_In_reads_(n) int* b,
|
||||
_In_reads_(n) logical_qubit_id* q)
|
||||
int n,
|
||||
int* b,
|
||||
logical_qubit_id* q)
|
||||
{
|
||||
std::vector<Gates::Basis> bv;
|
||||
bv.reserve(n);
|
||||
|
@ -237,9 +237,9 @@ extern "C"
|
|||
// Extracts the probability of measuring a One result on qubits q with basis b
|
||||
MICROSOFT_QUANTUM_DECL double JointEnsembleProbability_cpp(
|
||||
simulator_id_type sim_id,
|
||||
_In_ int n,
|
||||
_In_reads_(n) int* b,
|
||||
_In_reads_(n) logical_qubit_id* q)
|
||||
int n,
|
||||
int* b,
|
||||
logical_qubit_id* q)
|
||||
{
|
||||
std::vector<Gates::Basis> bv;
|
||||
bv.reserve(n);
|
||||
|
@ -253,20 +253,20 @@ extern "C"
|
|||
// Iterates through the entire wavefunction and calls `callback` on every state in the superposition
|
||||
// It will write the label of the state, in binary, from qubit 0 to `max_qubit_id`, into the char* pointer, then call `callback`
|
||||
// with the real and complex values as the double arguments
|
||||
MICROSOFT_QUANTUM_DECL void Dump_cpp(simulator_id_type sim_id, _In_ bool (*callback)(const char*, double, double)){
|
||||
MICROSOFT_QUANTUM_DECL void Dump_cpp(simulator_id_type sim_id, bool (*callback)(const char*, double, double)){
|
||||
return getSimulator(sim_id)->dump_all(callback);
|
||||
}
|
||||
|
||||
MICROSOFT_QUANTUM_DECL void ExtendedDump_cpp(simulator_id_type sim_id, _In_ bool (*callback)(const char*, double, double, void*), _In_ void* arg){
|
||||
MICROSOFT_QUANTUM_DECL void ExtendedDump_cpp(simulator_id_type sim_id, bool (*callback)(const char*, double, double, void*), void* arg){
|
||||
return getSimulator(sim_id)->dump_all_ext(callback, arg);
|
||||
}
|
||||
|
||||
// Same as Dump_cpp, but only dumps the wavefunction on the qubits in `q`, ensuring they are separable from the rest of the state first
|
||||
MICROSOFT_QUANTUM_DECL bool DumpQubits_cpp(
|
||||
simulator_id_type sim_id,
|
||||
_In_ int n,
|
||||
_In_reads_(n) logical_qubit_id* q,
|
||||
_In_ bool (*callback)(const char*, double, double))
|
||||
int n,
|
||||
logical_qubit_id* q,
|
||||
bool (*callback)(const char*, double, double))
|
||||
{
|
||||
std::vector<logical_qubit_id> qs(q, q + n);
|
||||
return getSimulator(sim_id)->dump_qubits(qs, callback);
|
||||
|
@ -274,17 +274,17 @@ extern "C"
|
|||
|
||||
MICROSOFT_QUANTUM_DECL bool ExtendedDumpQubits_cpp(
|
||||
simulator_id_type sim_id,
|
||||
_In_ int n,
|
||||
_In_reads_(n) logical_qubit_id* q,
|
||||
_In_ bool (*callback)(const char*, double, double, void*),
|
||||
_In_ void* arg)
|
||||
int n,
|
||||
logical_qubit_id* q,
|
||||
bool (*callback)(const char*, double, double, void*),
|
||||
void* arg)
|
||||
{
|
||||
std::vector<logical_qubit_id> qs(q, q + n);
|
||||
return getSimulator(sim_id)->dump_qubits_ext(qs, callback, arg);
|
||||
}
|
||||
|
||||
// // dump the list of logical qubit ids to given callback
|
||||
// MICROSOFT_QUANTUM_DECL void DumpIds(_In_ unsigned id, _In_ void (*callback)(unsigned))
|
||||
// MICROSOFT_QUANTUM_DECL void DumpIds(unsigned id, void (*callback)(unsigned))
|
||||
// {
|
||||
// Microsoft::Quantum::Simulator::get(id)->dumpIds(callback);
|
||||
// }
|
||||
|
@ -294,7 +294,7 @@ extern "C"
|
|||
}
|
||||
|
||||
// Asserts that the gates in `b`, measured on the qubits in `q`, return `result`
|
||||
MICROSOFT_QUANTUM_DECL bool Assert_cpp(simulator_id_type sim_id, _In_ int n, _In_reads_(n) int* b, _In_reads_(n) logical_qubit_id* q, bool result){
|
||||
MICROSOFT_QUANTUM_DECL bool Assert_cpp(simulator_id_type sim_id, int n, int* b, logical_qubit_id* q, bool result){
|
||||
std::vector<Gates::Basis> bv;
|
||||
bv.reserve(n);
|
||||
for (int i = 0; i < n; ++i)
|
||||
|
|
|
@ -5,15 +5,6 @@
|
|||
|
||||
#include "types.h"
|
||||
|
||||
// SAL only defined in windows.
|
||||
#ifndef _In_
|
||||
#define _In_
|
||||
#define _In_reads_(n)
|
||||
#endif
|
||||
#ifndef _Out_
|
||||
#define _Out_
|
||||
#endif
|
||||
|
||||
#ifdef BUILD_DLL
|
||||
#define MICROSOFT_QUANTUM_DECL __declspec(dllexport)
|
||||
#else
|
||||
|
@ -29,120 +20,120 @@ extern "C"
|
|||
MICROSOFT_QUANTUM_DECL simulator_id_type init_cpp(logical_qubit_id num_qubits);
|
||||
MICROSOFT_QUANTUM_DECL void destroy_cpp(simulator_id_type sim_id);
|
||||
|
||||
MICROSOFT_QUANTUM_DECL void seed_cpp(simulator_id_type sim_id, _In_ unsigned int s);
|
||||
MICROSOFT_QUANTUM_DECL void seed_cpp(simulator_id_type sim_id, unsigned int s);
|
||||
// allocate and release
|
||||
MICROSOFT_QUANTUM_DECL void allocateQubit_cpp(simulator_id_type sim_id, logical_qubit_id q);
|
||||
MICROSOFT_QUANTUM_DECL bool releaseQubit_cpp(simulator_id_type sim_id, logical_qubit_id q);
|
||||
MICROSOFT_QUANTUM_DECL logical_qubit_id num_qubits_cpp(simulator_id_type sim_id);
|
||||
|
||||
// single-qubit gates
|
||||
MICROSOFT_QUANTUM_DECL void X_cpp(simulator_id_type sim_id, _In_ logical_qubit_id q);
|
||||
MICROSOFT_QUANTUM_DECL void Y_cpp(simulator_id_type sim_id, _In_ logical_qubit_id q);
|
||||
MICROSOFT_QUANTUM_DECL void Z_cpp(simulator_id_type sim_id, _In_ logical_qubit_id q);
|
||||
MICROSOFT_QUANTUM_DECL void H_cpp(simulator_id_type sim_id, _In_ logical_qubit_id q);
|
||||
MICROSOFT_QUANTUM_DECL void S_cpp(simulator_id_type sim_id, _In_ logical_qubit_id q);
|
||||
MICROSOFT_QUANTUM_DECL void T_cpp(simulator_id_type sim_id, _In_ logical_qubit_id q);
|
||||
MICROSOFT_QUANTUM_DECL void AdjS_cpp(simulator_id_type sim_id, _In_ logical_qubit_id q);
|
||||
MICROSOFT_QUANTUM_DECL void AdjT_cpp(simulator_id_type sim_id, _In_ logical_qubit_id q);
|
||||
MICROSOFT_QUANTUM_DECL void X_cpp(simulator_id_type sim_id, logical_qubit_id q);
|
||||
MICROSOFT_QUANTUM_DECL void Y_cpp(simulator_id_type sim_id, logical_qubit_id q);
|
||||
MICROSOFT_QUANTUM_DECL void Z_cpp(simulator_id_type sim_id, logical_qubit_id q);
|
||||
MICROSOFT_QUANTUM_DECL void H_cpp(simulator_id_type sim_id, logical_qubit_id q);
|
||||
MICROSOFT_QUANTUM_DECL void S_cpp(simulator_id_type sim_id, logical_qubit_id q);
|
||||
MICROSOFT_QUANTUM_DECL void T_cpp(simulator_id_type sim_id, logical_qubit_id q);
|
||||
MICROSOFT_QUANTUM_DECL void AdjS_cpp(simulator_id_type sim_id, logical_qubit_id q);
|
||||
MICROSOFT_QUANTUM_DECL void AdjT_cpp(simulator_id_type sim_id, logical_qubit_id q);
|
||||
|
||||
|
||||
MICROSOFT_QUANTUM_DECL void MCX_cpp(simulator_id_type sim_id, _In_ int n, _In_reads_(n) logical_qubit_id* c, _In_ logical_qubit_id q);
|
||||
MICROSOFT_QUANTUM_DECL void MCY_cpp(simulator_id_type sim_id, _In_ int n, _In_reads_(n) logical_qubit_id* c, _In_ logical_qubit_id q);
|
||||
MICROSOFT_QUANTUM_DECL void MCZ_cpp(simulator_id_type sim_id, _In_ int n, _In_reads_(n) logical_qubit_id* c, _In_ logical_qubit_id q);
|
||||
MICROSOFT_QUANTUM_DECL void MCH_cpp(simulator_id_type sim_id, _In_ int n, _In_reads_(n) logical_qubit_id* c, _In_ logical_qubit_id q);
|
||||
MICROSOFT_QUANTUM_DECL void MCX_cpp(simulator_id_type sim_id, int n, logical_qubit_id* c, logical_qubit_id q);
|
||||
MICROSOFT_QUANTUM_DECL void MCY_cpp(simulator_id_type sim_id, int n, logical_qubit_id* c, logical_qubit_id q);
|
||||
MICROSOFT_QUANTUM_DECL void MCZ_cpp(simulator_id_type sim_id, int n, logical_qubit_id* c, logical_qubit_id q);
|
||||
MICROSOFT_QUANTUM_DECL void MCH_cpp(simulator_id_type sim_id, int n, logical_qubit_id* c, logical_qubit_id q);
|
||||
|
||||
MICROSOFT_QUANTUM_DECL void SWAP_cpp(simulator_id_type sim_id, _In_ logical_qubit_id q1, _In_ logical_qubit_id q2);
|
||||
MICROSOFT_QUANTUM_DECL void MCSWAP_cpp(simulator_id_type sim_id, _In_ int n, _In_reads_(n) logical_qubit_id* c, _In_ logical_qubit_id q1, _In_ logical_qubit_id q2);
|
||||
MICROSOFT_QUANTUM_DECL void MCAnd_cpp(simulator_id_type sim_id,_In_ int length, _In_reads_(length) logical_qubit_id* controls, _In_ logical_qubit_id target);
|
||||
MICROSOFT_QUANTUM_DECL void MCAdjointAnd_cpp(simulator_id_type sim_id,_In_ int length, _In_reads_(length) logical_qubit_id* controls, _In_ logical_qubit_id target);
|
||||
MICROSOFT_QUANTUM_DECL void SWAP_cpp(simulator_id_type sim_id, logical_qubit_id q1, logical_qubit_id q2);
|
||||
MICROSOFT_QUANTUM_DECL void MCSWAP_cpp(simulator_id_type sim_id, int n, logical_qubit_id* c, logical_qubit_id q1, logical_qubit_id q2);
|
||||
MICROSOFT_QUANTUM_DECL void MCAnd_cpp(simulator_id_type sim_id, int length, logical_qubit_id* controls, logical_qubit_id target);
|
||||
MICROSOFT_QUANTUM_DECL void MCAdjointAnd_cpp(simulator_id_type sim_id, int length, logical_qubit_id* controls, logical_qubit_id target);
|
||||
|
||||
// rotations
|
||||
MICROSOFT_QUANTUM_DECL void R_cpp(simulator_id_type sim_id, _In_ int b, _In_ double phi, _In_ logical_qubit_id q);
|
||||
MICROSOFT_QUANTUM_DECL void Rfrac_cpp(simulator_id_type sim_id, _In_ int b, _In_ std::int64_t numerator, std::int64_t power, _In_ logical_qubit_id q);
|
||||
MICROSOFT_QUANTUM_DECL void R1_cpp(simulator_id_type sim_id, _In_ double phi, _In_ logical_qubit_id q);
|
||||
MICROSOFT_QUANTUM_DECL void R1frac_cpp(simulator_id_type sim_id, _In_ std::int64_t numerator, std::int64_t power, _In_ logical_qubit_id q);
|
||||
MICROSOFT_QUANTUM_DECL void R_cpp(simulator_id_type sim_id, int b, double phi, logical_qubit_id q);
|
||||
MICROSOFT_QUANTUM_DECL void Rfrac_cpp(simulator_id_type sim_id, int b, std::int64_t numerator, std::int64_t power, logical_qubit_id q);
|
||||
MICROSOFT_QUANTUM_DECL void R1_cpp(simulator_id_type sim_id, double phi, logical_qubit_id q);
|
||||
MICROSOFT_QUANTUM_DECL void R1frac_cpp(simulator_id_type sim_id, std::int64_t numerator, std::int64_t power, logical_qubit_id q);
|
||||
|
||||
|
||||
|
||||
// multi-controlled rotations
|
||||
MICROSOFT_QUANTUM_DECL void MCR_cpp(
|
||||
simulator_id_type sim_id,
|
||||
_In_ int b,
|
||||
_In_ double phi,
|
||||
_In_ logical_qubit_id n,
|
||||
_In_reads_(n) logical_qubit_id* c,
|
||||
_In_ logical_qubit_id q);
|
||||
int b,
|
||||
double phi,
|
||||
logical_qubit_id n,
|
||||
logical_qubit_id* c,
|
||||
logical_qubit_id q);
|
||||
|
||||
MICROSOFT_QUANTUM_DECL void MCRFrac_cpp(
|
||||
simulator_id_type sim_id,
|
||||
_In_ int b,
|
||||
_In_ std::int64_t numerator,
|
||||
_In_ std::int64_t power,
|
||||
_In_ logical_qubit_id nc,
|
||||
_In_reads_(nc) logical_qubit_id* c,
|
||||
_In_ logical_qubit_id q);
|
||||
int b,
|
||||
std::int64_t numerator,
|
||||
std::int64_t power,
|
||||
logical_qubit_id nc,
|
||||
logical_qubit_id* c,
|
||||
logical_qubit_id q);
|
||||
|
||||
MICROSOFT_QUANTUM_DECL void MCR1_cpp(
|
||||
simulator_id_type sim_id,
|
||||
_In_ double phi,
|
||||
_In_ int n,
|
||||
_In_reads_(n) logical_qubit_id* c,
|
||||
_In_ logical_qubit_id q);
|
||||
double phi,
|
||||
int n,
|
||||
logical_qubit_id* c,
|
||||
logical_qubit_id q);
|
||||
|
||||
MICROSOFT_QUANTUM_DECL void MCR1Frac_cpp(
|
||||
simulator_id_type sim_id,
|
||||
_In_ std::int64_t numerator,
|
||||
_In_ std::int64_t power,
|
||||
_In_ int nc,
|
||||
_In_reads_(nc) logical_qubit_id* c,
|
||||
_In_ logical_qubit_id q);
|
||||
std::int64_t numerator,
|
||||
std::int64_t power,
|
||||
int nc,
|
||||
logical_qubit_id* c,
|
||||
logical_qubit_id q);
|
||||
|
||||
// Exponential of Pauli operators
|
||||
MICROSOFT_QUANTUM_DECL void Exp_cpp(
|
||||
simulator_id_type sim_id,
|
||||
_In_ int n,
|
||||
_In_reads_(n) int* b,
|
||||
_In_ double phi,
|
||||
_In_reads_(n) logical_qubit_id* q);
|
||||
int n,
|
||||
int* b,
|
||||
double phi,
|
||||
logical_qubit_id* q);
|
||||
MICROSOFT_QUANTUM_DECL void MCExp_cpp(
|
||||
simulator_id_type sim_id,
|
||||
_In_ int nc,
|
||||
_In_ int n,
|
||||
_In_reads_(nc) logical_qubit_id* c,
|
||||
_In_reads_(n) int* b,
|
||||
_In_ double phi,
|
||||
_In_reads_(n) logical_qubit_id* q);
|
||||
int nc,
|
||||
int n,
|
||||
logical_qubit_id* c,
|
||||
int* b,
|
||||
double phi,
|
||||
logical_qubit_id* q);
|
||||
|
||||
// measurements
|
||||
MICROSOFT_QUANTUM_DECL unsigned M_cpp(simulator_id_type sim_id, _In_ logical_qubit_id q);
|
||||
MICROSOFT_QUANTUM_DECL void Reset_cpp(simulator_id_type sim_id, _In_ logical_qubit_id q);
|
||||
MICROSOFT_QUANTUM_DECL unsigned M_cpp(simulator_id_type sim_id, logical_qubit_id q);
|
||||
MICROSOFT_QUANTUM_DECL void Reset_cpp(simulator_id_type sim_id, logical_qubit_id q);
|
||||
MICROSOFT_QUANTUM_DECL unsigned Measure_cpp(
|
||||
simulator_id_type sim_id,
|
||||
_In_ int n,
|
||||
_In_reads_(n) int* b,
|
||||
_In_reads_(n) logical_qubit_id* q);
|
||||
int n,
|
||||
int* b,
|
||||
logical_qubit_id* q);
|
||||
|
||||
|
||||
MICROSOFT_QUANTUM_DECL double JointEnsembleProbability_cpp(
|
||||
simulator_id_type sim_id,
|
||||
_In_ int n,
|
||||
_In_reads_(n) int* b,
|
||||
_In_reads_(n) logical_qubit_id* q);
|
||||
int n,
|
||||
int* b,
|
||||
logical_qubit_id* q);
|
||||
|
||||
MICROSOFT_QUANTUM_DECL void Dump_cpp(simulator_id_type sim_id, _In_ bool (*callback)(const char*, double, double));
|
||||
MICROSOFT_QUANTUM_DECL void ExtendedDump_cpp(simulator_id_type sim_id, _In_ bool (*callback)(const char*, double, double, void*), void*);
|
||||
MICROSOFT_QUANTUM_DECL void Dump_cpp(simulator_id_type sim_id, bool (*callback)(const char*, double, double));
|
||||
MICROSOFT_QUANTUM_DECL void ExtendedDump_cpp(simulator_id_type sim_id, bool (*callback)(const char*, double, double, void*), void*);
|
||||
MICROSOFT_QUANTUM_DECL bool DumpQubits_cpp(
|
||||
simulator_id_type sim_id,
|
||||
_In_ int n,
|
||||
_In_reads_(n) logical_qubit_id* q,
|
||||
_In_ bool (*callback)(const char*, double, double));
|
||||
int n,
|
||||
logical_qubit_id* q,
|
||||
bool (*callback)(const char*, double, double));
|
||||
MICROSOFT_QUANTUM_DECL bool ExtendedDumpQubits_cpp(
|
||||
simulator_id_type sim_id,
|
||||
_In_ int n,
|
||||
_In_reads_(n) logical_qubit_id* q,
|
||||
_In_ bool (*callback)(const char*, double, double, void*),
|
||||
_In_ void*);
|
||||
int n,
|
||||
logical_qubit_id* q,
|
||||
bool (*callback)(const char*, double, double, void*),
|
||||
void*);
|
||||
MICROSOFT_QUANTUM_DECL void QubitIds_cpp(simulator_id_type sim_id, void (*callback)(logical_qubit_id));
|
||||
|
||||
MICROSOFT_QUANTUM_DECL bool Assert_cpp(simulator_id_type sim_id, _In_ int n, _In_reads_(n) int* b, _In_reads_(n) logical_qubit_id* q, bool result);
|
||||
MICROSOFT_QUANTUM_DECL bool Assert_cpp(simulator_id_type sim_id, int n, int* b, logical_qubit_id* q, bool result);
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче