Template Class OpsData

Class Documentation

template<class StateVectorT>
class OpsData

Utility class for encapsulating operations used by AdjointJacobian class.

Public Functions

inline OpsData(std::vector<std::string> ops_name, const std::vector<std::vector<PrecisionT>> &ops_params, std::vector<std::vector<std::size_t>> ops_wires, std::vector<bool> ops_inverses, std::vector<std::vector<ComplexT>> ops_matrices, std::vector<std::vector<std::size_t>> ops_controlled_wires, std::vector<std::vector<bool>> ops_controlled_values)

Construct an OpsData object, representing the serialized operations to apply upon the StateVector.

Parameters
  • ops_name – Name of each operation to apply.

  • ops_params – Parameters for a given operation ({} if optional).

  • ops_wires – Wires upon which to apply operation.

  • ops_inverses – Value to represent whether given operation is adjoint.

  • ops_matrices – Numerical representation of given matrix if not supported.

  • ops_controlled_wires – Control wires

  • ops_controlled_wires – Control values

inline OpsData(std::vector<std::string> ops_name, const std::vector<std::vector<PrecisionT>> &ops_params, std::vector<std::vector<std::size_t>> ops_wires, std::vector<bool> ops_inverses, std::vector<std::vector<ComplexT>> ops_matrices)

Construct an OpsData object, representing the serialized operations to apply upon the StateVector.

Parameters
  • ops_name – Name of each operation to apply.

  • ops_params – Parameters for a given operation ({} if optional).

  • ops_wires – Wires upon which to apply operation

  • ops_inverses – Value to represent whether given operation is adjoint.

  • ops_matrices – Numerical representation of given matrix if not supported.

inline OpsData(const std::vector<std::string> &ops_name, const std::vector<std::vector<PrecisionT>> &ops_params, std::vector<std::vector<std::size_t>> ops_wires, std::vector<bool> ops_inverses)

Construct an OpsData object, representing the serialized operations to apply upon the StateVector.

See also

OpsData(const std::vector<std::string> &ops_name, const std::vector<std::vector<PrecisionT>> &ops_params, const std::vector<std::vector<std::size_t>> &ops_wires, const std::vector<bool> &ops_inverses, const std::vector<std::vector<ComplexT>> &ops_matrices)

inline auto getSize() const -> std::size_t

Get the number of operations to be applied.

Returns

std::size_t Number of operations.

inline auto getOpsName() const -> const std::vector<std::string>&

Get the names of the operations to be applied.

Returns

const std::vector<std::string>&

inline auto getOpsParams() const -> const std::vector<std::vector<PrecisionT>>&

Get the (optional) parameters for each operation. Given entries are empty ({}) if not required.

Returns

const std::vector<std::vector<PrecisionT>>&

inline auto getOpsWires() const -> const std::vector<std::vector<std::size_t>>&

Get the wires for each operation.

Returns

const std::vector<std::vector<std::size_t>>&

inline auto getOpsControlledWires() const -> const std::vector<std::vector<std::size_t>>&

Get the controlled wires for each operation.

Returns

const std::vector<std::vector<std::size_t>>&

inline auto getOpsControlledValues() const -> const std::vector<std::vector<bool>>&

Get the controlled values for each operation.

Returns

const std::vector<std::vector<std::size_t>>&

inline auto getOpsInverses() const -> const std::vector<bool>&

Get the adjoint flag for each operation.

Returns

const std::vector<bool>&

inline auto getOpsMatrices() const -> const std::vector<std::vector<ComplexT>>&

Get the numerical matrix for a given unsupported operation. Given entries are empty ({}) if not required.

Returns

const std::vector<std::vector<ComplexT>>&

inline auto hasParams(std::size_t index) const -> bool

Notify if the operation at a given index is parametric.

Parameters

index – Operation index.

Returns

true Gate is parametric (has parameters).

Returns

false Gate in non-parametric.

inline auto getNumParOps() const -> std::size_t

Get the number of parametric operations.

Returns

std::size_t

inline auto getNumNonParOps() const -> std::size_t

Get the number of non-parametric ops.

Returns

std::size_t

inline auto getTotalNumParams() const -> std::size_t

Get total number of parameters.