Template Class GateCache¶
Defined in File cuGateCache.hpp
Class Documentation¶
-
template<class fp_t>
class GateCache¶ Represents a cache for gate data to be accessible on the device.
- Template Parameters
fp_t – Floating point precision.
Public Types
Public Functions
-
GateCache() = delete¶
-
inline GateCache(bool populate, int device_id = 0, cudaStream_t stream_id = 0)¶
-
inline virtual ~GateCache()¶
-
inline void defaultPopulateCache()¶
Add a default gate-set to the given cache. Assumes initializer-list evaluated gates for “PauliX”, “PauliY”, “PauliZ”, “Hadamard”, “S”, “T”, “SWAP”, with “CNOT” and “CZ” represented as their single-qubit values.
-
inline bool gateExists(const gate_id &gate)¶
Check for the existence of a given gate.
- Parameters
gate_id – std::pair of gate_name and given parameter value.
- Returns
true Gate exists in cache.
- Returns
false Gate does not exist in cache.
-
inline bool gateExists(const std::string &gate_name, fp_t gate_param)¶
Check for the existence of a given gate.
- Parameters
gate_name – String of gate name.
gate_param – Gate parameter value.
0.0
if non-parametric gate.
- Returns
true Gate exists in cache.
- Returns
false Gate does not exist in cache.
-
inline void add_gate(const std::string &gate_name, fp_t gate_param, std::vector<CFP_t> host_data)¶
Add gate numerical value to the cache, indexed by the gate name and parameter value.
- Parameters
gate_name – String representing the name of the given gate.
gate_param – Gate parameter value.
0.0
if non-parametric gate.host_data – Vector of the gate values in row-major order.
-
inline void add_gate(const gate_id &gate_key, std::vector<CFP_t> host_data)¶
see
void add_gate(const std::string &gate_name, fp_t gate_param, const std::vector<CFP_t> &host_data)
- Parameters
gate_key –
host_data –
-
inline const CFP_t *get_gate_device_ptr(const std::string &gate_name, fp_t gate_param)¶
Returns a pointer to the GPU device memory where the gate is stored.
- Parameters
gate_name – String representing the name of the given gate.
gate_param – Gate parameter value.
0.0
if non-parametric gate.
- Returns
const CFP_t* Pointer to gate values on device.