qiskit-community / qiskit-nature

Qiskit Nature is an open-source, quantum computing, framework for solving quantum mechanical natural science problems.
https://qiskit-community.github.io/qiskit-nature/
Apache License 2.0
301 stars 204 forks source link

feat: improve the `SparseLabelOp.register_length` handling #1240

Closed mrossinek closed 1 year ago

mrossinek commented 1 year ago

Summary

Closes #1190

Details and comments

I chose not to cache the value which gets inferred during the register_length property getter. The main reason is that this should not be too much of a performance issue (and a user can set it if they wish to improve performance) and invalidating the cache would become annoying to deal with and litter the code unnecessarily.