Skip to content

Commit

Permalink
Debug Catalyst observables
Browse files Browse the repository at this point in the history
  • Loading branch information
WrathfulSpatula committed May 31, 2024
1 parent f1a21b9 commit 1dd3d70
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion pennylane_qrack/qrack_device.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -541,6 +541,9 @@ struct QrackDevice final : public Catalyst::Runtime::QuantumDevice {
auto Observable(ObsId id, const std::vector<std::complex<double>> &matrix,
const std::vector<QubitIdType> &wires) -> ObsIdType override
{
RT_FAIL_IF(wires.size() != 1U, "Cannot have observables besides tensor products of Pauli observables");
auto &&dev_wires = getDeviceWires(wires);

Qrack::Pauli basis = Qrack::PauliI;
switch (id) {
case ObsId::PauliX:
Expand All @@ -555,7 +558,7 @@ struct QrackDevice final : public Catalyst::Runtime::QuantumDevice {
default:
break;
}
obs_cache.push_back(QrackObservable({ basis }, { (bitLenInt)wires[0U] }));
obs_cache.push_back(QrackObservable({ basis }, { (bitLenInt)dev_wires[0U] }));

return obs_cache.size() - 1U;
}
Expand Down

0 comments on commit 1dd3d70

Please sign in to comment.