Public Member Functions | Protected Attributes | List of all members
xacc::AcceleratorBuffer Class Reference

Public Member Functions

 AcceleratorBuffer (const int N)
 AcceleratorBuffer (const std::string &str, const int N)
 AcceleratorBuffer (const AcceleratorBuffer &other)
void useAsCache ()
void appendChild (const std::string name, std::shared_ptr< AcceleratorBuffer > buffer)
std::vector< std::shared_ptr< AcceleratorBuffer > > getChildren (const std::string name)
std::vector< std::shared_ptr< AcceleratorBuffer > > getChildren ()
std::vector< std::string > getChildrenNames ()
void addExtraInfo (const std::string infoName, ExtraInfo i)
bool addExtraInfo (const std::string infoName, ExtraInfo i, AddPredicate predicate)
std::vector< std::string > listExtraInfoKeys ()
bool hasExtraInfoKey (const std::string infoName)
ExtraInfo getInformation (const std::string name)
std::map< std::string, ExtraInfogetInformation ()
std::shared_ptr< AcceleratorBufferclone ()
std::map< int, int > getBitMap ()
void setBitIndexMap (const std::map< int, int > bitMap)
const int nChildren ()
std::vector< std::shared_ptr< AcceleratorBuffer > > getChildren (const std::string infoName, ExtraInfo i)
std::vector< ExtraInfogetAllUnique (const std::string name)
void removeChild (const std::size_t idx)
void setSize (const int s)
const int size () const
const std::string name () const
virtual void resetBuffer ()
virtual void appendMeasurement (const std::string &measurement)
virtual void appendMeasurement (const std::string measurement, const int count)
virtual double computeMeasurementProbability (const std::string &bitStr)
virtual const double getExpectationValueZ ()
virtual void setExpectationValueZ (const double exp)
virtual const std::vector< std::string > getMeasurements ()
virtual std::map< std::string, int > getMeasurementCounts ()
virtual void clearMeasurements ()
virtual void setMeasurements (std::map< std::string, int > counts)
virtual void print ()
const std::string toString ()
void measure (std::size_t bit_idx, int bit)
void reset_single_measurements ()
void setName (const std::string n)
virtual void print (std::ostream &stream)
virtual void load (std::istream &stream)
bool operator[] (const std::size_t &i)
const ExtraInfo operator[] (const std::string &key)

Protected Attributes

std::map< std::string, int > bitStringToCounts
std::string bufferId
int nBits
std::vector< AcceleratorBufferChildPair > children
std::map< std::string, ExtraInfoinfo
bool cacheFile = false
std::map< int, int > bit2IndexMap
std::map< std::size_t, bool > single_measurements

Member Function Documentation

const double xacc::AcceleratorBuffer::getExpectationValueZ ( )

Compute and return the expectation value with respect to the Pauli-Z operator. Here we provide a base implementation based on an ensemble of measurement results. Subclasses are free to implement this as they see fit, ie, for simulators use the wavefunction.

expVal The expectation value
const std::vector< std::string > xacc::AcceleratorBuffer::getMeasurements ( )

Return all measurements as bit strings.

bitStrings List of bit strings.
const std::string xacc::AcceleratorBuffer::name ( ) const

Return this AcceleratorBuffer's name

name The name of this AcceleratorBuffer
void xacc::AcceleratorBuffer::print ( )

Print information about this AcceleratorBuffer to standard out.

void xacc::AcceleratorBuffer::print ( std::ostream &  stream)

Print information about this AcceleratorBuffer to the given output stream.

streamStream to write the buffer to.
void xacc::AcceleratorBuffer::resetBuffer ( )

Reset the stored measured bit strings.

const int xacc::AcceleratorBuffer::size ( ) const

Return the number of bits in this buffer.

size The number of bits in this buffer

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