AcceleratorBuffer

class AcceleratorBuffer

The AcceleratorBuffer models an allocated buffer of bits that are operated on by a kernel. As such, the AcceleratorBuffer’s primary role is to store Accelerator execution results.

Author

Alex McCaskey

Public Functions

AcceleratorBuffer(const std::string &str, const int N)

The Constructor

AcceleratorBuffer(const AcceleratorBuffer &other)

The copy constructor

std::vector<std::shared_ptr<AcceleratorBuffer>> getChildren(const std::string infoName, ExtraInfo i)

Return all children with ExtraInfo infoName equal to the given ExtraInfo i.

const int size() const

Return the number of bits in this buffer.

Return

size The number of bits in this buffer

const std::string name() const

Return this AcceleratorBuffer’s name

Return

name The name of this AcceleratorBuffer

void resetBuffer()

Reset the stored measured bit strings.

const double 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.

Return

expVal The expectation value

const std::vector<std::string> getMeasurements()

Return all measurements as bit strings.

Return

bitStrings List of bit strings.

void print()

Print information about this AcceleratorBuffer to standard out.

void print(std::ostream &stream)

Print information about this AcceleratorBuffer to the given output stream.

Parameters
  • stream: Stream to write the buffer to.

virtual ~AcceleratorBuffer()

The Destructor