Skip to content

Commit

Permalink
Fix endiannnes
Browse files Browse the repository at this point in the history
  • Loading branch information
WrathfulSpatula committed Jun 4, 2024
1 parent 9c395e6 commit e4ede09
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions pennylane_qrack/qrack_device.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -747,16 +747,15 @@ struct QrackDevice final : public Catalyst::Runtime::QuantumDevice {
void PartialProbs(DataView<double, 1> &p, const std::vector<QubitIdType> &wires) override
{
RT_FAIL_IF((size_t)Qrack::pow2(wires.size()) != p.size(), "Invalid size for the pre-allocated probabilities vector");
reverseWires();
auto &&dev_wires = getDeviceWires(wires);
std::reverse(dev_wires.begin(), dev_wires.end());
#if FPPOW == 6
qsim->ProbBitsAll(dev_wires, &(*(p.begin())));
#else
std::unique_ptr<Qrack::real1> _p(new Qrack::real1[p.size()]);
qsim->ProbBitsAll(dev_wires, _p.get());
std::copy(_p.get(), _p.get() + p.size(), p.begin());
#endif
reverseWires();
}
void Sample(DataView<double, 2> &samples, size_t shots) override
{
Expand Down Expand Up @@ -787,7 +786,7 @@ struct QrackDevice final : public Catalyst::Runtime::QuantumDevice {
auto &&dev_wires = getDeviceWires(wires);
std::vector<bitCapInt> qPowers(dev_wires.size());
for (size_t i = 0U; i < qPowers.size(); ++i) {
qPowers[i] = Qrack::pow2((bitLenInt)dev_wires[qPowers.size() - (i + 1U)]);
qPowers[i] = Qrack::pow2(dev_wires[qPowers.size() - (i + 1U)]);
}
auto q_samples = qsim->MultiShotMeasureMask(qPowers, shots);

Expand Down

0 comments on commit e4ede09

Please sign in to comment.