learn-qc-with-python-and-qsharp
learn-qc-with-python-and-qsharp copied to clipboard
Companion code for Learn Quantum Computing with Python and Q# Book by Dr. Sarah Kaiser and Dr. Cassandra Granade 💖
Fixing typos in the truth table in the answer to Exercise 6.3.
A call to gate_expand_1toN was using old namespace, causing it to fail with latest version of QuTiP (4.7.0). Fixing
https://github.com/crazy4pi314/learn-qc-with-python-and-qsharp/blob/7ffb0119e4f223ff9ab6e2dad0fa381923d2538e/ch02/simulator.py#L32 In Chapter 2 and 3, wouldn't it be didactically more correct to write the measurement function as a product ? `np.abs((KET_0.T @ self.state) ** 2)[0, 0]` ?
This PR proposes more Pythonic comparisons between boolean values, in the cases where we know and expect the corresponding data types to be booleans (e.g., `0 is False` is `False`,...
As per the [`QuantumDevice` interface](https://github.com/crazy4pi314/learn-qc-with-python-and-qsharp/blob/7ffb0119e4f223ff9ab6e2dad0fa381923d2538e/ch03/interface.py#L45), the qubit `reset()` operation already takes place upon exiting from the `using_device` context manager, and this PR proposes removal of a couple of places where...
File "...\learn-qc-with-python-and-qsharp\ch05\simulator.py", line 88, in _apply matrix = qt.circuit.gate_expand_1toN( AttributeError: module 'qutip.qip.circuit' has no attribute 'gate_expand_1toN' File "...\learn-qc-with-python-and-qsharp\ch06\simulator.py", line 124, in _apply matrix = qt.circuit.gate_expand_2toN(unitary, AttributeError: module 'qutip.qip.circuit' has no...
Now that Q# + Python can use project files for references, we should add them here so IntelliSense can work better :)
In the solution to Exercise 11.5, the number of qubits passed to NIterations function was different from the size of the qubits array (BitSizeI(nItems) vs BitSizeI(nItesm - 1)). Fixing it.
is the truth table correct for example 6.3? Shouldn't the output for the first two terms be i|1> and -i|0> instead of i|0> and -i|1>?