QNLP
v1.0
|
Class to cache intermediate matrix values used within other parts of the computation. Heavily depended upon by NCU to store sqrt matrix values following Barenco et al. (1995) decomposition. More...
#include <GateCache.hpp>
Public Types | |
using | GateType = decltype(std::declval< SimulatorType >().getGateX()) |
Public Member Functions | |
GateCache () | |
GateCache (SimulatorType &qSim) | |
GateCache (SimulatorType &qSim, std::size_t default_depth) | |
~GateCache () | |
void | clearCache () |
void | initCache (SimulatorType &sim, std::size_t sqrt_depth) |
Initialise the gate cache with PauliX,Y,Z and H up to a given sqrt depth. More... | |
void | addToCache (SimulatorType &sim, const std::string gateLabel, const GateType &gate, std::size_t max_depth) |
Adds new gate to the cache up to a given sqrt depth. More... | |
Data Fields | |
std::unordered_map< std::string, std::vector< std::pair< GateType, GateType > > > | gateCacheMap |
Private Attributes | |
std::size_t | cache_depth |
Class to cache intermediate matrix values used within other parts of the computation. Heavily depended upon by NCU to store sqrt matrix values following Barenco et al. (1995) decomposition.
SimulatorType | The simulator type with SimulatorGeneral as base class |
Definition at line 95 of file GateCache.hpp.
using QNLP::GateCache< SimulatorType >::GateType = decltype(std::declval<SimulatorType>().getGateX()) |
Definition at line 114 of file GateCache.hpp.
|
inline |
Definition at line 100 of file GateCache.hpp.
|
inline |
Definition at line 102 of file GateCache.hpp.
|
inline |
Definition at line 107 of file GateCache.hpp.
References QNLP::GateCache< SimulatorType >::cache_depth, and QNLP::GateCache< SimulatorType >::initCache().
|
inline |
Definition at line 111 of file GateCache.hpp.
References QNLP::GateCache< SimulatorType >::clearCache().
|
inline |
Adds new gate to the cache up to a given sqrt depth.
gateLabel | Label of gate to index into map |
gate | Gate matrix |
max_depth | Depth of calculations for sqrt and associate adjoints |
Definition at line 165 of file GateCache.hpp.
References QNLP::adjointMatrix(), QNLP::GateCache< SimulatorType >::cache_depth, QNLP::GateCache< SimulatorType >::gateCacheMap, QNLP::GateCache< SimulatorType >::initCache(), CircuitPrinter.circuit_printer::max_depth, and ncu_opt_tester::sim.
|
inline |
Definition at line 119 of file GateCache.hpp.
References QNLP::GateCache< SimulatorType >::cache_depth, and QNLP::GateCache< SimulatorType >::gateCacheMap.
Referenced by QNLP::GateCache< SimulatorType >::~GateCache().
|
inline |
Initialise the gate cache with PauliX,Y,Z and H up to a given sqrt depth.
sim | The simulator object |
sqrt_depth | The depth to which calculate sqrt matrices and their respective adjoints |
Definition at line 130 of file GateCache.hpp.
References QNLP::adjointMatrix(), QNLP::GateCache< SimulatorType >::cache_depth, QNLP::GateCache< SimulatorType >::gateCacheMap, and ncu_opt_tester::sim.
Referenced by QNLP::GateCache< SimulatorType >::addToCache(), and QNLP::GateCache< SimulatorType >::GateCache().
|
private |
Definition at line 97 of file GateCache.hpp.
Referenced by QNLP::GateCache< SimulatorType >::addToCache(), QNLP::GateCache< SimulatorType >::clearCache(), QNLP::GateCache< SimulatorType >::GateCache(), and QNLP::GateCache< SimulatorType >::initCache().
std::unordered_map<std::string, std::vector< std::pair<GateType, GateType> > > QNLP::GateCache< SimulatorType >::gateCacheMap |
Definition at line 117 of file GateCache.hpp.
Referenced by QNLP::GateCache< SimulatorType >::addToCache(), QNLP::GateCache< SimulatorType >::clearCache(), and QNLP::GateCache< SimulatorType >::initCache().