q.js
q.js copied to clipboard
Implement fromBlochVector
fixes #5
One way I was testing was by using
fromBlochVector(1, 0, 0).toBlochSphere().vector
and seeing if the output matches the input.
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.
Ok, I've added them :-)