PennyLaneAI / pennylane

PennyLane is a cross-platform Python library for quantum computing, quantum machine learning, and quantum chemistry. Train a quantum computer the same way as a neural network.
https://pennylane.ai
Apache License 2.0
2.36k stars 604 forks source link

[BUG] `qml.equal` does not compare hyperparameters that are lists #6175

Closed KetpuntoG closed 2 months ago

KetpuntoG commented 2 months ago

Expected behavior

This should return True


H1 = qml.ops.LinearCombination(np.array([1.0, 1.0]), [qml.PauliX(0), qml.PauliZ(0)])
H2 = qml.ops.LinearCombination(np.array([1.0, 1.0]), [qml.PauliX(0), qml.PauliZ(0)])

op1 = qml.PrepSelPrep(H1, control=[1])
op2 = qml.PrepSelPrep(H2, control=[1])

qml.assert_equal(op1, op2)

Actual behavior

Captura de pantalla 2024-08-28 a las 16 23 38

Additional information

No response

Source code

No response

Tracebacks

No response

System information

Name: PennyLane
Version: 0.39.0.dev2
Summary: PennyLane is a cross-platform Python library for quantum computing, quantum machine learning, and quantum chemistry. Train a quantum computer the same way as a neural network.
Home-page: https://github.com/PennyLaneAI/pennylane
Author: 
Author-email: 
License: Apache License 2.0
Location: /usr/local/lib/python3.10/dist-packages
Requires: appdirs, autograd, autoray, cachetools, networkx, numpy, packaging, pennylane-lightning, requests, rustworkx, scipy, toml, typing-extensions
Required-by: PennyLane_Lightning

Platform info:           Linux-6.1.85+-x86_64-with-glibc2.35
Python version:          3.10.12
Numpy version:           1.26.4
Scipy version:           1.13.1
Installed devices:
- lightning.qubit (PennyLane_Lightning-0.37.0)
- default.clifford (PennyLane-0.39.0.dev2)
- default.gaussian (PennyLane-0.39.0.dev2)
- default.mixed (PennyLane-0.39.0.dev2)
- default.qubit (PennyLane-0.39.0.dev2)
- default.qubit.autograd (PennyLane-0.39.0.dev2)
- default.qubit.jax (PennyLane-0.39.0.dev2)
- default.qubit.legacy (PennyLane-0.39.0.dev2)
- default.qubit.tf (PennyLane-0.39.0.dev2)
- default.qubit.torch (PennyLane-0.39.0.dev2)
- default.qutrit (PennyLane-0.39.0.dev2)
- default.qutrit.mixed (PennyLane-0.39.0.dev2)
- default.tensor (PennyLane-0.39.0.dev2)
- null.qubit (PennyLane-0.39.0.dev2)

Existing GitHub issues