Preparing the catalog and filters…Katalog ve filtreler hazırlanıyor…
Starter code
module spsa_lab;
@seed(37);
param w: Angle = 1.2;
fn main() {
let q = qreg[1];
Ry(q[0], w);
let cost = expect Z(q[0]);
train {
objective: minimize cost;
optimizer: spsa(a = 0.2, c = 0.1);
steps: 80;
}
return cost;
}Expected output
SPSA reports midpoint cost history
The run is reproducible with @seed
The final cost improves
Noise remains explicitly annotated
Debugging checklist
Run seeded SPSA
Swap optimizer to gd, momentum, and adam
Record final cost for each
Add depolarizing noise 0.05
Compare equal evaluation budgets
Extension challenge
Tune SPSA a and c while preserving the same seed and explain the trade-off.