q.js icon indicating copy to clipboard operation
q.js copied to clipboard

Implement fromBlochVector

Open marwahaha opened this issue 4 years ago • 2 comments

fixes #5

One way I was testing was by using

fromBlochVector(1, 0, 0).toBlochSphere().vector

and seeing if the output matches the input.

marwahaha avatar Sep 13 '20 08:09 marwahaha

This is great. Can you add variable declarations in your code? Something like:

const
aReal = ( 0.5 + 0.5 * z ) ** 0.5,
a = new Q.ComplexNumber( aReal, 0 ),
b = new Q.ComplexNumber( x / 2 / aReal, y / 2 / aReal )

That way aReal, a, and b don’t fall into the global scope by accident. I think at that point it will be good for a merge.

stewdio avatar Sep 17 '20 19:09 stewdio

Ok, I've added them :-)

marwahaha avatar Oct 06 '20 11:10 marwahaha