ProjectQ-Framework / FermiLib

FermiLib: Open source software for analyzing fermionic quantum simulation algorithms
https://projectq.ch/
Apache License 2.0
85 stars 39 forks source link

Added expectation value of product state #132

Closed idk3 closed 7 years ago

idk3 commented 7 years ago

A scipy.sparse.csc vector is polynomial time to pass - I'm not converting the operator to sparse. I think it would be worthwhile to allow bitstrings as well and will add that functionality.

On Mon, Jul 24, 2017 at 3:10 PM Ryan Babbush notifications@github.com wrote:

@babbush requested changes on this pull request.

In src/fermilib/utils/_sparse_tools.py https://github.com/ProjectQ-Framework/FermiLib/pull/132#discussion_r129167764 :

@@ -300,7 +301,7 @@ def expectation(sparse_operator, state): """Compute expectation value of operator with a state.

 Args:
  • state_vector: scipy.sparse.csc vector representing a pure state,
  • state: scipy.sparse.csc vector representing a pure state,

The whole point of this function is to take these expectation values in polynomial time with respect to N. Why would you give a scipy.sparse.csc vector as input instead of a bit string?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/ProjectQ-Framework/FermiLib/pull/132#pullrequestreview-51912867, or mute the thread https://github.com/notifications/unsubscribe-auth/AKRqnYrl0fIZP1G9z0Hz7-dn2QydOaGSks5sRRZLgaJpZM4OhvTt .