QNLP  v1.0
QNLP::GateMetaDataHasher Struct Reference

Hashing function for GateMetaData objects, to allow storage in unordered_map. Taken from default docs example. More...

#include <GateCache.hpp>

Collaboration diagram for QNLP::GateMetaDataHasher:
Collaboration graph

Public Member Functions

std::size_t operator() (const GateMetaData &gmd) const
 

Detailed Description

Hashing function for GateMetaData objects, to allow storage in unordered_map. Taken from default docs example.

Definition at line 79 of file GateCache.hpp.

Member Function Documentation

◆ operator()()

std::size_t QNLP::GateMetaDataHasher::operator() ( const GateMetaData gmd) const
inline

Definition at line 80 of file GateCache.hpp.

80  {
81  return (
82  (std::hash<std::string>{}(gmd.labelGate)
83  ^ (std::hash<double>{}(gmd.theta) << 1)) >> 1)
84  ^ (std::hash<std::size_t>{}(gmd.sqrt_depth) << 1);
85  }

References QNLP::GateMetaData::labelGate, QNLP::GateMetaData::sqrt_depth, and QNLP::GateMetaData::theta.


The documentation for this struct was generated from the following file: