Class Operation

Inheritance Relationships

Derived Types

Class Documentation

class blackbird::Operation

The base class inherited by all quantum operations. This defines public attributes common to all operations, such as gate name, modes it acts on, number of parameters, number of modes it acts on, as well as parameter details.

It also defines some utility methods for printing out gate information.

Subclassed by blackbird::BSgate, blackbird::Catstate, blackbird::CKgate, blackbird::Coherent, blackbird::CXgate, blackbird::CZgate, blackbird::Dgate, blackbird::Fock, blackbird::Gaussian, blackbird::GaussianTransform, blackbird::Interferometer, blackbird::LossChannel, blackbird::MeasureFock, blackbird::MeasureHeterodyne, blackbird::MeasureHomodyne, blackbird::MeasureIntensity, blackbird::Pgate, blackbird::Rgate, blackbird::S2gate, blackbird::Sgate, blackbird::Squeezed, blackbird::Thermal, blackbird::ThermalLossChannel, blackbird::Vacuum, blackbird::Vgate, blackbird::Xgate, blackbird::Zgate

Public Functions

inline void print_op()

Print operation information in Blackbird syntax for an operation with zero parameters.

template<typename T>
inline void print_op(T p1)

Print operation information in Blackbird syntax for an operation with one parameter.

Parameters

p1 – parameter 1

template<typename T, typename S>
inline void print_op(T p1, S p2)

Print operation information in Blackbird syntax for an operation with two parameters.

Parameters
  • p1 – parameter 1

  • p2 – parameter 2

template<typename T, typename S, typename O>
inline void print_op(T p1, S p2, O p3)

Print operation information in Blackbird syntax for an operation with three parameters.

Parameters
  • p1 – parameter 1

  • p2 – parameter 2

  • p3 – parameter 3

template<typename T>
inline void print_array_op(T p1)

Print operation information in Blackbird syntax for an operation with an array parameter.

Parameters

p1 – the array parameter

template<typename T, typename S>
inline void print_array_op(T p1, S p2)

Print operation information in Blackbird syntax for an operation with two array parameters.

Parameters
  • p1 – the first array parameter

  • p2 – the second array parameter

inline void check_num_args(int args_size)

Checks that the number of gate parameters matches the allowed number of gate parameters.

Parameters

args_size – user provided number of parameters

Throws

std::invalid_argument

inline void check_num_modes(int mode_size)

Checks that the number of modes applied matches the allowed number of modes for the gate.

Parameters

mode_size – user provided number of modes

Throws

std::invalid_argument

Public Members

Gate gate

gate type

intvec modes

modes the gate applies to

std::string name

name of the gate

int num_params

number of params gate accepts

ParDomain domain

the domain of the parameters

int num_modes

number of modes the gate is allowed to act on

int i1

integer paramter 1

double f1

real parameter 1

double f2

real parameter 2

double f3

real parameter 3

std::complex<double> c1

compelx parameter 1

complexmat U1

complex matrix parameter 1

floatmat S1

real matrix parameter 1

floatmat S2

real matrix parameter 2