defgate: No validation whether the matrix is unitary
See original GitHub issueHi,
This is not a feature request, I’m just trying to wrap my head around the infrastructure - if this is not the right place to ask, please let me know where I can ask learning questions as a total newbie to quantum computing and the Rigetti stack.
I was wondering what is the reason behind that I can create a quantum gate based on a non-unitary matrix? Is this something I’d have to be careful about in the future as well, or Forest is planned to have a feature to validate against non-unitary operators? Also, it’s one thing that it can run on the QVM - but how would this operate on a real quantum processor?
>>> import pyquil.quil as pq
>>> import numpy as np
>>> import pyquil.forest as forest
>>> qvm = forest.Connection()
>>> non_unitary_mx =np.array(([1.0, 2.0], [3.0, 4.0]))
>>> bad_prog = pq.Program().defgate("NON-UNITARY-BAD-GATE", non_unitary_mx)
>>> bad_prog.inst(("NON-UNITARY-BAD-GATE",0))
<pyquil.quil.Program object at 0x1096e92d0>
>>> bad_prog.inst(("NON-UNITARY-BAD-GATE",1))
<pyquil.quil.Program object at 0x1096e92d0>
>>> print bad_prog
DEFGATE NON-UNITARY-BAD-GATE:
1.0, 2.0
3.0, 4.0
NON-UNITARY-BAD-GATE 0
NON-UNITARY-BAD-GATE 1
>>> print qvm.wavefunction(bad_prog)
(array([ 1.+0.j, 3.+0.j, 3.+0.j, 9.+0.j]), [])
Issue Analytics
- State:
- Created 7 years ago
- Comments:5 (5 by maintainers)
Top Results From Across the Web
What is a Unitary Matrix and How to Prove that a ... - YouTube
In this video I will define a unitary matrix and teach you how to prove that a matrix is unitary. To do this...
Read more >Unitary Matrices - TAMU Math
A matrix U ∈ Mn is said to be unitary if U*U = I. [If U ∈ Mn(R) and UT U = I,...
Read more >Unitary matrix - Wikipedia
In linear algebra, a complex square matrix U is unitary if its conjugate transpose U* is also its inverse, that is, if.
Read more >Unitary matrix - StatLect
A unitary matrix is a complex square matrix whose columns (and rows) are orthonormal. It has the remarkable property that its inverse is...
Read more >How do I test if a matrix is unitary? - MATLAB Answers
My current test for a unitary matrix is shown in the code, I'd also like to know if U = e^(iH) [i is...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I thought I might note what the Quil spec says about this.
Accordingly, an implementer of Quil can define how he or she pleases what happens when someone defines a non-unitary gate.
Closed by #21