Skip to content

Commit

Permalink
Don't parse shots
Browse files Browse the repository at this point in the history
  • Loading branch information
WrathfulSpatula committed Aug 26, 2024
1 parent c199134 commit 44a7a66
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 23 deletions.
2 changes: 0 additions & 2 deletions pennylane_qrack/QrackDeviceConfig.toml
Original file line number Diff line number Diff line change
Expand Up @@ -128,8 +128,6 @@ dynamic_qubit_management = true
# The option key will be the key in a dictionary.
# The string corresponds to a field queried in the `qml.Device` instance.

# Number of shots per job
shots = "shots"
# Use "hybrid" stabilizer optimization? (Default is "true"; non-Clifford circuits will fall back to near-Clifford or universal simulation)
is_hybrid_stabilizer = "isStabilizerHybrid"
# Use "tensor network" optimization? (Default is "true"; prevents dynamic qubit de-allocation; might function sub-optimally with "hybrid" stabilizer enabled)
Expand Down
36 changes: 15 additions & 21 deletions pennylane_qrack/qrack_device.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -399,15 +399,14 @@ struct QrackDevice final : public Catalyst::Runtime::QuantumDevice {
kwargs = trim(kwargs);

std::map<std::string, int> keyMap;
keyMap["'shots'"] = 1;
keyMap["'is_hybrid_stabilizer'"] = 2;
keyMap["'is_tensor_network'"] = 3;
keyMap["'is_schmidt_decomposed'"] = 4;
keyMap["'is_schmidt_decomposition_parallel'"] = 5;
keyMap["'is_qbdd'"] = 6;
keyMap["'is_gpu'"] = 7;
keyMap["'is_host_pointer'"] = 8;
keyMap["'is_noisy'"] = 9;
keyMap["'is_hybrid_stabilizer'"] = 1;
keyMap["'is_tensor_network'"] = 2;
keyMap["'is_schmidt_decomposed'"] = 3;
keyMap["'is_schmidt_decomposition_parallel'"] = 4;
keyMap["'is_qbdd'"] = 5;
keyMap["'is_gpu'"] = 6;
keyMap["'is_host_pointer'"] =7;
keyMap["'is_noisy'"] = 8;

size_t pos;
while ((pos = kwargs.find(":")) != std::string::npos) {
Expand All @@ -419,32 +418,27 @@ struct QrackDevice final : public Catalyst::Runtime::QuantumDevice {
const bool val = (value == "True");
switch (keyMap[key]) {
case 1:
if (value != "None") {
shots = std::stoi(value);
}
break;
case 2:
sh = val;
break;
case 3:
case 2:
tn = val;
break;
case 4:
case 3:
sd = val;
break;
case 5:
case 4:
md = val;
break;
case 6:
case 5:
bdt = val;
break;
case 7:
case 6:
oc = val;
break;
case 8:
case 7:
hp = val;
break;
case 9:
case 8:
nw = val;
break;
default:
Expand Down

0 comments on commit 44a7a66

Please sign in to comment.