Skip to content

Commit 5266740

Browse files
committed
test,coverage,black
1 parent af61a22 commit 5266740

15 files changed

+1452
-120
lines changed

.github/workflows/build.yml

Lines changed: 4 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,10 @@ name: Python package
33
on:
44
push:
55
branches:
6-
- main
6+
- master
77
pull_request:
88
branches:
9-
- main
9+
- master
1010

1111
jobs:
1212

@@ -16,8 +16,8 @@ jobs:
1616
strategy:
1717
fail-fast: false
1818
matrix:
19-
os: ['ubuntu-latest', 'macos-latest', 'windows-latest']
20-
python-version: ['3.8', '3.9']
19+
os: ['ubuntu-latest']
20+
python-version: ['3.9']
2121
steps:
2222
- uses: actions/checkout@v3
2323
- name: Set up Python ${{ matrix.python-version }}
@@ -37,28 +37,3 @@ jobs:
3737
run: pytest -v
3838
- name: Verify that we can build the package
3939
run: python3 setup.py sdist bdist_wheel
40-
41-
# lint:
42-
# name: Linting build
43-
# runs-on: ubuntu-latest
44-
# strategy:
45-
# fail-fast: false
46-
# steps:
47-
# - uses: actions/checkout@v3
48-
# - name: Set up Python 3.9
49-
# uses: actions/setup-python@v3
50-
# with:
51-
# python-version: 3.9
52-
# - name: Python info
53-
# shell: bash -l {0}
54-
# run: |
55-
# which python3
56-
# python3 --version
57-
# - name: Upgrade pip and install dependencies
58-
# run: |
59-
# python3 -m pip install --upgrade pip setuptools
60-
# python3 -m pip install .[dev,publishing]
61-
# - name: Check style against standards using prospector
62-
# run: prospector
63-
# - name: Check import order
64-
# run: isort --check-only qubops --diff

.github/workflows/coverage.yml

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
name: Code coverage
2+
3+
on:
4+
push:
5+
branches:
6+
- master
7+
pull_request:
8+
branches:
9+
- master
10+
11+
jobs:
12+
coverage:
13+
runs-on: ubuntu-latest
14+
timeout-minutes: 60
15+
steps:
16+
- uses: actions/checkout@v4
17+
- name: Set up Python 3.9
18+
uses: actions/setup-python@v4
19+
with:
20+
python-version: '3.9'
21+
- name: Install tox
22+
run: |
23+
python -m pip install --upgrade pip
24+
pip install tox coveragepy-lcov 'coverage<7'
25+
- name: Run coverage
26+
run: tox -ecoverage
27+
- name: Convert to lcov
28+
run: coveragepy-lcov --output_file_path coveralls.info
29+
- name: Upload report to Coveralls
30+
uses: coverallsapp/github-action@v2
31+
with:
32+
github-token: ${{ secrets.GITHUB_TOKEN }}
33+
file: coveralls.info
34+
format: lcov

README.md

Lines changed: 41 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,17 @@
11

22

33

4+
![Platform](https://img.shields.io/badge/platform-Linux-blue)
45
[![github repo badge](https://img.shields.io/badge/github-repo-000.svg?logo=github&labelColor=gray&color=blue)](https://github.com/QuantumApplicationLab/qubops)
5-
<!-- [![github license badge](https://img.shields.io/github/license/QuantumApplicationLab/qubops)](https://github.com/QuantumApplicationLab/qubops)
6-
[![RSD](https://img.shields.io/badge/rsd-qubops-00a3e3.svg)](https://www.research-software.nl/software/qubops)
7-
[![workflow pypi badge](https://img.shields.io/pypi/v/qubops.svg?colorB=blue)](https://pypi.python.org/project/qubops/) | -->
6+
[![github license badge](https://img.shields.io/github/license/QuantumApplicationLab/qubops)](https://github.com/QuantumApplicationLab/qubops)
7+
[![Python](https://img.shields.io/badge/Python-3.8-informational)](https://www.python.org/)
8+
[![Code style: Black](https://img.shields.io/badge/Code%20style-Black-000.svg)](https://github.com/psf/black)
9+
[![Tests](https://github.com/quantumapplicationlab/qubops/actions/workflows/build.yml/badge.svg)](https://github.com/quantumapplicationlab/qubops/actions/workflows/build.yml)
10+
[![Coverage Status](https://coveralls.io/repos/github/QuantumApplicationLab/qubops/badge.svg?branch=master)](https://coveralls.io/github/QuantumApplicationLab/qubops?branch=master)
811

9-
![qubols](./docs/qubols_illustration.png)
12+
![qubops](./docs/qubols_illustration.png)
1013

11-
## Use
14+
## QUBOPS
1215
`qubops` allows solving polynomial system of equations using a QUBO formalism. An example can be found [here](./example/qubops.ipynb)
1316

1417
## Installation
@@ -20,11 +23,42 @@ git clone https://github.com/QuantumApplicationLab/qubops.git
2023
cd qubops
2124
python3 -m pip install .
2225
```
26+
## Example
2327

24-
<!-- ## Documentation
28+
```python
2529

26-
Include a link to your project's full documentation here. -->
30+
from qubops.qubops_mixed_vars import QUBOPS_MIXED
31+
from qubops.encodings import PositiveQbitEncoding
32+
from qubops.solution_vector import SolutionVector_V2 as SolutionVector
33+
from qubops.mixed_solution_vector import MixedSolutionVector_V2 as MixedSolutionVector
34+
from dwave.samplers import SteepestDescentSolver
2735

36+
def define_matrices():
37+
"""function that creates the polynom matrices for the system."""
38+
# see documentation for more information
39+
return matrices
40+
41+
# define the encoding for the first two varialbes
42+
nqbit = 5
43+
step = 0.05
44+
encoding1 = PositiveQbitEncoding(nqbit = nqbit, step=step, offset=0, var_base_name='x')
45+
sol_vec1 = SolutionVector(2, encoding=encoding1)
46+
47+
# define the encoding for the alst two variables
48+
nqbit = 4
49+
step = 0.05
50+
encoding2 = PositiveQbitEncoding(nqbit = nqbit, step=step, offset=0, var_base_name='x')
51+
sol_vec2 = SolutionVector(2, encoding=encoding2)
52+
53+
# define the solution vector
54+
sol_vec = MixedSolutionVector([sol_vec1,sol_vec2])
55+
56+
# instantiat the QUBOPS solver
57+
options = {'num_reads':10000, 'sampler':SteepestDescentSolver()}
58+
qubo = QUBOPS_MIXED(sol_vec, options)
59+
sol = qubo.solve(define_matrices(), strength=1E5)
60+
61+
```
2862
## Contributing
2963

3064
If you want to contribute to the development of qubops,

0 commit comments

Comments
 (0)