Skip to content

Commit

Permalink
Update tests to use qiskit_algorithms
Browse files Browse the repository at this point in the history
  • Loading branch information
ElePT committed Oct 24, 2023
1 parent e2cbd7c commit 9f40c7d
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@
"""Tests for quantum neural networks classifier."""
import numpy as np
from ddt import ddt, data
from qiskit.algorithms.optimizers import COBYLA
from qiskit_algorithms.optimizers import COBYLA
from qiskit_algorithms.utils import algorithm_globals
from qiskit.primitives import Sampler as ReferenceSampler
from qiskit.utils import algorithm_globals
from qiskit_aer.primitives import Sampler as AerSampler
from qiskit_machine_learning.algorithms.classifiers import VQC

Expand Down Expand Up @@ -49,7 +49,7 @@ def test_neural_network_classifier(self, implementation):
num_qubits=2,
optimizer=COBYLA(maxiter=100),
sampler=sampler,
initial_point=np.zeros((2, 4)),
initial_point=None,
)

vqc.fit(x, y01)
Expand Down
5 changes: 3 additions & 2 deletions qiskit_neko/tests/nature/test_ground_state_solver.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@

"""Test ground state solvers."""

from qiskit.algorithms.minimum_eigensolvers import NumPyMinimumEigensolver, VQE
from qiskit.algorithms.optimizers import SLSQP
from qiskit_algorithms import NumPyMinimumEigensolver, VQE
from qiskit_algorithms.optimizers import SLSQP
from qiskit.primitives import Estimator
from qiskit_nature.second_q.algorithms import GroundStateEigensolver
from qiskit_nature.second_q.circuit.library import HartreeFock, UCCSD
Expand Down Expand Up @@ -49,6 +49,7 @@ def test_ground_state_solver(self):
vqe_solver.initial_point = [0.0] * ansatz.num_parameters
calc = GroundStateEigensolver(qubit_mapper, vqe_solver)
result = calc.solve(es_problem)

# Calculate expected result from numpy solver
numpy_solver = NumPyMinimumEigensolver()
np_calc = GroundStateEigensolver(qubit_mapper, numpy_solver)
Expand Down
4 changes: 2 additions & 2 deletions qiskit_neko/tests/primitives/test_vqe.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@

"""Test primitives with vqe."""

from qiskit.algorithms.minimum_eigensolvers import VQE, SamplingVQE
from qiskit.algorithms.optimizers import SPSA
from qiskit_algorithms import VQE, SamplingVQE
from qiskit_algorithms.optimizers import SPSA
from qiskit.circuit.library import TwoLocal
from qiskit.opflow import PauliSumOp
from qiskit.primitives import BackendEstimator, BackendSampler
Expand Down
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
qiskit-terra
qiskit-algorithms
qiskit-aer
qiskit-nature[pyscf]
qiskit-experiments
Expand Down

0 comments on commit 9f40c7d

Please sign in to comment.