Chris Granade
  • Member for 3 years, 9 months
  • Last seen more than a month ago
Ground state energy estimation - VQE vs. Ising vs. Trotter–Suzuki
Accepted answer
9 votes

In each of the examples you mentioned, the task breaks very roughly down into two steps: finding a Hamiltonian that describes the problem in terms of qubits, and finding the ground state energy of ...

View answer
What is the difference between the action of $Z$ and $\exp(-i Z t)$ on a state?
Accepted answer
8 votes

Effectively, the Z operation (represented by the Pauli $Z$ matrix) applies a rotation about the $Z$-axis. As you note, rotations can also be written in the form $e^{-i Z t}$. To see that, you can use ...

View answer
What all parameters can we take into account when comparing different quantum programming languages
Accepted answer
5 votes

Just as with classical computing, we don't expect that in quantum computing the choice of a programming language will have a direct effect on the time and space complexity of most algorithms. That is, ...

View answer
Q# Simulation Behavior
Accepted answer
5 votes

Thanks for your question! If you're interested in running multiple shots of a quantum operation, Q# allow for doing that with conventional programming techniques such as a for loop: open Microsoft....

View answer
How to compute the inverse of an operation in Q#?
5 votes

In the case that your operation can be represented by a unitary operator $U$ (this is typically the case if your operation doesn't use any measurements), you can indicate that by adding is Adj to your ...

View answer
How do you send an array of qubits to an operation in Q#?
Accepted answer
5 votes

In general, there are exactly two ways to allocate qubits in Q#: the using statement, and the borrowing statement. Both can only be used from within Q#, and can't be directly used from within C#. Thus,...

View answer
$S^{\dagger}$ gate in Q#
4 votes

Since the S operation supports the Adjoint functor, the Q# call Adjoint S(target) is the easiest way to call the $S^{\dagger}$ gate. To verify that this is the same as the suggestion made above by ...

View answer
How can I represent mixed states in Q#?
Accepted answer
4 votes

It can be helpful to step back and look at what a density matrix describes: a probability distribution over projectors onto pure states. In your example, for instance, $\rho$ represents a distribution ...

View answer
Is there a quantum operation whose output is always orthogonal to the input?
4 votes

This is easiest to show by contradiction, so lets suppose that there exists an operation TransformToOrthogonal that maps the state of its input qubits to an orthogonal state. Reversible quantum ...

View answer
Q# installation on Heroku
3 votes

I believe that Heroku does not currently support installing additional software, such as the IQ# kernel used by the qsharp Python package. That said, Heroku's documentation suggests that using Docker ...

View answer
Run circuit N times in Q#
Accepted answer
3 votes

Quantum programs in Q# can include classical logic as well as low-level quantum instructions, such that you can directly include the "shot" concept from circuits in your Q# programs by using ...

View answer
Testing superposition states in Q#
Accepted answer
3 votes

As @JSdJ indicated in their comment, one approach is to perform the assertion in the 𝑋-basis instead of the 𝑍-basis: open Microsoft.Quantum.Diagnostics; @Test("QuantumSimulator") ...

View answer
How do these alternative Q# algorithms produce the same set of Bell states?
Accepted answer
3 votes

The unit test logic is correct, no worries there! One of the really neat things about the four Bell states is that you can transform between each using single-qubit operations. For example, consider ...

View answer
Hamming with prefix oracle
Accepted answer
3 votes

One problem is that you are resetting the $\left|z\right\rangle$ register after applying the Controlled X(z, y) operation. Right before you reset, your $\left|z\right\rangle$ register is entangled ...

View answer
How can I code a Conditional phase shift transform?
Accepted answer
2 votes

The trick here is to define a new operation whose unitary representation is \begin{align} S_a|i\rangle = \begin{cases} -|i\rangle \text{ if } i = a \\ |i\rangle \text{ otherwise } ...

View answer
Q#: dynamically assigning (or updating) multidimensional Qubit arrays
Accepted answer
2 votes

One important thing to note is that arrays of Qubit aren't special in Q#, such that a solution that allows for splitting an array of type 'T[] into 'T[][][] will also work for arrays of qubits such as ...

View answer
Accessing tupple data in Q#
Accepted answer
1 votes

The subscripting operator ([]) in Q# only works on values of array types, such as Int[], Qubit[] or Double[][]. To unpack a tuple, you can deconstruct when you assign the tuple in a let statement or ...

View answer
How to implement quantum gate from matrix in Q#
Accepted answer
1 votes

There's a feature request for a Q# operation to apply an arbitrary unitary operation given its representation as a matrix; if you're interested, please go on and leave a comment on that request! In ...

View answer
Is it possible to create a Q# operation with optional parameters?
1 votes

One way that I've found that works pretty well is to define a new UDT for options, and then provide a function that returns a reasonable set of defaults. For instance, in the case you gave, you might ...

View answer
given an EPR pair, how do I calculate expectation value?
1 votes

The key to figuring out the probability of any measurement result is Born's rule, which says that if you have a state $\left|\psi\right\rangle$ the probability of observing measurement outcome $\left|\...

View answer