Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,10 @@ Thank you for considering contributing! We welcome all kinds of contributions—
---

## How to Contribute
Feel free to submit a "pull request" on GitHub in a designated feature branch. Include comments about what the fix/update does.
Feel free to submit a "pull request" on GitHub in a designated feature branch. Include comments about what the fix/update does, and ensure the tests work by running:
```python
states = res.run(timeseries)
```

For new features, please also consider updating the examples folder to show the intended use of the feature.

Expand Down
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,11 @@ This will return a `np.ndarray` of the same length as the timeseries, correspond

`Incremental` reservoirs run incrementally. For every state, only the last `M` steps of the timeseries is built at a time (`M` being a parameter of `Incremental.__init__`).

## Testing
Some tests have been implemented using pytest. To run them, ensure pytest is installed (*not* installed as runtime dependency) and run
```python
pytest
```
## About

You can find out more about QuantumReservoirPy and contact the authors [here](https://quantumreservoirpy.readthedocs.io/en/latest/about/).
Expand Down
1 change: 1 addition & 0 deletions paper.bib
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ @InProceedings{trouvain20
and Pedrelli, Luca
and Dinh, Thanh Trung
and Hinaut, Xavier",
doi = {10.1007/978-3-030-61616-8_40},
editor="Farka{\v{s}}, Igor
and Masulli, Paolo
and Wermter, Stefan",
Expand Down
3 changes: 1 addition & 2 deletions paper.md
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,7 @@ The processing methods do not affect the creation of the reservoirs, but are inc

## Dependencies

The three main dependencies of `QuantumReservoirPy` are numpy, qiskit, and scikit-learn.
We strive for `QuantumReservoirPy` to support compatibility with existing reservoir computing and quantum computing workflows.
The three main dependencies of `QuantumReservoirPy` are numpy, qiskit, and scikit-learn, with python versions above 3.9. Qiskit is [deprecating](https://github.com/Qiskit/qiskit/releases) python 3.9 support in the 2.1.0 version, and the package presented here is developed to support qiskit=2.0.x. As for the other packages, the supported versions of scikit-learn and numpy follows from their interrelated constraints as well as the constraint from qiskit. In the install script, we specify numpy>1.17. We strive for `QuantumReservoirPy` to support compatibility with existing reservoir computing and quantum computing workflows.

Much of existing research in QRC is performed on IBM devices and simulators (see [@yasuda23; @suzuki22]), programmed through the Qiskit software package. To minimize disruption in current workflows, `QuantumReservoirPy` is built as a package to interact with Qiskit circuits and backends. It is expected that the user also use Qiskit in the customization of reservoir architecture when working with `QuantumReservoirPy`.

Expand Down
4 changes: 2 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
"matplotlib",
"tqdm",
"pylatexenc>=2.0",
"qiskit>=1.0",
"qiskit<2.1.0",
"qiskit-aer>=0.12.0",
"numpy>=1.21.6",
"numpy>=1.17",
"scikit-learn",
"ipykernel"
]
Expand Down
7 changes: 7 additions & 0 deletions tests/test_imports.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
def test_import_main():
import quantumreservoirpy

def test_import_submodules():
from quantumreservoirpy import music
from quantumreservoirpy import reservoirs
from quantumreservoirpy import plot
34 changes: 34 additions & 0 deletions tests/test_run.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@


def test_incremental():
import numpy as np
from qiskit.quantum_info import random_unitary
from quantumreservoirpy.reservoirs import Incremental

encoder = {0: "00", 1: "01", 2: "10", 3: "11"}
SHOTS = 100


class RandomUnitary(Incremental):
def __init__(self, n_qubits, memory=np.inf, backend=None, num_features=8) -> None:
super().__init__(n_qubits, memory, backend, num_features)
self.operator = random_unitary(2**n_qubits)

def before(self, circuit):
circuit.h(circuit.qubits)

def during(self, circuit, timestep, reservoirnumber):
circuit.measure([0, 1])
circuit.initialize(encoder[timestep], [0, 1])
circuit.append(self.operator, circuit.qubits)

def after(self, circuit):
circuit.measure_all()


res = RandomUnitary(n_qubits=4, memory=8)

timestep = [0, 1, 2, 3, 0, 1, 2, 2, 3]
timeseries = timestep * 10

res.run(timeseries, shots=SHOTS)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could we test whether the results are correct after running? Possibly via some known analytical results?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The point of this test was to check if everything compiles and runs. It could be possible to compare the run to some analytical result, but that would be the subject of another test.