Skip to content

pauli_decompose should have a better error message for sparse inputs #8542

@isaacdevlugt

Description

@isaacdevlugt

This isn't a supported feature at the moment, but our validation could be better:

import pennylane as qml

wires = range(5)
coeffs = [1 for _ in wires]
observables = [qml.Z(i) for i in wires]
H = qml.Hamiltonian(coeffs, observables)
Hmat = H.sparse_matrix()

>>> qml.pauli_decompose(Hmat)
ImportError: autoray couldn't find function 'gather' for backend 'scipy'.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions