Skip to content

Commit

Permalink
add test with MatrixBlock and mention in docs
Browse files Browse the repository at this point in the history
  • Loading branch information
Charles MOUSSA committed Nov 26, 2024
1 parent b819959 commit 216614e
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
2 changes: 1 addition & 1 deletion docs/content/time_dependent.md
Original file line number Diff line number Diff line change
Expand Up @@ -80,4 +80,4 @@ print(out_state)
```

!!! warning "Noise operators definition"
Note it is not possible to define `noise_operators` with parametric operators, and `noise_operators` should have the same or a subset of the qubit support of the `HamEvo` instance.
Note it is not possible to define `noise_operators` with parametric operators. If you want to do so, we recommend obtaining the tensors via run and set `noise_operators` using `MatrixBlock`. Also, `noise_operators` should have the same or a subset of the qubit support of the `HamEvo` instance.
13 changes: 12 additions & 1 deletion tests/backends/pyq/test_time_dependent_generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
block_to_tensor,
run,
)
from qadence.blocks import MatrixBlock
from qadence.operations import RZ, I, X


Expand Down Expand Up @@ -65,7 +66,17 @@ def test_time_dependent_generator(


@pytest.mark.parametrize("duration", [0.5, 1.0])
@pytest.mark.parametrize("noise_op", [I(0) * I(1), X(0)])
@pytest.mark.parametrize(
"noise_op",
[
I(0) * I(1),
X(0),
MatrixBlock(
block_to_tensor(X(0), qubit_support=tuple(range(2)), use_full_support=True),
qubit_support=tuple(range(2)),
),
],
)
def test_noisy_time_dependent_generator(
qadence_generator: AbstractBlock,
qutip_generator: Callable,
Expand Down

0 comments on commit 216614e

Please sign in to comment.