Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

qibo.hamiltonian.models built starting from their dense form #1590

Open
BrunoLiegiBastonLiegi opened this issue Feb 12, 2025 · 3 comments
Open

Comments

@BrunoLiegiBastonLiegi
Copy link
Contributor

BrunoLiegiBastonLiegi commented Feb 12, 2025

Currently, many qibo.hamiltonians.models implement their construction both starting from the dense form, i.e. the matrix representation, and their symbolic form, i.e. starting from qibo symbols (introduced in #1548). Since, the latter is a more flexible approach from which it is relatively easy to recover the former (a SymbolicHamiltonian.dense() call should be totally equivalent), I wonder whether it makes sense to keep the explicit dense construction as well.

https://github.com/qiboteam/qibo/blob/09cba741e391c07910daad0faccf9d5e212b61c2/src/qibo/hamiltonians/models.py#L83C1-L89C58

@alecandido
Copy link
Member

Since, the latter is a more flexible

Is it sufficiently general to fully cover the other case? To the best of your understanding

@BrunoLiegiBastonLiegi
Copy link
Contributor Author

I would say so, yes, the only counter argument I would think of is performance wise: it may be that since the dense construction is targeting a specific hamiltonian, it may be better optimized than the general symbolic to dense implementation (which is thought for any generic hamiltonian).

@alecandido
Copy link
Member

I would say so, yes, the only counter argument I would think of is performance wise: it may be that since the dense construction is targeting a specific hamiltonian, it may be better optimized than the general symbolic to dense implementation (which is thought for any generic hamiltonian).

I guess that working with large Hamiltonians is terrible anyhow, because of the exponential scaling. And arrays have limited applications, since it's hard (or impossible) to use them beyond state-vector simulation.
For small ones, efficiency is not a concern anyhow.

So, if performances are the only issue, it doesn't seem to be very limiting...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants