16 if (qubits >= std::numeric_limits<size_t>::digits)
17 throw std::length_error(
"Full state output exceeds the basis-index range");
18 const size_t count =
size_t{1} << qubits;
19 if (count > std::vector<std::complex<double>>().max_size() || count > std::vector<double>().max_size() / 2)
20 throw std::length_error(
"Full state output is too large");
26 if (count >
static_cast<size_t>(std::numeric_limits<int>::max()))
27 throw std::length_error(
"Tensor query exceeds the backend count limit");
28 return static_cast<int>(count);
33 if (qubits.size() != matrices.size())
34 throw std::invalid_argument(
"Each operator must have one target qubit");
36 if (matrices.size() > std::vector<double>().max_size() / 8)
37 throw std::length_error(
"Operator matrices exceed the buffer size limit");
38 for (
size_t i = 0; i < qubits.size(); ++i)
40 if (qubits[i] >= width)
41 throw std::out_of_range(
"Operator target qubit is out of range");
42 if (matrices[i].rows() != 2 || matrices[i].cols() != 2 || !matrices[i].allFinite())
43 throw std::invalid_argument(
"Expectation operators must be finite 2x2 matrices");
54 explicit PauliBatch(
const std::vector<std::string> &paulis)
59 for (
const auto &pauli : paulis)
61 strings.push_back(pauli.c_str());
void Operators(const Types::qubits_vector &qubits, const std::vector< Eigen::MatrixXcd > &matrices, size_t width)
size_t DenseSize(size_t qubits)
std::vector< qubit_t > qubits_vector
The type of a vector of qubits.
std::vector< const char * > strings
PauliBatch(const std::vector< std::string > &paulis)
std::vector< int > lengths