Maestro 0.3.11
Unified interface for quantum circuit simulation
Loading...
Searching...
No Matches
Simulators::MPSDummySimulator Class Reference

#include <MPSDummySimulator.h>

Collaboration diagram for Simulators::MPSDummySimulator:

Public Types

using GateClass = QC::TensorNetworks::MPSSimulatorInterface::GateClass
enum class  HeuristicPolicy {
  kCombinedCostAndGravity = 0 ,
  kMinOneStepCost ,
  kNextPartnerGravity ,
  kAnchorHeavierQubit ,
  kMinBondCost ,
  kSwapLeft ,
  kSwapRight ,
  kCloserToEnd ,
  kCloserToCenter
}
using IndexType = long long int
using MatrixClass = QC::TensorNetworks::MPSSimulatorInterface::MatrixClass

Public Member Functions

 MPSDummySimulator (size_t N, bool operatorChain=false)
void ApplyGate (const GateClass &gate, IndexType qubit, IndexType controllingQubit1=0)
void ApplyGate (const QC::Gates::AppliedGate< MatrixClass > &gate)
void ApplyGate (const std::shared_ptr< Circuits::IOperation<> > &gate)
void ApplyGates (const std::vector< QC::Gates::AppliedGate< MatrixClass > > &gates)
void ApplyGates (const std::vector< std::shared_ptr< Circuits::IOperation<> > > &gates)
void ApplyTwoQubitGate (IndexType qubit, IndexType controllingQubit1, double schmidtRank, bool isSwapGate=false)
double BondCost (double dimension) const
void Clear ()
std::unique_ptr< MPSDummySimulator > Clone () const
std::vector< long long int > ComputeOptimalQubitsMap (const std::vector< std::shared_ptr< Circuits::Circuit<> > > &layers, int nrShuffles=0, int nrSwaps=0)
void EvaluateMeetingPositionCost (IndexType meetPosition, const std::vector< std::shared_ptr< Circuits::IOperation<> > > &upcomingGates, long long int currentGateIndex, int lookaheadDepth, int lookaheadDepthWithHeuristic, double currentCost, double &bestCost, bool useSameDummy=false)
IndexType FindBestMeetingPosition (const std::vector< std::shared_ptr< Circuits::IOperation<> > > &upcomingGates, long long int currentGateIndex, int lookaheadDepth, int lookaheadDepthWithHeuristic, double currentCost, double &bestCost)
const std::vector< double > & getCurrentBondDimensions () const
double getGrowthFactorGate () const
double getGrowthFactorSwap () const
const std::vector< double > & getMaxBondDimensions () const
double getMinLayoutGain () const
size_t getNrQubits () const
const std::vector< IndexType > & getQubitsMap () const
const std::vector< IndexType > & getQubitsMapInv () const
double getTotalSwappingCost () const
void InvalidateMemoCache ()
bool IsOperatorChain () const
void print () const
void RecordAdjacentTwoQubitGate (IndexType bond, bool isSwapGate, double schmidtRank)
void RelabelQubits (IndexType q1, IndexType q2)
void ResetBondDimensions ()
IndexType SelectMeetingPositionAdaptive (const std::vector< std::shared_ptr< Circuits::IOperation<> > > &upcomingGates, long long int currentGateIndex, int lookaheadDepth, int lookaheadDepthWithHeuristic, double currentCost, double &bestCost)
void SetCurrentBondDimensions (const std::vector< double > &dims)
void setGrowthFactorGate (double factor)
void setGrowthFactorSwap (double factor)
void SetInitialQubitsMap (const std::vector< long long int > &initialMap)
void SetMaxBondDimension (IndexType val)
void setMinLayoutGain (double gain)
void SetRoutingCostModel (IndexType cap, double weight)
void SetRoutingMap (const std::vector< long long int > &actualMap)
void SetSwapGatesRelabelQubits (bool enabled)
void setTotalSwappingCost (double cost)
void SwapQubitsToPosition (IndexType qubit1, IndexType qubit2, IndexType meetPosition)

Static Public Member Functions

static IndexType EffectiveLookaheadMaxBondDimension (size_t nrQubits, bool operatorChain, IndexType cap)
static IndexType EffectiveMapMaxBondDimension (size_t nrQubits, bool operatorChain, IndexType cap)
static double GateSchmidtRank (const Circuits::IQuantumGate<> &gate)
static bool IsControlledTwoQubitGateType (Circuits::QuantumGateType type)

Static Public Attributes

static constexpr double kPostGateCostWeight = 0.5
static constexpr double kPostSwapCostWeight = 0.25

Detailed Description

Definition at line 41 of file MPSDummySimulator.h.

Member Typedef Documentation

◆ GateClass

using Simulators::MPSDummySimulator::GateClass = QC::TensorNetworks::MPSSimulatorInterface::GateClass

Definition at line 46 of file MPSDummySimulator.h.

◆ IndexType

Definition at line 44 of file MPSDummySimulator.h.

◆ MatrixClass

using Simulators::MPSDummySimulator::MatrixClass = QC::TensorNetworks::MPSSimulatorInterface::MatrixClass

Definition at line 45 of file MPSDummySimulator.h.

Member Enumeration Documentation

◆ HeuristicPolicy

Enumerator
kCombinedCostAndGravity 
kMinOneStepCost 
kNextPartnerGravity 
kAnchorHeavierQubit 
kMinBondCost 
kSwapLeft 
kSwapRight 
kCloserToEnd 
kCloserToCenter 

Definition at line 500 of file MPSDummySimulator.h.

Constructor & Destructor Documentation

◆ MPSDummySimulator()

Simulators::MPSDummySimulator::MPSDummySimulator ( size_t N,
bool operatorChain = false )
inlineexplicit

Definition at line 50 of file MPSDummySimulator.h.

References SetMaxBondDimension().

Referenced by Clone().

Member Function Documentation

◆ ApplyGate() [1/3]

void Simulators::MPSDummySimulator::ApplyGate ( const GateClass & gate,
IndexType qubit,
IndexType controllingQubit1 = 0 )
inline

Definition at line 367 of file MPSDummySimulator.h.

References ApplyTwoQubitGate(), getNrQubits(), and RelabelQubits().

◆ ApplyGate() [2/3]

void Simulators::MPSDummySimulator::ApplyGate ( const QC::Gates::AppliedGate< MatrixClass > & gate)
inline

Definition at line 308 of file MPSDummySimulator.h.

References ApplyGate().

Referenced by ApplyGate(), ApplyGate(), ApplyGates(), and ApplyGates().

◆ ApplyGate() [3/3]

void Simulators::MPSDummySimulator::ApplyGate ( const std::shared_ptr< Circuits::IOperation<> > & gate)
inline

◆ ApplyGates() [1/2]

void Simulators::MPSDummySimulator::ApplyGates ( const std::vector< QC::Gates::AppliedGate< MatrixClass > > & gates)
inline

Definition at line 433 of file MPSDummySimulator.h.

References ApplyGate().

Referenced by ComputeOptimalQubitsMap().

◆ ApplyGates() [2/2]

void Simulators::MPSDummySimulator::ApplyGates ( const std::vector< std::shared_ptr< Circuits::IOperation<> > > & gates)
inline

Definition at line 439 of file MPSDummySimulator.h.

References ApplyGate().

◆ ApplyTwoQubitGate()

void Simulators::MPSDummySimulator::ApplyTwoQubitGate ( IndexType qubit,
IndexType controllingQubit1,
double schmidtRank,
bool isSwapGate = false )
inline

Definition at line 397 of file MPSDummySimulator.h.

References getNrQubits(), and RecordAdjacentTwoQubitGate().

Referenced by ApplyGate(), and ApplyGate().

◆ BondCost()

double Simulators::MPSDummySimulator::BondCost ( double dimension) const
inline

◆ Clear()

void Simulators::MPSDummySimulator::Clear ( )
inline

Definition at line 214 of file MPSDummySimulator.h.

References InvalidateMemoCache().

◆ Clone()

std::unique_ptr< MPSDummySimulator > Simulators::MPSDummySimulator::Clone ( ) const
inline

Definition at line 63 of file MPSDummySimulator.h.

References MPSDummySimulator().

◆ ComputeOptimalQubitsMap()

std::vector< long long int > Simulators::MPSDummySimulator::ComputeOptimalQubitsMap ( const std::vector< std::shared_ptr< Circuits::Circuit<> > > & layers,
int nrShuffles = 0,
int nrSwaps = 0 )
inline

◆ EffectiveLookaheadMaxBondDimension()

IndexType Simulators::MPSDummySimulator::EffectiveLookaheadMaxBondDimension ( size_t nrQubits,
bool operatorChain,
IndexType cap )
inlinestatic

◆ EffectiveMapMaxBondDimension()

IndexType Simulators::MPSDummySimulator::EffectiveMapMaxBondDimension ( size_t nrQubits,
bool operatorChain,
IndexType cap )
inlinestatic

◆ EvaluateMeetingPositionCost()

void Simulators::MPSDummySimulator::EvaluateMeetingPositionCost ( IndexType meetPosition,
const std::vector< std::shared_ptr< Circuits::IOperation<> > > & upcomingGates,
long long int currentGateIndex,
int lookaheadDepth,
int lookaheadDepthWithHeuristic,
double currentCost,
double & bestCost,
bool useSameDummy = false )
inline

Definition at line 516 of file MPSDummySimulator.h.

◆ FindBestMeetingPosition()

IndexType Simulators::MPSDummySimulator::FindBestMeetingPosition ( const std::vector< std::shared_ptr< Circuits::IOperation<> > > & upcomingGates,
long long int currentGateIndex,
int lookaheadDepth,
int lookaheadDepthWithHeuristic,
double currentCost,
double & bestCost )
inline

Definition at line 546 of file MPSDummySimulator.h.

Referenced by SelectMeetingPositionAdaptive().

◆ GateSchmidtRank()

double Simulators::MPSDummySimulator::GateSchmidtRank ( const Circuits::IQuantumGate<> & gate)
inlinestatic

◆ getCurrentBondDimensions()

const std::vector< double > & Simulators::MPSDummySimulator::getCurrentBondDimensions ( ) const
inline

Definition at line 470 of file MPSDummySimulator.h.

◆ getGrowthFactorGate()

double Simulators::MPSDummySimulator::getGrowthFactorGate ( ) const
inline

Definition at line 120 of file MPSDummySimulator.h.

◆ getGrowthFactorSwap()

double Simulators::MPSDummySimulator::getGrowthFactorSwap ( ) const
inline

Definition at line 115 of file MPSDummySimulator.h.

◆ getMaxBondDimensions()

const std::vector< double > & Simulators::MPSDummySimulator::getMaxBondDimensions ( ) const
inline

Definition at line 475 of file MPSDummySimulator.h.

◆ getMinLayoutGain()

double Simulators::MPSDummySimulator::getMinLayoutGain ( ) const
inline

Definition at line 202 of file MPSDummySimulator.h.

◆ getNrQubits()

size_t Simulators::MPSDummySimulator::getNrQubits ( ) const
inline

Definition at line 86 of file MPSDummySimulator.h.

Referenced by ApplyGate(), ApplyTwoQubitGate(), and ComputeOptimalQubitsMap().

◆ getQubitsMap()

const std::vector< IndexType > & Simulators::MPSDummySimulator::getQubitsMap ( ) const
inline

Definition at line 480 of file MPSDummySimulator.h.

◆ getQubitsMapInv()

const std::vector< IndexType > & Simulators::MPSDummySimulator::getQubitsMapInv ( ) const
inline

Definition at line 485 of file MPSDummySimulator.h.

◆ getTotalSwappingCost()

double Simulators::MPSDummySimulator::getTotalSwappingCost ( ) const
inline

Definition at line 495 of file MPSDummySimulator.h.

Referenced by ComputeOptimalQubitsMap(), and SelectMeetingPositionAdaptive().

◆ InvalidateMemoCache()

void Simulators::MPSDummySimulator::InvalidateMemoCache ( )
inline

◆ IsControlledTwoQubitGateType()

bool Simulators::MPSDummySimulator::IsControlledTwoQubitGateType ( Circuits::QuantumGateType type)
inlinestatic

Definition at line 148 of file MPSDummySimulator.h.

References Simulators::IsControlledRoutingGate().

◆ IsOperatorChain()

bool Simulators::MPSDummySimulator::IsOperatorChain ( ) const
inline

Definition at line 91 of file MPSDummySimulator.h.

◆ print()

void Simulators::MPSDummySimulator::print ( ) const
inline

Definition at line 300 of file MPSDummySimulator.h.

◆ RecordAdjacentTwoQubitGate()

void Simulators::MPSDummySimulator::RecordAdjacentTwoQubitGate ( IndexType bond,
bool isSwapGate,
double schmidtRank )
inline

Definition at line 424 of file MPSDummySimulator.h.

References kPostGateCostWeight.

Referenced by ApplyTwoQubitGate().

◆ RelabelQubits()

void Simulators::MPSDummySimulator::RelabelQubits ( IndexType q1,
IndexType q2 )
inline

Definition at line 106 of file MPSDummySimulator.h.

Referenced by ApplyGate().

◆ ResetBondDimensions()

void Simulators::MPSDummySimulator::ResetBondDimensions ( )
inline

Definition at line 220 of file MPSDummySimulator.h.

Referenced by SetInitialQubitsMap().

◆ SelectMeetingPositionAdaptive()

IndexType Simulators::MPSDummySimulator::SelectMeetingPositionAdaptive ( const std::vector< std::shared_ptr< Circuits::IOperation<> > > & upcomingGates,
long long int currentGateIndex,
int lookaheadDepth,
int lookaheadDepthWithHeuristic,
double currentCost,
double & bestCost )
inline

◆ SetCurrentBondDimensions()

void Simulators::MPSDummySimulator::SetCurrentBondDimensions ( const std::vector< double > & dims)
inline

Definition at line 459 of file MPSDummySimulator.h.

References BondCost().

◆ setGrowthFactorGate()

void Simulators::MPSDummySimulator::setGrowthFactorGate ( double factor)
inline

◆ setGrowthFactorSwap()

void Simulators::MPSDummySimulator::setGrowthFactorSwap ( double factor)
inline

◆ SetInitialQubitsMap()

void Simulators::MPSDummySimulator::SetInitialQubitsMap ( const std::vector< long long int > & initialMap)
inline

Definition at line 452 of file MPSDummySimulator.h.

References ResetBondDimensions(), and SetRoutingMap().

Referenced by ComputeOptimalQubitsMap().

◆ SetMaxBondDimension()

void Simulators::MPSDummySimulator::SetMaxBondDimension ( IndexType val)
inline

◆ setMinLayoutGain()

void Simulators::MPSDummySimulator::setMinLayoutGain ( double gain)
inline

Definition at line 207 of file MPSDummySimulator.h.

◆ SetRoutingCostModel()

void Simulators::MPSDummySimulator::SetRoutingCostModel ( IndexType cap,
double weight )
inline

◆ SetRoutingMap()

void Simulators::MPSDummySimulator::SetRoutingMap ( const std::vector< long long int > & actualMap)
inline

Definition at line 445 of file MPSDummySimulator.h.

Referenced by SetInitialQubitsMap().

◆ SetSwapGatesRelabelQubits()

void Simulators::MPSDummySimulator::SetSwapGatesRelabelQubits ( bool enabled)
inline

◆ setTotalSwappingCost()

void Simulators::MPSDummySimulator::setTotalSwappingCost ( double cost)
inline

Definition at line 490 of file MPSDummySimulator.h.

Referenced by SelectMeetingPositionAdaptive().

◆ SwapQubitsToPosition()

void Simulators::MPSDummySimulator::SwapQubitsToPosition ( IndexType qubit1,
IndexType qubit2,
IndexType meetPosition )
inline

Definition at line 2666 of file MPSDummySimulator.h.

References kPostSwapCostWeight.

Referenced by SelectMeetingPositionAdaptive().

Member Data Documentation

◆ kPostGateCostWeight

double Simulators::MPSDummySimulator::kPostGateCostWeight = 0.5
staticconstexpr

Definition at line 126 of file MPSDummySimulator.h.

Referenced by RecordAdjacentTwoQubitGate().

◆ kPostSwapCostWeight

double Simulators::MPSDummySimulator::kPostSwapCostWeight = 0.25
staticconstexpr

Definition at line 125 of file MPSDummySimulator.h.

Referenced by SwapQubitsToPosition().


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