Skip to content
This repository was archived by the owner on Dec 7, 2021. It is now read-only.

Commit 08ea5a4

Browse files
[Stable] Prepare 0.9.5 release (#1630)
* Fix QubitConverter import in Migration Tutorial (#1625) * Fix lint errors (#1626) * Remove jaxlib pin from CI (#1628) * Handle new yfinance, fix bugs in provider (#1629) * Prepare 0.9.5 release
1 parent b481123 commit 08ea5a4

File tree

39 files changed

+172
-150
lines changed

39 files changed

+172
-150
lines changed

.github/workflows/main.yml

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -130,13 +130,6 @@ jobs:
130130
- uses: ./.github/actions/install-main-dependencies
131131
if: ${{ !startsWith(github.ref, 'refs/heads/stable') && !startsWith(github.base_ref, 'stable/') }}
132132
- uses: ./.github/actions/install-aqua
133-
- name: Install Dependencies
134-
run: |
135-
# pin jax and jaxlib as the latest jaxlib 0.1.60 forces
136-
# numpy 1.19.5 to be installed which causes cvxpy failure to load
137-
# with 'numpy.core.multiarray failed to import.' error.
138-
pip install -U jax==0.2.9 jaxlib==0.1.59
139-
shell: bash
140133
- name: Aqua Unit Tests under Python ${{ matrix.python-version }}
141134
uses: ./.github/actions/run-tests
142135
with:

docs/tutorials/Qiskit Algorithms Migration Guide.ipynb

Lines changed: 27 additions & 25 deletions
Large diffs are not rendered by default.

qiskit/aqua/VERSION.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
0.9.4
1+
0.9.5

qiskit/aqua/algorithms/distribution_learners/qgan.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -279,7 +279,8 @@ def get_rel_entr(self) -> float:
279279
return rel_entr
280280

281281
def _store_params(self, e, d_loss, g_loss, rel_entr):
282-
with open(os.path.join(self._snapshot_dir, 'output.csv'), mode='a') as csv_file:
282+
with open(os.path.join(self._snapshot_dir, 'output.csv'),
283+
mode='a', encoding="utf8") as csv_file:
283284
fieldnames = ['epoch', 'loss_discriminator',
284285
'loss_generator', 'params_generator', 'rel_entropy']
285286
writer = csv.DictWriter(csv_file, fieldnames=fieldnames)
@@ -296,7 +297,8 @@ def train(self):
296297
AquaError: Batch size bigger than the number of items in the truncated data set
297298
"""
298299
if self._snapshot_dir is not None:
299-
with open(os.path.join(self._snapshot_dir, 'output.csv'), mode='w') as csv_file:
300+
with open(os.path.join(self._snapshot_dir, 'output.csv'),
301+
mode='w', encoding="utf8") as csv_file:
300302
fieldnames = ['epoch', 'loss_discriminator', 'loss_generator', 'params_generator',
301303
'rel_entropy']
302304
writer = csv.DictWriter(csv_file, fieldnames=fieldnames)

qiskit/aqua/algorithms/factorizers/shor.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -394,7 +394,7 @@ def _run(self) -> AlgorithmResult:
394394
)
395395
up_qreg_density_mat_diag = np.diag(up_qreg_density_mat)
396396

397-
counts = dict()
397+
counts = {}
398398
for i, v in enumerate(up_qreg_density_mat_diag):
399399
if not v == 0:
400400
counts[bin(int(i))[2:].zfill(2 * self._n)] = v ** 2

qiskit/aqua/algorithms/minimum_eigen_solvers/cplex/classical_cplex.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -288,7 +288,7 @@ def z_sol(self):
288288

289289
def dump(self, filename):
290290
""" dump """
291-
with open(filename, 'w') as outfile:
291+
with open(filename, 'w', encoding="utf8") as outfile:
292292
outfile.write('# objective {}\n'.format(self.objective))
293293
outfile.write('# elapsed time {}\n'.format(self._elapsed))
294294
writer = csv.writer(outfile, delimiter=self.delimiter)

qiskit/aqua/components/neural_networks/discriminative_network.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ def __init__(self) -> None:
3333
super().__init__()
3434
self._num_parameters = 0
3535
self._num_qubits = 0
36-
self._bounds = list() # type: List[object]
36+
self._bounds = [] # type: List[object]
3737
warn_package('aqua.components.neural_networks',
3838
'qiskit_machine_learning.algorithms.distribution_learners.qgan',
3939
'qiskit-machine-learning')

qiskit/aqua/components/neural_networks/generative_network.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ def __init__(self):
2828
super().__init__()
2929
self._num_parameters = 0
3030
self._num_qubits = 0
31-
self._bounds = list()
31+
self._bounds = []
3232
warn_package('aqua.components.neural_networks',
3333
'qiskit_machine_learning.algorithms.distribution_learners.qgan',
3434
'qiskit-machine-learning')

qiskit/aqua/components/optimizers/adam_amsgrad.py

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
1-
21
# This code is part of Qiskit.
32
#
4-
# (C) Copyright IBM 2019, 2020.
3+
# (C) Copyright IBM 2019, 2021.
54
#
65
# This code is licensed under the Apache License, Version 2.0. You may
76
# obtain a copy of this license in the LICENSE.txt file in the root directory
@@ -99,7 +98,8 @@ def __init__(self,
9998

10099
if self._snapshot_dir:
101100

102-
with open(os.path.join(self._snapshot_dir, 'adam_params.csv'), mode='w') as csv_file:
101+
with open(os.path.join(self._snapshot_dir, 'adam_params.csv'),
102+
mode='w', encoding="utf8") as csv_file:
103103
if self._amsgrad:
104104
fieldnames = ['v', 'v_eff', 'm', 't']
105105
else:
@@ -127,13 +127,15 @@ def save_params(self, snapshot_dir: str) -> None:
127127
snapshot_dir: The directory to store the file in.
128128
"""
129129
if self._amsgrad:
130-
with open(os.path.join(snapshot_dir, 'adam_params.csv'), mode='a') as csv_file:
130+
with open(os.path.join(snapshot_dir, 'adam_params.csv'),
131+
mode='a', encoding="utf8") as csv_file:
131132
fieldnames = ['v', 'v_eff', 'm', 't']
132133
writer = csv.DictWriter(csv_file, fieldnames=fieldnames)
133134
writer.writerow({'v': self._v, 'v_eff': self._v_eff,
134135
'm': self._m, 't': self._t})
135136
else:
136-
with open(os.path.join(snapshot_dir, 'adam_params.csv'), mode='a') as csv_file:
137+
with open(os.path.join(snapshot_dir, 'adam_params.csv'),
138+
mode='a', encoding="utf8") as csv_file:
137139
fieldnames = ['v', 'm', 't']
138140
writer = csv.DictWriter(csv_file, fieldnames=fieldnames)
139141
writer.writerow({'v': self._v, 'm': self._m, 't': self._t})
@@ -144,7 +146,8 @@ def load_params(self, load_dir: str) -> None:
144146
Args:
145147
load_dir: The directory containing ``adam_params.csv``.
146148
"""
147-
with open(os.path.join(load_dir, 'adam_params.csv'), mode='r') as csv_file:
149+
with open(os.path.join(load_dir, 'adam_params.csv'),
150+
mode='r', encoding="utf8") as csv_file:
148151
if self._amsgrad:
149152
fieldnames = ['v', 'v_eff', 'm', 't']
150153
else:

qiskit/aqua/components/oracles/logical_expression_oracle.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# This code is part of Qiskit.
22
#
3-
# (C) Copyright IBM 2019, 2020.
3+
# (C) Copyright IBM 2019, 2021.
44
#
55
# This code is licensed under the Apache License, Version 2.0. You may
66
# obtain a copy of this license in the LICENSE.txt file in the root directory
@@ -223,7 +223,7 @@ def evaluate_classically(self, measurement):
223223
""" evaluate classically """
224224
assignment = [(var + 1) * (int(tf) * 2 - 1) for tf, var in zip(measurement[::-1],
225225
range(len(measurement)))]
226-
assignment_dict = dict()
226+
assignment_dict = {}
227227
for v in assignment:
228228
assignment_dict[self._lit_to_var[abs(v)]] = bool(v > 0)
229229
return self._expr.subs(assignment_dict), assignment

0 commit comments

Comments
 (0)