Template Class OpsData¶
Defined in File JacobianTape.hpp
Class Documentation¶
-
template<class T>
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<T>> &ops_params, std::vector<std::vector<size_t>> ops_wires, std::vector<bool> ops_inverses, std::vector<std::vector<std::complex<T>>> 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<T>> &ops_params, std::vector<std::vector<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<T>> &ops_params, const std::vector<std::vector<size_t>> &ops_wires, const std::vector<bool> &ops_inverses, const std::vector<std::vector<std::complex<T>>> &ops_matrices)
-
inline auto getSize() const -> size_t¶
Get the number of operations to be applied.
- Returns
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<T>>&¶
Get the (optional) parameters for each operation. Given entries are empty ({}) if not required.
- Returns
const std::vector<std::vector<T>>&
-
inline auto getOpsWires() const -> const std::vector<std::vector<size_t>>&¶
Get the wires for each operation.
- Returns
const std::vector<std::vector<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<std::complex<T>>>&¶
Get the numerical matrix for a given unsupported operation. Given entries are empty ({}) if not required.
- Returns
const std::vector<std::vector<std::complex<T>>>&
-
inline auto hasParams(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 -> size_t¶
Get the number of parametric operations.
- Returns
size_t
-
inline auto getNumNonParOps() const -> size_t¶
Get the number of non-parametric ops.
- Returns
size_t
-
inline auto getTotalNumParams() const -> size_t¶
Get total number of parameters.
-
inline OpsData(std::vector<std::string> ops_name, const std::vector<std::vector<T>> &ops_params, std::vector<std::vector<size_t>> ops_wires, std::vector<bool> ops_inverses, std::vector<std::vector<std::complex<T>>> ops_matrices)¶