question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[Discussion] Adding quantum math features

See original GitHub issue

Sometimes, it is useful to be able to analyze circuits in ways that aren’t valid on a quantum computer, but might still be interesting for theory reasons. I came across this issue a little while ago when wanting to compute the overlap <psi_1 | psi_2> of a state and had a hard time keeping memory limits under control with larger batch and state sizes using tfq.layers.State. I ultimately ended up simulating the circuits one by one, and doing the inner products in tf manually. It worked, but it wasn’t pretty.

Would people be interested in implementing things like:

Examples that can be done right now, but are tricky to get right without blowing up memory:

tfq.math.overlap # => analytically compute state overlap between the two circuits
tfq.math.amplitudes # => analytically compute requested state amplitudes (could use qsimh ?).
tfq.math.fideltiy # => analytically compute fidelity between two circuits.

Other interesting math functions might be worth having

tfq.math.operator_matrix # => ingest a cirq.PauliSum and compute the matrix
tfq.math.operator_commutators # => compute commutators on operator matrices

Does anyone else have any suggestions for useful math function ? @dabacon @zaqqwerty @jaeyoo @we-taper

Final thought: If we do end up making this .math module , maybe we should move calculate_unitary and calculate_state inside of it.

Issue Analytics

  • State:open
  • Created 3 years ago
  • Comments:17 (3 by maintainers)

github_iconTop GitHub Comments

3reactions
MichaelBroughtoncommented, Apr 6, 2021

I’d say a good approach would be this:

  1. Open an issue titled “[Math] Implement tfq.math.whatever op you pick” with the basic steps you envision for implementing it.
  2. Assign it to yourself and put a reference back to this issue in the description.
  3. Add any needed support code in small PRs before the main op contribution PR.
  4. Create the op PR with similar structure to something like #508 or #387 .
  5. Once merged we can cross the op off the list on here.

Since op contributions aren’t coming in very quickly and are a fairly sizable undertaking, I think anyone looking to contribute a new op should definitely take this “one at a time issue creation followed by PR chain” approach.

1reaction
MichaelBroughtoncommented, May 6, 2021

Looks like we had an implementation of fidelity go in here #554 from @jaeyoo so we can cross it off the list here.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Quantum Questions Inspire New Math | Quanta Magazine
In order to fully understand the quantum world, we may have to develop a new realm of mathematics.
Read more >
Discussion of foundation of mathematics and ... - De Gruyter
This approach is in the spirit of belief of many mathematicians that sets of characteristic 0 are more general that finite sets, and...
Read more >
Mathematical formulation of quantum mechanics - Wikipedia
The mathematical formulations of quantum mechanics are those mathematical formalisms that permit a rigorous description of quantum mechanics.
Read more >
STUDY WITH ME | Math for Quantum Physics - YouTube
Follow along with this Quantum Objects course at https://brilliant.org/tibees/I cover ideas including Dirac notation (bra-ket) and how we ...
Read more >
Discussion of Foundation of Mathematics and Quantum Theory
With application to gravity and particle theory}. ... In particular, quantum theory based on a finite ring of characteristic $p$ is more general ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found