Skip to content

Commit

Permalink
[Bugfix] Changing shift interval for multigap GGPSR (#297)
Browse files Browse the repository at this point in the history
Following this [Qadence
MR](pasqal-io/qadence#616), where I quote
@vytautas-a :

`I suspect that due to some symmetries in matrices computed during GPSR
calculations, results with some generators are not correct. Breaking
this symmetry of shifts around pi/2 helps in this regard.`

Changing the interval for multigap GPSR to not be symmetric.

---------
  • Loading branch information
chMoussa authored Nov 19, 2024
1 parent a11da37 commit b7f775e
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion pyqtorch/differentiation/gpsr.py
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ def multi_gap_shift(
spectral_gaps = spectral_gaps.to(device=device)
PI = torch.tensor(torch.pi, dtype=dtype)
shifts = shift_prefac * torch.linspace(
PI / 2.0 - PI / 5.0, PI / 2.0 + PI / 5.0, n_eqs, dtype=dtype
PI / 2.0 - PI / 4.0, PI / 2.0 + PI / 5.0, n_eqs, dtype=dtype
)
shifts = shifts.to(device=device)

Expand Down
2 changes: 1 addition & 1 deletion tests/test_analog.py
Original file line number Diff line number Diff line change
Expand Up @@ -342,7 +342,7 @@ def test_timedependent(
state=psi_start, values=values, embedding=embedding
).reshape(-1, batch_size)

assert torch.allclose(psi_solver, psi_hamevo, rtol=RTOL, atol=ATOL)
assert torch.allclose(psi_solver, psi_hamevo, rtol=RTOL, atol=1.0e-3)


@pytest.mark.parametrize("n_qubits", [2, 4, 6])
Expand Down

0 comments on commit b7f775e

Please sign in to comment.