Skip to content

Commit

Permalink
fix merge errors
Browse files Browse the repository at this point in the history
  • Loading branch information
LuisAlfredoNu committed Sep 24, 2024
1 parent 0338cb8 commit b6a2901
Show file tree
Hide file tree
Showing 4 changed files with 3 additions and 29 deletions.
3 changes: 0 additions & 3 deletions mpitests/test_adjoint_jacobian.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,6 @@
if not ld._CPP_BINARY_AVAILABLE:
pytest.skip("No binary module found. Skipping.", allow_module_level=True)

if device_name == "lightning.gpu":
pytest.skip("LGPU new API in WIP. Skipping.", allow_module_level=True)

I, X, Y, Z = (
np.eye(2),
qml.PauliX.compute_matrix(),
Expand Down
8 changes: 3 additions & 5 deletions mpitests/test_apply.py
Original file line number Diff line number Diff line change
Expand Up @@ -384,7 +384,7 @@ def circuit():
class TestSparseHamExpval: # pylint: disable=too-few-public-methods,missing-function-docstring
"""Tests sparse hamiltonian expectation values."""

@pytest.mark.parametrize("C_DTYPE", [np.complex128])
@pytest.mark.parametrize("C_DTYPE", [np.complex128, np.complex64])
def test_sparse_hamiltonian_expectation(self, C_DTYPE):
comm = MPI.COMM_WORLD
commSize = comm.Get_size()
Expand Down Expand Up @@ -429,13 +429,11 @@ def circuit():
mpi_qnode = qml.QNode(circuit, dev_mpi)
expected_output_mpi = mpi_qnode()

comm.Barrier()

assert np.allclose(expected_output_mpi, expected_output_gpu)


@pytest.mark.skipif(
device_name == "lightning.gpu",
reason="LGPU new API in WIP. Skipping.",
)
class TestExpval:
"""Tests that expectation values are properly calculated or that the proper errors are raised."""

Expand Down
3 changes: 0 additions & 3 deletions mpitests/test_probs.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,6 @@
# pylint: disable=missing-function-docstring,unnecessary-comprehension,too-many-arguments,wrong-import-order,unused-variable,c-extension-no-member
from mpi4py import MPI

if device_name == "lightning.gpu":
pytest.skip("LGPU new API in WIP. Skipping.", allow_module_level=True)

numQubits = 8


Expand Down
18 changes: 0 additions & 18 deletions pennylane_lightning/lightning_gpu/_measurements.py
Original file line number Diff line number Diff line change
Expand Up @@ -157,14 +157,6 @@ def expval(self, measurementprocess: MeasurementProcess):

if isinstance(measurementprocess.obs, qml.SparseHamiltonian):
# ensuring CSR sparse representation.
# CSR_SparseHamiltonian = measurementprocess.obs.sparse_matrix(
# wire_order=list(range(self._qubit_state.num_wires))
# ).tocsr(copy=False)
# return self._measurement_lightning.expval(
# CSR_SparseHamiltonian.indptr,
# CSR_SparseHamiltonian.indices,
# CSR_SparseHamiltonian.data,
# )

if self._use_mpi:
# Identity for CSR_SparseHamiltonian to pass to processes with rank != 0 to reduce
Expand Down Expand Up @@ -195,16 +187,6 @@ def expval(self, measurementprocess: MeasurementProcess):
matrix = measurementprocess.obs.matrix()
return self._measurement_lightning.expval(matrix, observable_wires)

# if (
# isinstance(measurementprocess.obs, (qml.ops.Hamiltonian, qml.Hermitian))
# or (measurementprocess.obs.arithmetic_depth > 0)
# or isinstance(measurementprocess.obs.name, List)
# ):
# ob_serialized = QuantumScriptSerializer(
# self._qubit_state.device_name, self.dtype == np.complex64
# )._ob(measurementprocess.obs)
# return self._measurement_lightning.expval(ob_serialized)

if (
isinstance(measurementprocess.obs, qml.ops.Hamiltonian)
or (measurementprocess.obs.arithmetic_depth > 0)
Expand Down

0 comments on commit b6a2901

Please sign in to comment.