Skip to content

Faster hashing for Pauli operators. #13355

@MarcDrudis

Description

@MarcDrudis

What should we add?

Currently the hashing of a Pauli operator is computed as hash(self.to_label()). It is basically asking for the label of the Pauli operator which is an expensive computation to run. Instead building it directly from self.x, self.z,self.phase seems more reasonable.
I did a quick test where I do the hashing with int.from_bytes(np.packbits([self.x, self.z]+[self.phase])) and it was about 50 times faster.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions